diff --git a/GZCTF/ClientApp/src/components/WithGameTab.tsx b/GZCTF/ClientApp/src/components/WithGameTab.tsx index 55d670b5f..deb3b9555 100644 --- a/GZCTF/ClientApp/src/components/WithGameTab.tsx +++ b/GZCTF/ClientApp/src/components/WithGameTab.tsx @@ -141,27 +141,28 @@ const WithGameTab: FC = ({ game, isLoading, status, children } }, [game]) return ( - - - - {game?.title} - - - ) - } - /> - {children} - + + + + + {game?.title} + + + ) + } + /> + {children} + ) } diff --git a/GZCTF/ClientApp/src/components/WithNavbar.tsx b/GZCTF/ClientApp/src/components/WithNavbar.tsx index d7b67543e..004dd4a63 100644 --- a/GZCTF/ClientApp/src/components/WithNavbar.tsx +++ b/GZCTF/ClientApp/src/components/WithNavbar.tsx @@ -9,27 +9,33 @@ import { } from '@mantine/core' import AppHeader from './AppHeader' import AppNavbar from './AppNavbar' +import WithWiderScreen from './WithWiderScreen' interface WithNavBarProps extends React.PropsWithChildren { width?: string + minWidth?: number padding?: MantineNumberSize isLoading?: boolean } -const WithNavBar: FC = ({ children, width, padding, isLoading }) => { +const WithNavBar: FC = ({ children, width, padding, isLoading, minWidth }) => { const theme = useMantineTheme() return ( - } header={}> -
- - {children} -
-
+ + } header={}> +
+ + {children} +
+
+
) } diff --git a/GZCTF/ClientApp/src/components/WithWiderScreen.tsx b/GZCTF/ClientApp/src/components/WithWiderScreen.tsx new file mode 100644 index 000000000..6aef7725d --- /dev/null +++ b/GZCTF/ClientApp/src/components/WithWiderScreen.tsx @@ -0,0 +1,28 @@ +import { FC } from 'react' +import { Stack, Title, Text } from '@mantine/core' +import { useViewportSize } from '@mantine/hooks' +import IconWiderScreenRequired from './icon/WiderScreenRequiredIcon' + +interface WithWiderScreenProps extends React.PropsWithChildren { + minWidth?: number +} + +const WithWiderScreen: FC = ({ children, minWidth = 1080 }) => { + const view = useViewportSize() + + const tooSmall = minWidth > 0 && view.width < minWidth + + return tooSmall ? ( + + + + 页面宽度不足 + + 请使用更宽的设备浏览本页面 + + ) : ( + <>{children} + ) +} + +export default WithWiderScreen diff --git a/GZCTF/ClientApp/src/components/admin/AdminPage.tsx b/GZCTF/ClientApp/src/components/admin/AdminPage.tsx index 618295a50..aacf14d99 100644 --- a/GZCTF/ClientApp/src/components/admin/AdminPage.tsx +++ b/GZCTF/ClientApp/src/components/admin/AdminPage.tsx @@ -7,7 +7,7 @@ import { AdminTabProps } from './WithAdminTab' const AdminPage: FC = (props) => { return ( - + diff --git a/GZCTF/ClientApp/src/components/icon/WarningIcon.tsx b/GZCTF/ClientApp/src/components/icon/WarningIcon.tsx new file mode 100644 index 000000000..cc7097618 --- /dev/null +++ b/GZCTF/ClientApp/src/components/icon/WarningIcon.tsx @@ -0,0 +1,48 @@ +import { FC } from 'react' +import { createStyles } from "@mantine/core" + +const useStyles = createStyles((theme) => ({ + triangle: { + fill: theme.colorScheme === 'dark' ? theme.white : theme.colors.gray[6], + }, +})) + +const IconWarning: FC = () => { + + const { classes } = useStyles() + + return ( + + + + + + + ) +} + +export default IconWarning \ No newline at end of file diff --git a/GZCTF/ClientApp/src/components/icon/WiderScreenRequiredIcon.tsx b/GZCTF/ClientApp/src/components/icon/WiderScreenRequiredIcon.tsx new file mode 100644 index 000000000..94e74230a --- /dev/null +++ b/GZCTF/ClientApp/src/components/icon/WiderScreenRequiredIcon.tsx @@ -0,0 +1,61 @@ +import { FC } from 'react' +import { createStyles } from "@mantine/core" + +const useStyles = createStyles((theme) => ({ + triangle: { + fill: theme.colorScheme === 'dark' ? theme.white : theme.colors.gray[6], + }, +})) + +const IconWiderScreenRequired: FC = () => { + const { classes } = useStyles() + + return ( + + + + + + + + + ) +} + +export default IconWiderScreenRequired diff --git a/GZCTF/ClientApp/src/pages/Index.tsx b/GZCTF/ClientApp/src/pages/Index.tsx index e0fd1a0da..5db62f566 100644 --- a/GZCTF/ClientApp/src/pages/Index.tsx +++ b/GZCTF/ClientApp/src/pages/Index.tsx @@ -95,7 +95,7 @@ const Home: FC = () => { usePageTitle() return ( - + diff --git a/GZCTF/ClientApp/src/pages/[...all].tsx b/GZCTF/ClientApp/src/pages/[...all].tsx index fda55c892..15c0e0787 100644 --- a/GZCTF/ClientApp/src/pages/[...all].tsx +++ b/GZCTF/ClientApp/src/pages/[...all].tsx @@ -18,11 +18,11 @@ const Error404: FC = () => { }, [location]) return ( - + - 这是一处荒芜的地方 - 你为何会到这里来呢 + 页面不存在 + 一处荒芜,为何于此驻足 ) diff --git a/GZCTF/ClientApp/src/pages/games/Index.tsx b/GZCTF/ClientApp/src/pages/games/Index.tsx index 9937a3c3d..842b002b6 100644 --- a/GZCTF/ClientApp/src/pages/games/Index.tsx +++ b/GZCTF/ClientApp/src/pages/games/Index.tsx @@ -24,14 +24,14 @@ const Games: FC = () => { usePageTitle('赛事') return ( - - - - {games.map((g) => ( - - ))} - - + + + + {games.map((g) => ( + + ))} + + ) } diff --git a/GZCTF/ClientApp/src/pages/posts/Index.tsx b/GZCTF/ClientApp/src/pages/posts/Index.tsx index e9443f444..358c26818 100644 --- a/GZCTF/ClientApp/src/pages/posts/Index.tsx +++ b/GZCTF/ClientApp/src/pages/posts/Index.tsx @@ -54,7 +54,7 @@ const Posts: FC = () => { } return ( - + diff --git a/GZCTF/ClientApp/src/pages/posts/[postId]/Index.tsx b/GZCTF/ClientApp/src/pages/posts/[postId]/Index.tsx index b18029812..f0be83377 100644 --- a/GZCTF/ClientApp/src/pages/posts/[postId]/Index.tsx +++ b/GZCTF/ClientApp/src/pages/posts/[postId]/Index.tsx @@ -49,7 +49,7 @@ const Post: FC = () => { usePageTitle(post?.title ?? 'Post') return ( - +
{ }, [curPost]) return ( - +