Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: UI Improvements #21

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 103 additions & 14 deletions src/pages/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ impl PageAccountsView {
.push(widget::text::body(format!(
"{}: {}",
fl!("last-sync-time"),
local_time.to_rfc2822()
//local_time.to_rfc2822()
local_time.format("%a, %d %b %Y %H:%M:%S")
)))
.align_y(Alignment::Center)
.into(),
Expand Down Expand Up @@ -266,6 +267,7 @@ impl PageAccountsView {
}

pub fn add_account<'a>(account: Account) -> Element<'a, Message> {
let spacing = theme::active().cosmic().spacing;
let cosmic_theme::Spacing { space_xxs, .. } = theme::active().cosmic().spacing;
let display_name_widget_title = widget::text::body(fl!("display-name"));
let display_name_widget_text_input = widget::text_input("Name", account.display_name.clone())
Expand All @@ -287,19 +289,63 @@ pub fn add_account<'a>(account: Account) -> Element<'a, Message> {

widget::column()
.spacing(space_xxs)
.push(display_name_widget_title)
.push(
widget::row::with_capacity(2)
.spacing(spacing.space_xxs)
.push(widget::icon::from_name("user-available-symbolic"))
.push(display_name_widget_title)
.padding([
spacing.space_none,
spacing.space_xxs,
spacing.space_none,
spacing.space_none,
])
.align_y(Alignment::Center),
)
.push(display_name_widget_text_input)
.push(instance_widget_title)
.push(
widget::row::with_capacity(2)
.spacing(spacing.space_xxs)
.push(widget::icon::from_name("network-server-symbolic"))
.push(instance_widget_title)
.padding([
spacing.space_xxxs,
spacing.space_xxs,
spacing.space_none,
spacing.space_none,
])
.align_y(Alignment::Center),
)
.push(instance_widget_text_input)
.push(api_key_widget_title)
.push(
widget::row::with_capacity(2)
.spacing(spacing.space_xxs)
.push(widget::icon::from_name("system-lock-screen-symbolic"))
.push(api_key_widget_title)
.padding([
spacing.space_xxxs,
spacing.space_xxs,
spacing.space_none,
spacing.space_none,
])
.align_y(Alignment::Start),
)
.push(api_key_widget_text_input)
.push(widget::Space::new(0, 10))
.push(tls_widget_checkbox)
.push(widget::Space::new(0, 10))
.push(
widget::row::with_capacity(1)
.push(tls_widget_checkbox)
.padding([
spacing.space_s,
spacing.space_none,
spacing.space_xs,
spacing.space_none,
]),
)
.push(buttons_widget_container)
.into()
}

#[allow(clippy::too_many_lines)]
pub fn edit_account<'a>(account: Account) -> Element<'a, Message> {
let spacing = theme::active().cosmic().spacing;
let cosmic_theme::Spacing { space_xxs, .. } = theme::active().cosmic().spacing;
Expand Down Expand Up @@ -365,18 +411,61 @@ pub fn edit_account<'a>(account: Account) -> Element<'a, Message> {

widget::column()
.spacing(space_xxs)
.push(display_name_widget_title)
.push(
widget::row::with_capacity(2)
.spacing(spacing.space_xxs)
.push(widget::icon::from_name("user-available-symbolic"))
.push(display_name_widget_title)
.padding([
spacing.space_none,
spacing.space_xxs,
spacing.space_none,
spacing.space_none,
])
.align_y(Alignment::Center),
)
.push(display_name_widget_text_input)
.push(instance_widget_title)
.push(
widget::row::with_capacity(2)
.spacing(spacing.space_xxs)
.push(widget::icon::from_name("network-server-symbolic"))
.push(instance_widget_title)
.padding([
spacing.space_xxxs,
spacing.space_xxs,
spacing.space_none,
spacing.space_none,
])
.align_y(Alignment::Center),
)
.push(instance_widget_text_input)
.push(api_key_widget_title)
.push(
widget::row::with_capacity(2)
.spacing(spacing.space_xxs)
.push(widget::icon::from_name("system-lock-screen-symbolic"))
.push(api_key_widget_title)
.padding([
spacing.space_xxxs,
spacing.space_xxs,
spacing.space_none,
spacing.space_none,
])
.align_y(Alignment::Start),
)
.push(api_key_widget_text_input)
.push(widget::Space::new(0, 10))
.push(tls_widget_checkbox)
.push(widget::Space::new(0, 10))
.push(
widget::row::with_capacity(1)
.push(tls_widget_checkbox)
.padding([
spacing.space_s,
spacing.space_none,
spacing.space_xs,
spacing.space_none,
]),
)
.push(enable_shared_widget_text)
.push(enable_public_shared_widget_text)
.push(widget::Space::new(0, 10))
.push(widget::Space::new(0, 5))
.push(buttons_widget_container)
.into()
}
Loading
Loading