diff --git a/pkg/view/package.json b/pkg/view/package.json index f1b648f..2c57de9 100644 --- a/pkg/view/package.json +++ b/pkg/view/package.json @@ -12,6 +12,7 @@ "dependencies": { "@emotion/react": "^11.11.3", "@emotion/styled": "^11.11.0", + "@fontsource/roboto": "^5.0.8", "@mui/icons-material": "^5.15.10", "@mui/material": "^5.15.10", "@unocss/reset": "^0.58.5", diff --git a/pkg/view/src/components/NavigationDrawer.tsx b/pkg/view/src/components/NavigationDrawer.tsx index 3d07adc..34a128f 100644 --- a/pkg/view/src/components/NavigationDrawer.tsx +++ b/pkg/view/src/components/NavigationDrawer.tsx @@ -1,7 +1,8 @@ import ChevronLeftIcon from "@mui/icons-material/ChevronLeft"; import ChevronRightIcon from "@mui/icons-material/ChevronRight"; import { - Box, Collapse, + Box, + Collapse, Divider, Drawer, IconButton, @@ -14,15 +15,13 @@ import { } from "@mui/material"; import { theme } from "@/theme"; import { Fragment, ReactNode, useState } from "react"; -import HomeIcon from "@mui/icons-material/Home"; -import ArticleIcon from "@mui/icons-material/Article"; -import FeedIcon from "@mui/icons-material/RssFeed"; -import InfoIcon from "@mui/icons-material/Info"; -import GavelIcon from "@mui/icons-material/Gavel"; -import PolicyIcon from "@mui/icons-material/Policy"; -import SupervisedUserCircleIcon from "@mui/icons-material/SupervisedUserCircle"; +import HowToRegIcon from "@mui/icons-material/HowToReg"; +import LoginIcon from "@mui/icons-material/Login"; +import FaceIcon from "@mui/icons-material/Face"; +import LogoutIcon from "@mui/icons-material/Logout"; import ExpandLess from "@mui/icons-material/ExpandLess"; import ExpandMore from "@mui/icons-material/ExpandMore"; +import { useUserinfo } from "@/stores/userinfo.tsx"; export interface NavigationItem { icon?: ReactNode; @@ -33,19 +32,6 @@ export interface NavigationItem { } export const DRAWER_WIDTH = 320; -export const NAVIGATION_ITEMS: NavigationItem[] = [ - { icon: , title: "首页", link: "/" }, - { icon: , title: "博客", link: "/posts" }, - { - icon: , title: "信息中心", children: [ - { icon: , title: "用户协议", link: "/i/user-agreement" }, - { icon: , title: "隐私协议", link: "/i/privacy-policy" }, - { icon: , title: "社区准则", link: "/i/community-guidelines" } - ] - }, - { divider: true }, - { icon: , title: "订阅源", link: "/feed" } -]; export const AppNavigationHeader = styled("div")(({ theme }) => ({ display: "flex", @@ -91,6 +77,23 @@ export function AppNavigationSection({ items, depth }: { items: NavigationItem[] } export function AppNavigation({ showClose, onClose }: { showClose?: boolean; onClose: () => void }) { + const { checkLoggedIn } = useUserinfo(); + + const nav: NavigationItem[] = [ + ...( + checkLoggedIn() ? + [ + { icon: , title: "Account", link: "/users" }, + { divider: true }, + { icon: , title: "Sign out", link: "/auth/sign-out" } + ] : + [ + { icon: , title: "Sign up", link: "/auth/sign-up" }, + { icon: , title: "Sign in", link: "/auth/sign-in" } + ] + ) + ]; + return ( <> @@ -102,7 +105,7 @@ export function AppNavigation({ showClose, onClose }: { showClose?: boolean; onC - + ); diff --git a/pkg/view/src/main.tsx b/pkg/view/src/main.tsx index b962432..9f4f21d 100644 --- a/pkg/view/src/main.tsx +++ b/pkg/view/src/main.tsx @@ -8,6 +8,7 @@ import "virtual:uno.css"; import "./index.css"; import "@unocss/reset/tailwind.css"; +import "@fontsource/roboto/latin.css"; import AppShell from "@/components/AppShell.tsx"; import LandingPage from "@/pages/landing.tsx"; diff --git a/pkg/view/src/pages/auth/sign-in.tsx b/pkg/view/src/pages/auth/sign-in.tsx index ce4620a..2173d10 100644 --- a/pkg/view/src/pages/auth/sign-in.tsx +++ b/pkg/view/src/pages/auth/sign-in.tsx @@ -171,7 +171,7 @@ export default function SignInPage() { disabled={loading} sx={{ mt: 3, mb: 2 }} > - {loading ? "Signing Now..." : "Sign In"} + {loading ? "Processing..." : "Next"} @@ -217,7 +217,7 @@ export default function SignInPage() { disabled={loading} sx={{ mt: 3, mb: 2 }} > - {loading ? "Signing Now..." : "Sign In"} + {loading ? "Processing..." : "Next"} @@ -251,7 +251,7 @@ export default function SignInPage() { disabled={loading} sx={{ mt: 3, mb: 2 }} > - {loading ? "Signing Now..." : "Sign In"} + {loading ? "Processing..." : "Next"} @@ -279,7 +279,7 @@ export default function SignInPage() { return ( - {error && {error}} + {error && {error}} diff --git a/pkg/view/src/pages/auth/sign-up.tsx b/pkg/view/src/pages/auth/sign-up.tsx index 319ebeb..ba3dc8b 100644 --- a/pkg/view/src/pages/auth/sign-up.tsx +++ b/pkg/view/src/pages/auth/sign-up.tsx @@ -168,7 +168,7 @@ export default function SignUpPage() { return ( - {error && {error}} + {error && {error}}