aboutsummaryrefslogtreecommitdiff
path: root/ui/src/components/user.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/components/user.rs')
-rw-r--r--ui/src/components/user.rs53
1 files changed, 53 insertions, 0 deletions
diff --git a/ui/src/components/user.rs b/ui/src/components/user.rs
new file mode 100644
index 0000000..815c555
--- /dev/null
+++ b/ui/src/components/user.rs
@@ -0,0 +1,53 @@
+/*
+ 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::RenderInfo;
+use jellycommon::{
+ jellyobject::Object,
+ routes::{u_account_login, u_account_settings},
+ *,
+};
+use jellyui_locale::tr;
+
+markup::define! {
+ UserSettings<'a>(ri: &'a RenderInfo<'a>, user: Object<'a>) {
+ h1 { @tr(ri.lang, "settings") }
+
+ h2 { @tr(ri.lang, "settings.account") }
+ a.switch_account[href=u_account_login()] { "Switch Account" }
+ 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") }
+ input[type="text", id="name", name="name", value=user.get(USER_NAME)];
+ input[type="submit", value=tr(ri.lang, "settings.update")];
+ }
+ form[method="POST", action=u_account_settings()] {
+ label[for="password"] { @tr(ri.lang, "tag.Upwd") }
+ 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, "tag.Uthm") }
+ // @for theme in [] {
+ // 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")];
+ // }
+ }
+}