feat(web): redesign account settings and the sign-in page
- account settings: sidebar sections (profile, devices, security, invitations, sync and sign-in) instead of one long scroll; inline device rename, confirmations for destructive actions and toast feedback - sign-in/register: split layout with a quiet brand column, text tabs and underlined inputs; registering asks for the password twice and explains that it cannot be recovered - move invitation accept/label helpers into store/invitations so the toast and the settings inbox share them - add the home page zone styles used by the next commit
This commit is contained in:
1 parent
4b8d0b5a5f
commit
0d31e3d058
16 files changed
+882
-454
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { accountApi, type AccountInvitation } from '@/core-bridge/account';
|
||||
import { errorMessage } from '@/core-bridge/errors';
|
||||
import { channelPath, navigate } from '@/app/navigation';
|
||||
import { useChannels } from './channels';
|
||||
import { useToast } from './toast';
|
||||
|
||||
export function invitationLabel(row: AccountInvitation): string {
|
||||
return row.channelName || `空间 ${row.channel_id.slice(0, 8)}…`;
|
||||
}
|
||||
|
||||
/** 接受邀请并进入空间;结果用 toast 反馈,不抛出 */
|
||||
export async function acceptInvitation(row: AccountInvitation): Promise<void> {
|
||||
try {
|
||||
await accountApi.acceptInvitation(row.channel_id);
|
||||
await useChannels.getState().refresh();
|
||||
useToast.getState().push({ kind: 'ok', text: `已加入 ${invitationLabel(row)}` });
|
||||
navigate(channelPath(row.channel_id));
|
||||
} catch (cause) {
|
||||
useToast.getState().push({ kind: 'error', text: `加入失败:${errorMessage(cause)}` });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user