refactor: 将退出登录功能从顶部导航栏移至设置面板

This commit is contained in:
2026-06-14 18:42:47 +08:00
parent 8de956719c
commit 1109ab41f7
6 changed files with 48 additions and 31 deletions

View File

@@ -9,12 +9,14 @@ import type { SessionConfig, Theme } from "../../types";
interface ConfigPanelProps {
config: SessionConfig;
theme: Theme;
username?: string;
onUpdate: (partial: Partial<SessionConfig>) => void;
onThemeChange: (theme: Theme) => void;
onLogout?: () => void;
onClose: () => void;
}
export function ConfigPanel({ config, theme, onUpdate, onThemeChange, onClose }: ConfigPanelProps) {
export function ConfigPanel({ config, theme, username, onUpdate, onThemeChange, onLogout, onClose }: ConfigPanelProps) {
const { t } = useI18n();
return (
@@ -88,6 +90,24 @@ export function ConfigPanel({ config, theme, onUpdate, onThemeChange, onClose }:
</select>
</label>
</div>
{username && onLogout && (
<div className="config-group">
<div className="config-group__title">{t("settings.account")}</div>
<div className="config-row" style={{ cursor: "default" }}>
<div className="config-row__info">
<span className="config-row__label">{t("settings.account.user")}</span>
<span className="config-row__desc">{username}</span>
</div>
</div>
<button
className="config-logout-btn"
onClick={onLogout}
>
{t("auth.logout")}
</button>
</div>
)}
</div>
</div>
</div>