diff --git a/public/404/404.png b/public/404/404.png new file mode 100644 index 0000000..b827423 Binary files /dev/null and b/public/404/404.png differ diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx new file mode 100644 index 0000000..3c6a7d4 --- /dev/null +++ b/src/app/not-found.tsx @@ -0,0 +1,34 @@ +'use client'; + +import { Button } from 'antd'; +import { useRouter } from 'next/navigation'; +import * as React from 'react'; + +import { useStyles } from '../styles/not-found-styles'; + +const NotFound = () => { + const { styles } = useStyles(); + const router = useRouter(); + return ( +
+
+
+
很抱歉,页面不小心迷路了
+
+ +
+
+
+ ); +}; + +export default NotFound; diff --git a/src/app/setting/SettingClient/BtnList/index.tsx b/src/app/setting/SettingClient/BtnList/index.tsx index 364af43..b820490 100644 --- a/src/app/setting/SettingClient/BtnList/index.tsx +++ b/src/app/setting/SettingClient/BtnList/index.tsx @@ -70,18 +70,18 @@ const SettingBtnList = React.memo(() => { installPrompt.prompt(); // 等待用户做出选择 - installPrompt.userChoice.then(choiceResult => { - if (choiceResult.outcome === 'accepted') { - console.warn('用户接受了安装应用'); - // 在这里你可以执行接受安装后的额外逻辑 - } else { - console.warn('用户拒绝了安装应用'); - // 在这里你可以执行拒绝安装后的额外逻辑 - } + installPrompt.userChoice.then( + (choiceResult: { outcome: 'accepted' | 'dismissed'; platform: string }) => { + if (choiceResult.outcome === 'accepted') { + // console.warn('用户接受了安装应用'); + } else { + // console.warn('用户拒绝了安装应用'); + } - // 清除 installPrompt,因为它不能被重用 - // setInstallPrompt(null); - }); + // 清除 installPrompt,因为它不能被重用 + // setInstallPrompt(null); + } + ); } }, }, diff --git a/src/app/setting/SettingClient/Index.tsx b/src/app/setting/SettingClient/index.tsx similarity index 82% rename from src/app/setting/SettingClient/Index.tsx rename to src/app/setting/SettingClient/index.tsx index dd740a4..bf0f71b 100644 --- a/src/app/setting/SettingClient/Index.tsx +++ b/src/app/setting/SettingClient/index.tsx @@ -13,9 +13,9 @@ interface SettingProps { userData?: GetCurrentUserQuery; } -const Setting = React.memo(({ userData }) => { +const Setting = React.memo(() => { const { styles } = useStyles(); - const { data } = sdk.useGetCurrentUser(undefined, { fallbackData: userData }); + const { data } = sdk.useGetCurrentUser(); return (
diff --git a/src/app/setting/page.tsx b/src/app/setting/page.tsx index ace06dd..466f9a9 100644 --- a/src/app/setting/page.tsx +++ b/src/app/setting/page.tsx @@ -1,27 +1,27 @@ -import { sdk } from '@tenx-ui/bff-client'; +// import { sdk } from '@tenx-ui/bff-client'; import type { Metadata } from 'next'; import React from 'react'; -import SettingClient from './SettingClient/Index'; +import SettingClient from './SettingClient'; export const metadata: Metadata = { title: '个人设置', }; -export default async function DesktopPage() { +export default async function SettingPage() { // swr SSR example, will be removed in the future // see https://github.com/vercel/swr/blob/main/examples/server-render/pages/index.js - const userData = await sdk - .getCurrentUser(undefined, { - Authorization: 'bearer ', - }) - .catch(error => { - console.warn('getCurrentUser failed', error); - }); + // const userData = await sdk + // .getCurrentUser(undefined, { + // Authorization: 'bearer ', + // }) + // .catch(error => { + // console.warn('getCurrentUser failed', error); + // }); return ( <> - + ); } diff --git a/src/app/setting/user-info/page.tsx b/src/app/setting/user-info/page.tsx index fac6cf0..e957acf 100644 --- a/src/app/setting/user-info/page.tsx +++ b/src/app/setting/user-info/page.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { getUserData } from '../../actions/user'; import UserInfoClient from './UserInfoClient'; -export default async function DesktopPage() { +export default async function UserinfoPage() { const user = await getUserData(); const props = { user, diff --git a/src/layout/AppLayout/SideBar/Chats/styles.ts b/src/layout/AppLayout/SideBar/Chats/styles.ts index e10c17a..682de8a 100644 --- a/src/layout/AppLayout/SideBar/Chats/styles.ts +++ b/src/layout/AppLayout/SideBar/Chats/styles.ts @@ -3,7 +3,6 @@ import { createStyles } from 'antd-style'; export const useStyles = createStyles(() => ({ chats: { position: 'relative', - overflowY: 'auto', flex: '1 1 0%', }, content: { diff --git a/src/layout/AppLayout/SideBar/index.tsx b/src/layout/AppLayout/SideBar/index.tsx index f9dd98a..ee146d4 100644 --- a/src/layout/AppLayout/SideBar/index.tsx +++ b/src/layout/AppLayout/SideBar/index.tsx @@ -10,8 +10,11 @@ import UserInfoBottom from './UserInfoBottom'; import { useStyles } from './styles'; export default function SideBar() { - const { styles } = useStyles(); const pathname: any = usePathname(); + const { styles } = useStyles(); + const is_no_sidebar_route = + pathname.startsWith('/oidc/') || ['/oidc', '/logout'].includes(pathname); + if (is_no_sidebar_route) return <>; const showSidebar = ['/chat'].includes(pathname); return (
diff --git a/src/layout/AppLayout/SideBar/styles.ts b/src/layout/AppLayout/SideBar/styles.ts index 3a99004..5b4e30c 100644 --- a/src/layout/AppLayout/SideBar/styles.ts +++ b/src/layout/AppLayout/SideBar/styles.ts @@ -32,11 +32,13 @@ export const useStyles = createStyles(({ token }) => ({ '[dir="ltr"] &': { left: 0, borderRight: '1px solid', + zIndex: 9, }, '[dir="rtl"] &': { right: 0, borderLeft: '1px solid', + zIndex: 9, }, '&': { diff --git a/src/styles/not-found-styles.ts b/src/styles/not-found-styles.ts new file mode 100644 index 0000000..26d2fa2 --- /dev/null +++ b/src/styles/not-found-styles.ts @@ -0,0 +1,42 @@ +import { createStyles } from 'antd-style'; + +export const useStyles = createStyles(() => { + return { + wrapper404: { + height: '100vh', + width: '100vw', + position: 'relative', + }, + + content: { + position: 'absolute', + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + textAlign: 'center', + }, + + imgBg: { + backgroundImage: 'url(/404/404.png)', + height: '420px', + width: '500px', + maxWidth: '100vw', + backgroundRepeat: 'no-repeat', + backgroundPosition: 'center', + marginBottom: '24px', + }, + + text: { + fontSize: '24px', + marginBottom: '24px', + }, + btn: { + '.ant-btn': { + paddingLeft: '30px', + paddingRight: '30px', + fontSize: '16px', + height: 'auto', + }, + }, + }; +});