恢复平台账号顶栏与我的页签
按新版创作页原布局恢复泥点入口与账号身份胶囊。 在桌面侧栏补回我的页签及游客、登录态个人页面。 个人页面只复用账号、钱包、统计、设置和法律信息等平台能力。 补充壳层与个人页面回归测试并更新退役边界文档。
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import {
|
||||
FolderKanban,
|
||||
LogIn,
|
||||
Palette,
|
||||
Settings,
|
||||
UserRound,
|
||||
} from 'lucide-react';
|
||||
import {
|
||||
@@ -22,8 +20,11 @@ import {
|
||||
} from '../../routing/activeAppPageRoutes';
|
||||
import { getPlatformProfileDashboard } from '../../services/platform-entry/platformProfileClient';
|
||||
import { useAuthUi } from '../auth/AuthUiContext';
|
||||
import { PlatformActionButton } from '../common/PlatformActionButton';
|
||||
import { PlatformIconButton } from '../common/PlatformIconButton';
|
||||
import {
|
||||
resolveActivePublicUserCode,
|
||||
resolveActiveUserAvatarLabel,
|
||||
} from './platformActiveProfileModel';
|
||||
import { PlatformActiveProfileView } from './PlatformActiveProfileView';
|
||||
import type { PlatformEntryFlowShellProps } from './platformEntryActiveTypes';
|
||||
import { PlatformProfileRechargeModal } from './PlatformProfileRechargeModal';
|
||||
import { PlatformProfileWalletLedgerModal } from './PlatformProfileWalletLedgerModal';
|
||||
@@ -136,6 +137,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
null,
|
||||
);
|
||||
const [isLoadingDashboard, setIsLoadingDashboard] = useState(false);
|
||||
const [isProfileStage, setIsProfileStage] = useState(false);
|
||||
|
||||
const refreshDashboard = useCallback(async () => {
|
||||
if (!authUi?.user || !authUi.canAccessProtectedData) {
|
||||
@@ -156,6 +158,12 @@ export function PlatformEntryFlowShellImpl({
|
||||
void refreshDashboard();
|
||||
}, [refreshDashboard]);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectionStage !== 'platform') {
|
||||
setIsProfileStage(false);
|
||||
}
|
||||
}, [selectionStage]);
|
||||
|
||||
const profileCenter = usePlatformProfileCenterController({
|
||||
activeTab: 'project',
|
||||
isAuthenticated: Boolean(authUi?.user),
|
||||
@@ -166,15 +174,23 @@ export function PlatformEntryFlowShellImpl({
|
||||
});
|
||||
|
||||
const openCreation = useCallback(() => {
|
||||
setIsProfileStage(false);
|
||||
pushAppHistoryPath('/creation');
|
||||
setSelectionStage('creation-home', { path: '/creation' });
|
||||
}, [setSelectionStage]);
|
||||
|
||||
const openProjects = useCallback(() => {
|
||||
setIsProfileStage(false);
|
||||
pushAppHistoryPath('/project');
|
||||
setSelectionStage('project', { path: '/project' });
|
||||
}, [setSelectionStage]);
|
||||
|
||||
const openProfile = useCallback(() => {
|
||||
setIsProfileStage(true);
|
||||
pushAppHistoryPath('/');
|
||||
setSelectionStage('platform', { path: '/' });
|
||||
}, [setSelectionStage]);
|
||||
|
||||
const openEditorProject = useCallback(
|
||||
(projectId: string, options?: { guide?: boolean; tool?: string }) => {
|
||||
const params = new URLSearchParams();
|
||||
@@ -211,12 +227,27 @@ export function PlatformEntryFlowShellImpl({
|
||||
|
||||
const isAuthenticated = Boolean(authUi?.user);
|
||||
const balance =
|
||||
dashboard?.walletBalance ??
|
||||
profileCenter.rechargeCenter?.mudPointBalance?.totalPoints ??
|
||||
profileCenter.rechargeCenter?.walletBalance ??
|
||||
dashboard?.walletBalance ??
|
||||
null;
|
||||
const isCreationStage =
|
||||
selectionStage === 'platform' || selectionStage === 'creation-home';
|
||||
!isProfileStage &&
|
||||
(selectionStage === 'platform' || selectionStage === 'creation-home');
|
||||
const avatarUrl = authUi?.user?.avatarUrl?.trim() || null;
|
||||
const avatarLabel = resolveActiveUserAvatarLabel(authUi?.user);
|
||||
const publicUserCode = resolveActivePublicUserCode(authUi?.user);
|
||||
const openRecharge = () => {
|
||||
profileCenter.setIsRechargeOpen(true);
|
||||
profileCenter.loadRechargeCenter();
|
||||
};
|
||||
const openUserSurface = () => {
|
||||
if (isAuthenticated) {
|
||||
authUi?.openAccountModal();
|
||||
return;
|
||||
}
|
||||
authUi?.openLoginModal();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -246,6 +277,13 @@ export function PlatformEntryFlowShellImpl({
|
||||
label="项目"
|
||||
onClick={openProjects}
|
||||
/>
|
||||
<ActiveRailButton
|
||||
active={isProfileStage}
|
||||
icon={UserRound}
|
||||
iconSrc="/creation-home/nav-profile.png"
|
||||
label="我的"
|
||||
onClick={openProfile}
|
||||
/>
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
@@ -255,10 +293,14 @@ export function PlatformEntryFlowShellImpl({
|
||||
<ActivePlatformBrand />
|
||||
</div>
|
||||
<span className="hidden truncate text-base font-black text-[var(--platform-text-strong)] lg:block">
|
||||
{isCreationStage ? '创作工具' : '项目'}
|
||||
{isProfileStage
|
||||
? '我的'
|
||||
: isCreationStage
|
||||
? '创作工具'
|
||||
: '项目'}
|
||||
</span>
|
||||
|
||||
<div className="platform-desktop-topbar__actions flex shrink-0 items-center gap-2">
|
||||
<div className="platform-desktop-topbar__actions flex shrink-0 items-center gap-3">
|
||||
{isAuthenticated ? (
|
||||
<PlatformMudPointWalletEntry
|
||||
variant="desktop"
|
||||
@@ -271,40 +313,43 @@ export function PlatformEntryFlowShellImpl({
|
||||
profileCenter.isLoadingRechargeCenter
|
||||
}
|
||||
error={profileCenter.rechargeError}
|
||||
className="platform-desktop-create-wallet-chip"
|
||||
onRequestDetails={profileCenter.loadRechargeCenter}
|
||||
onRecharge={() => {
|
||||
profileCenter.setIsRechargeOpen(true);
|
||||
profileCenter.loadRechargeCenter();
|
||||
}}
|
||||
onRecharge={openRecharge}
|
||||
onOpenLedger={profileCenter.openWalletLedgerPanel}
|
||||
/>
|
||||
) : (
|
||||
<PlatformActionButton
|
||||
size="xs"
|
||||
onClick={() => authUi?.openLoginModal()}
|
||||
) : null}
|
||||
<button
|
||||
type="button"
|
||||
onClick={openUserSurface}
|
||||
className="platform-desktop-search flex items-center gap-3 px-3 py-2.5 text-left"
|
||||
>
|
||||
<span
|
||||
className="flex h-11 w-11 items-center justify-center overflow-hidden rounded-full text-base font-black text-white"
|
||||
style={{
|
||||
background: 'var(--platform-profile-avatar-fill)',
|
||||
boxShadow: 'var(--platform-profile-avatar-shadow)',
|
||||
}}
|
||||
>
|
||||
<LogIn className="h-4 w-4" aria-hidden="true" />
|
||||
登录
|
||||
</PlatformActionButton>
|
||||
)}
|
||||
<PlatformIconButton
|
||||
label={isAuthenticated ? '账号' : '登录'}
|
||||
icon={
|
||||
<UserRound className="h-5 w-5" aria-hidden="true" />
|
||||
}
|
||||
onClick={() => {
|
||||
if (isAuthenticated) {
|
||||
authUi?.openAccountModal();
|
||||
return;
|
||||
}
|
||||
authUi?.openLoginModal();
|
||||
}}
|
||||
/>
|
||||
<PlatformIconButton
|
||||
label="设置"
|
||||
icon={<Settings className="h-5 w-5" aria-hidden="true" />}
|
||||
onClick={() => authUi?.openSettingsModal()}
|
||||
/>
|
||||
{avatarUrl ? (
|
||||
<img
|
||||
src={avatarUrl}
|
||||
alt=""
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
) : (
|
||||
avatarLabel
|
||||
)}
|
||||
</span>
|
||||
<span className="min-w-0">
|
||||
<span className="block truncate text-sm font-semibold text-[var(--platform-text-strong)]">
|
||||
{authUi?.user?.displayName || '登录'}
|
||||
</span>
|
||||
<span className="block truncate text-xs text-[var(--platform-text-soft)]">
|
||||
{authUi?.user ? publicUserCode : '账号入口'}
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -312,7 +357,20 @@ export function PlatformEntryFlowShellImpl({
|
||||
id={isCreationStage ? 'platform-tab-panel-create' : undefined}
|
||||
className={`platform-tab-panel min-h-0 min-w-0 flex-1 overflow-auto ${isCreationStage ? '' : 'px-3 py-4 sm:px-6 sm:py-6'}`}
|
||||
>
|
||||
{isCreationStage ? (
|
||||
{isProfileStage ? (
|
||||
<PlatformActiveProfileView
|
||||
dashboard={dashboard}
|
||||
isLoadingDashboard={isLoadingDashboard}
|
||||
user={authUi?.user}
|
||||
onLogin={() => authUi?.openLoginModal()}
|
||||
onOpenAccount={() => authUi?.openAccountModal()}
|
||||
onOpenRecharge={openRecharge}
|
||||
onOpenSettings={() => authUi?.openSettingsModal()}
|
||||
onOpenWalletLedger={
|
||||
profileCenter.openWalletLedgerPanel
|
||||
}
|
||||
/>
|
||||
) : isCreationStage ? (
|
||||
<Suspense
|
||||
fallback={<LoadingPanel label="正在加载创作主页..." />}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user