diff --git a/src/App.tsx b/src/App.tsx index 70ebc81..2bf0a6f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,19 +4,16 @@ import { CheckCircleFilled, CloseOutlined, HomeOutlined, - IdcardOutlined, LockOutlined, LoadingOutlined, - LoginOutlined, LogoutOutlined, MailOutlined, MobileOutlined, - PictureOutlined, SafetyOutlined, UserOutlined, - VideoCameraOutlined, - WalletOutlined, } from "@ant-design/icons"; +import { LocalAvatar } from "./components/LocalAvatar"; +import { Topbar } from "./components/Topbar"; import ErrorBoundary from "./components/ErrorBoundary"; import ToastContainer from "./components/toast/ToastContainer"; import { toast } from "./components/toast/toastStore"; @@ -40,6 +37,9 @@ const EcommercePage = lazy(() => import("./features/ecommerce/EcommercePage")); type AuthMode = "login" | "register"; type AuthMethod = "account" | "email" | "phone"; +type WorkspaceChromeState = { + isToolPage: boolean; +}; interface LocalProfilePageProps { session: WebUserSession; @@ -51,17 +51,6 @@ interface LocalProfilePageProps { onLogout: () => void; } -function LocalAvatar({ session, size = "md" }: { session: WebUserSession; size?: "sm" | "md" | "lg" }) { - const displayName = session.user.displayName || session.user.username || "用户"; - const label = displayName.trim().slice(0, 1).toUpperCase() || "用"; - const avatarUrl = session.user.avatarUrl; - return ( - - {avatarUrl ? {displayName} : {label}} - - ); -} - function LocalProfilePage({ session, balance, imageCount, videoCount, onBack, onBugFeedback, onLogout }: LocalProfilePageProps) { const displayName = session.user.displayName || session.user.username || "用户"; const workCount = Math.max(imageCount + videoCount, 0); @@ -166,6 +155,9 @@ function App() { const [sessionNotice, setSessionNotice] = useState(null); const [profileMenuOpen, setProfileMenuOpen] = useState(false); const [currentPage, setCurrentPage] = useState<"workspace" | "profile">("workspace"); + const [workspaceChrome, setWorkspaceChrome] = useState({ + isToolPage: false, + }); useEffect(() => { void loadDarkGreenTheme(); @@ -318,20 +310,6 @@ function App() { }; const balance = Math.max(usage.balanceCents, 0) / 100; - const displayName = session?.user.displayName || session?.user.username || "用户"; - const actualWorkCount = Math.max(usage.imageUsed + usage.videoUsed, 0); - const shownWorkCount = actualWorkCount; - - const avatarMenuStats = useMemo( - () => [ - { icon: , label: "UID", value: session?.user.id ?? "-" }, - { icon: , label: "积分", value: `${balance.toFixed(2)} 积分` }, - { icon: , label: "图片", value: usage.imageUsed }, - { icon: , label: "视频", value: usage.videoUsed }, - { icon: , label: "作品", value: shownWorkCount }, - ], - [balance, session?.user.id, shownWorkCount, usage.imageUsed, usage.videoUsed], - ); const handleOpenProfile = () => { setProfileMenuOpen(false); @@ -349,86 +327,31 @@ function App() { }; return ( -
-
- -
- {session ? ( -
- - {(Math.max(usage.balanceCents, 0) / 100).toFixed(2)} 积分 - - - {profileMenuOpen ? ( - <> - - - -
- - - ) : null} -
- ) : ( - - )} -
- +
+
{session ? ( -