diff --git a/src/links.tsx b/src/links.tsx
new file mode 100644
index 00000000..45e83715
--- /dev/null
+++ b/src/links.tsx
@@ -0,0 +1,70 @@
+import { Icon as BlueprintIcon, IconName } from '@blueprintjs/core'
+import simpleIconsGitHub from '@iconify/icons-simple-icons/github'
+import simpleIconsQQ from '@iconify/icons-simple-icons/tencentqq'
+import { Icon as IconifyIcon } from '@iconify/react'
+
+export const NAV_LINKS: {
+ to: string
+ label: string
+ icon: IconName
+}[] = [
+ {
+ to: '/',
+ label: '首页',
+ icon: 'home',
+ },
+ {
+ to: '/create',
+ label: '创建作业',
+ icon: 'add',
+ },
+ {
+ to: '/about',
+ label: '关于',
+ icon: 'info-sign',
+ },
+]
+
+export const SOCIAL_LINKS = [
+ {
+ icon:
,
+ href: 'https://maa.plus',
+ label: 'MAA 官网',
+ },
+ {
+ icon:
,
+ href: 'https://github.com/MaaAssistantArknights/maa-copilot-frontend/issues/new/choose',
+ label: '意见与反馈',
+ },
+ {
+ icon: (
+
+ ),
+ href: 'https://github.com/MaaAssistantArknights/MaaAssistantArknights',
+ label: 'MAA GitHub Repo',
+ },
+ {
+ icon: (
+
+ ),
+ href: 'https://github.com/MaaAssistantArknights/maa-copilot-frontend',
+ label: '前端 GitHub Repo',
+ },
+ {
+ icon: (
+
+ ),
+ href: 'https://github.com/MaaAssistantArknights/MaaBackendCenter',
+ label: '后端 GitHub Repo',
+ },
+ {
+ icon:
,
+ href: 'https://jq.qq.com/?_wv=1027&k=ElimpMzQ',
+ label: '作业制作者交流群:1169188429',
+ },
+ {
+ icon:
,
+ href: 'https://ota.maa.plus/MaaAssistantArknights/api/qqgroup/index.html',
+ label: '作业分享群',
+ },
+]
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index dd4d3998..c96e8723 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -1,8 +1,6 @@
-import { Icon as BlueprintIcon, Card } from '@blueprintjs/core'
-import simpleIconsGitHub from '@iconify/icons-simple-icons/github'
-import simpleIconsQQ from '@iconify/icons-simple-icons/tencentqq'
-import { Icon as IconifyIcon } from '@iconify/react'
+import { Card } from '@blueprintjs/core'
+import dayjs from 'dayjs'
import { ComponentType } from 'react'
import { CardTitle } from 'components/CardTitle'
@@ -14,94 +12,76 @@ import { OperationSetEditorLauncher } from 'components/operation-set/OperationSe
import { OperationUploaderLauncher } from 'components/uploader/OperationUploaderLauncher'
import { AnnPanel } from '../components/announcement/AnnPanel'
-
-const SOCIAL_LINKS = [
- {
- icon:
,
- href: 'https://maa.plus',
- label: 'MAA 官网',
- },
- {
- icon:
,
- href: 'https://github.com/MaaAssistantArknights/maa-copilot-frontend/issues/new/choose',
- label: '意见与反馈',
- },
- {
- icon: (
-
- ),
- href: 'https://github.com/MaaAssistantArknights/MaaAssistantArknights',
- label: 'MAA GitHub Repo',
- },
- {
- icon: (
-
- ),
- href: 'https://github.com/MaaAssistantArknights/maa-copilot-frontend',
- label: '前端 GitHub Repo',
- },
- {
- icon: (
-
- ),
- href: 'https://github.com/MaaAssistantArknights/MaaBackendCenter',
- label: '后端 GitHub Repo',
- },
- {
- icon:
,
- href: 'https://jq.qq.com/?_wv=1027&k=ElimpMzQ',
- label: '作业制作者交流群:1169188429',
- },
- {
- icon:
,
- href: 'https://ota.maa.plus/MaaAssistantArknights/api/qqgroup/index.html',
- label: '作业分享群',
- },
-]
+import { SOCIAL_LINKS } from '../links'
+import { useCurrentSize } from '../utils/useCurrenSize'
export const IndexPage: ComponentType = withGlobalErrorBoundary(() => {
+ const { isMD } = useCurrentSize()
return (
-
-
+
+ {isMD &&
}
+
-
-
-
-
- 创建新作业
-
+ {!isMD && (
+
+
+
+
+ 创建新作业
+
+
+
+
+
+
-
-
-
-
+
-
+
-
-
+ )}
)
})
+
+const Ads =
+ dayjs().isAfter('2025-03-02 00:00:00+8') &&
+ dayjs().isBefore('2025-04-02 00:00:00+8')
+ ? () => (
+ // eslint-disable-next-line react/jsx-no-target-blank
+
+
+
+ 广告
+
+
+ )
+ : () => null
diff --git a/src/store/nav.ts b/src/store/nav.ts
index 6d0b2625..3e7ecd37 100644
--- a/src/store/nav.ts
+++ b/src/store/nav.ts
@@ -8,7 +8,7 @@ export const navAtom = atom
({
expanded: false,
})
-export const toggleExpandNavAtom = atom(null, (get, set, value) => {
+export const toggleExpandNavAtom = atom(null, (get, set, value: void) => {
set(navAtom, {
...get(navAtom),
expanded: !get(navAtom).expanded,
diff --git a/src/utils/useCurrenSize.ts b/src/utils/useCurrenSize.ts
index a0ac2d66..32116119 100644
--- a/src/utils/useCurrenSize.ts
+++ b/src/utils/useCurrenSize.ts
@@ -5,11 +5,14 @@ import { useWindowSize } from 'react-use'
export const useCurrentSize = () => {
const { width } = useWindowSize()
- const isSM = useMemo(() => width < 640, [width])
- const isMD = useMemo(() => width >= 640 && width < 768, [width])
- const isLG = useMemo(() => width >= 768 && width < 1024, [width])
- const isXL = useMemo(() => width >= 1024 && width < 1280, [width])
- const is2XL = useMemo(() => width >= 1280 && width < 1536, [width])
-
- return { isSM, isMD, isLG, isXL, is2XL }
+ return useMemo(
+ () => ({
+ isSM: width < 640,
+ isMD: width < 768,
+ isLG: width < 1024,
+ isXL: width < 1280,
+ is2XL: width < 1536,
+ }),
+ [width],
+ )
}