Files
reader/web/src/features/account/pages/AccountPages.tsx
T
hectorqinandClaude Opus 5.5 b8e5102669 feat(web): 我的 opens every row as a page; preferences on one page
我的 mixed sheets (书架显示, 系统设置, OPDS nested in the shelf sheet) with pages
(外观与主题, 影音浏览, 播放), and the personal preferences were four separate rows.

- 偏好设置 (#/me/settings) holds 外观与主题, 书架, 影音浏览 and 播放 as sections of
  one page, with a jump bar and ?section=; every control applies at once (影音浏览
  loses its save button and unsaved-changes prompt). The shelf's gear still opens
  the same fields (ShelfSettingsFields) as a sheet shortcut.
- 系统设置 becomes three admin pages of 我的 › 管理: 用户管理, 注册与邀请, 服务配置
  (#/me/admin/*, lazily loaded).
- 连接外部阅读器 (OPDS) is a page (#/me/opds) under 账号, also reached from the
  书架 section and the shelf sheet; back returns to whoever opened it.
- Old /me/theme|browse|playback and /media/:channel/settings[/:panel] redirect to
  the matching section; /me/account keeps its page.
- Drops MediaSettingsPage and the CSS only it used; docs follow the new paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 15:12:40 +00:00

28 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Navigate, useLocation } from 'react-router-dom';
import { MediaPageFrame } from '../../media/components/MediaPageFrame.tsx';
import { MediaAccountPanel } from '../../media/components/settings.tsx';
import { useRuntime } from '../../../app/providers/runtime-context.tsx';
import { OpdsAccess } from '../../../ui/opds-access.tsx';
/** 账号与连接 (/me/account): who is signed in, and to which server. */
export function AccountPage() {
const account = useRuntime().mediaApi.accountInfo();
if (!account) return <Navigate to="/me" replace />;
return <MediaPageFrame className="media-secondary-page" title="账号与连接" backTo="/me" backLabel="返回我的">
<MediaAccountPanel account={account} />
</MediaPageFrame>;
}
/**
* 外部阅读器 (/me/opds). Reached from 我的, from 偏好设置 › 书架 and from the shelf's
* settings sheet; back returns to whichever of them opened it (`state.returnTo`).
*/
export function OpdsPage() {
const runtime = useRuntime();
const returnTo = useLocation().state?.returnTo;
const back = typeof returnTo === 'string' && returnTo.startsWith('/') ? returnTo : '/me';
return <MediaPageFrame className="media-secondary-page opds-page" title="连接外部阅读器" backTo={back} backLabel={back === '/me' ? '返回我的' : '返回上一页'}>
<OpdsAccess api={runtime.api} onSignedOut={() => { void runtime.api.signOut(); }} />
</MediaPageFrame>;
}