aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/src/components/user.rs5
-rw-r--r--ui/src/old/account/settings.rs84
-rw-r--r--ui/src/scaffold.rs1
3 files changed, 3 insertions, 87 deletions
diff --git a/ui/src/components/user.rs b/ui/src/components/user.rs
index 815c555..600af22 100644
--- a/ui/src/components/user.rs
+++ b/ui/src/components/user.rs
@@ -7,7 +7,7 @@
use crate::RenderInfo;
use jellycommon::{
jellyobject::Object,
- routes::{u_account_login, u_account_settings},
+ routes::{u_account_login, u_account_logout, u_account_settings},
*,
};
use jellyui_locale::tr;
@@ -17,7 +17,8 @@ markup::define! {
h1 { @tr(ri.lang, "settings") }
h2 { @tr(ri.lang, "settings.account") }
- a.switch_account[href=u_account_login()] { "Switch Account" }
+ a.switch_account[href=u_account_login()] { button { "Switch Account" } }
+ a.switch_account[href=u_account_logout()] { button { "Log out" } }
p { @tr(ri.lang, "tag.Ulgn") ": " @user.get(USER_LOGIN) }
form[method="POST", action=u_account_settings()] {
label[for="name"] { @tr(ri.lang, "tag.Unam") }
diff --git a/ui/src/old/account/settings.rs b/ui/src/old/account/settings.rs
deleted file mode 100644
index 83f72b0..0000000
--- a/ui/src/old/account/settings.rs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- This file is part of jellything (https://codeberg.org/metamuffin/jellything)
- which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
- Copyright (C) 2026 metamuffin <metamuffin.org>
-*/
-use crate::{
- FlashM, Page,
- locale::tr,
- scaffold::{FlashDisplay, RenderInfo, SessionInfo},
-};
-use jellycommon::routes::{u_account_login, u_account_settings};
-use markup::RenderAttributeValue;
-
-impl Page for SettingsPage<'_> {
- fn title(&self) -> String {
- "Settings".to_string()
- }
- fn to_render(&self) -> markup::DynRender<'_> {
- markup::new!(@self)
- }
-}
-
-markup::define! {
- SettingsPage<'a>(ri: &'a RenderInfo<'a>, session: &'a SessionInfo, flash: &'a FlashM) {
- h1 { "Settings" }
- @FlashDisplay {flash}
- h2 { @tr(ri.lang, "account") }
- a.switch_account[href=u_account_login()] { "Switch Account" }
- form[method="POST", action=u_account_settings()] {
- label[for="username"] { @tr(ri.lang, "account.username") }
- input[type="text", id="username", disabled, value=&session.user.name];
- input[type="submit", disabled, value=tr(ri.lang, "settings.immutable")];
- }
- form[method="POST", action=u_account_settings()] {
- label[for="display_name"] { @tr(ri.lang, "account.display_name") }
- input[type="text", id="display_name", name="display_name", value=&session.user.display_name];
- input[type="submit", value=tr(ri.lang, "settings.update")];
- }
- form[method="POST", action=u_account_settings()] {
- label[for="password"] { @tr(ri.lang, "account.password") }
- input[type="password", id="password", name="password"];
- input[type="submit", value=tr(ri.lang, "settings.update")];
- }
- h2 { @tr(ri.lang, "settings.appearance") }
- form[method="POST", action=u_account_settings()] {
- fieldset {
- legend { @tr(ri.lang, "settings.appearance.theme") }
- @for theme in Theme::ALL {
- label { input[type="radio", name="theme", value=A(*theme), checked=session.user.theme==*theme]; @tr(ri.lang, &format!("theme.{theme}")) } br;
- }
- }
- input[type="submit", value=tr(ri.lang, "settings.apply")];
- }
- form[method="POST", action=u_account_settings()] {
- fieldset {
- legend { @tr(ri.lang, "settings.player_preference") }
- @for kind in PlayerKind::ALL {
- label { input[type="radio", name="player_preference", value=A(*kind), checked=session.user.player_preference==*kind]; @tr(ri.lang, &format!("player_kind.{kind}")) } br;
- }
- }
- input[type="submit", value=tr(ri.lang, "settings.apply")];
- }
- form[method="POST", action=u_account_settings()] {
- label[for="native_secret"] { "Native Secret" }
- input[type="password", id="native_secret", name="native_secret"];
- input[type="submit", value=tr(ri.lang, "settings.update")];
- p { "The secret can be found in " code{"$XDG_CONFIG_HOME/jellynative_secret"} " or by clicking " a.button[href="jellynative://show-secret-v1"] { "Show Secret" } "." }
- }
- }
-}
-
-struct A<T>(pub T);
-impl markup::Render for A<Theme> {
- fn render(&self, writer: &mut impl std::fmt::Write) -> std::fmt::Result {
- writer.write_str(self.0.to_str())
- }
-}
-impl markup::Render for A<PlayerKind> {
- fn render(&self, writer: &mut impl std::fmt::Write) -> std::fmt::Result {
- writer.write_str(self.0.to_str())
- }
-}
-impl RenderAttributeValue for A<Theme> {}
-impl RenderAttributeValue for A<PlayerKind> {}
diff --git a/ui/src/scaffold.rs b/ui/src/scaffold.rs
index f24550d..4fc7d60 100644
--- a/ui/src/scaffold.rs
+++ b/ui/src/scaffold.rs
@@ -52,7 +52,6 @@ markup::define! {
a.admin.hybrid_button[href=u_admin_dashboard()] { p {@tr(ri.lang, "nav.admin")} } " "
}
a.settings.hybrid_button[href=u_account_settings()] { p {@tr(ri.lang, "nav.settings")} } " "
- a.logout.hybrid_button[href=u_account_logout()] { p {@tr(ri.lang, "nav.logout")} }
} else {
a.login.hybrid_button[href=u_account_login()] { p {@tr(ri.lang, "nav.login")} }
}