Skip to content

fix(ui): dynamic user nickname in sidebar chip + settings form (rant 2026-08-22T00:01:52) - #113

Merged
argszero merged 1 commit into
mainfrom
fix/user-chip-nickname
Aug 21, 2026
Merged

argszero merged 1 commit into
mainfrom
fix/user-chip-nickname

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Fix hardcoded nickname 「阿零」 in the frontend per host rant 2026-08-22T00:01:52 (project=aitokenpool). The sidebar chip and the settings nickname input showed a static "阿零" instead of the real user name — and saving the settings form without editing would overwrite the real nickname with "阿零".

  • Sidebar chip (ui/index.html): the user chip now has ids (#side-name / #side-avatar); the static <strong>阿零</strong> / avatar 零 are gone
  • renderUserChip() (ui/js/app.js): fills the sidebar name with D.USER.name (fallback: email prefix) and the avatar with the name's first character; called from enterApp() on login and session restore
  • Settings nickname input (ui/index.html + renderSettings()): the input gets id settings-nickname, an empty default, and is filled with the real name when the settings view renders — saving can no longer clobber the real nickname
  • Test seed (src/db.rs): the #[cfg(test)] demo user's name '阿零' → 'demo' (no hardcoded nickname left in source)

Related Issue

Host rant 2026-08-22T00:01:52.266430+08:00 (project=aitokenpool), verbatim:

前端昵称「阿零」硬编码:左下角用户名 + 设置页昵称框都不显示真实用户昵称

建议修复

  1. 左下角用户芯片改为动态:<strong id="side-name">,登录成功后 $("#side-name").textContent = D.USER.name(取不到时 fallback 邮箱前缀);头像「零」改为 name 首字符
  2. 设置页昵称输入框加载时填充真实 D.USER.name(替换静态 value="阿零")
  3. 清理 db.rs 残留的 demo 账号死代码('阿零' 插入 demo@aitokenpool.local)
  4. 检查是否还有其他静态「阿零」硬编码

Changes

  • Sidebar chip dynamic: #side-name = D.USER.name (fallback email prefix), avatar = name first char
  • Settings nickname input filled with real name on render (no static 阿零)
  • db.rs test seed name neutralized
  • No other static 阿零 remaining (source values; comments reference the rant only)

Tests

  • cargo test — 136/136 passed
  • cargo fmt --check — clean
  • cargo clippy --all-targets -- -D warnings — clean
  • node --check ui/js/app.js — clean

Checklist

  • Branch name follows convention (fix/user-chip-nickname)
  • Commit message uses Conventional Commits
  • Single responsibility, minimal change

…2026-08-22T00:01:52)

- ui/index.html: sidebar chip gets ids (side-name / side-avatar), remove
  hardcoded 阿零; settings nickname input gets id settings-nickname, empty
  default (was value=阿零 which would overwrite the real name on save)
- ui/js/app.js: renderUserChip() fills sidebar name + avatar first char
  from D.USER.name (fallback email prefix), called from enterApp();
  renderSettings() fills the nickname input with the real name
- src/db.rs: test-only seed user name '阿零' → 'demo' (no hardcoded
  nickname left in source)
- 136/136 tests + fmt + clippy + node --check clean
@argszero
argszero merged commit 023ee54 into main Aug 21, 2026
1 check passed
@argszero
argszero deleted the fix/user-chip-nickname branch August 21, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant