diff --git a/bun.lockb b/bun.lockb index 5541d0f..4476cd5 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 067779f..ec1cee4 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "axios-case-converter": "^1.1.1", "cookies-next": "^5.0.2", "feed": "^4.2.2", - "next": "^15.1.4", + "next": "^15.1.5", "next-nprogress-bar": "^2.4.3", "react": "^19.0.0", "react-dom": "^19.0.0", @@ -43,15 +43,16 @@ "zustand": "^5.0.3" }, "devDependencies": { - "typescript": "^5.7.3", + "@eslint/eslintrc": "^3.2.0", "@types/node": "^20.17.12", "@types/react": "^19.0.4", "@types/react-dom": "^19.0.2", - "postcss": "^8.4.49", - "tailwindcss": "^3.4.17", + "daisyui": "^4.12.23", "eslint": "^9.18.0", "eslint-config-next": "15.1.3", - "@eslint/eslintrc": "^3.2.0" + "postcss": "^8.4.49", + "tailwindcss": "^3.4.17", + "typescript": "^5.7.3" }, "trustedDependencies": [ "@vercel/speed-insights", diff --git a/src/components/events/CountdownTimer.tsx b/src/components/events/CountdownTimer.tsx new file mode 100644 index 0000000..c386943 --- /dev/null +++ b/src/components/events/CountdownTimer.tsx @@ -0,0 +1,76 @@ +import { Noto_Serif_TC } from 'next/font/google' +import { useState, useEffect } from 'react' + +export interface TimeDiff { + days: number + hours: number + minutes: number + seconds: number + isCountdown: boolean +} + +const serifFont = Noto_Serif_TC({ + weight: ['400', '500', '700'], + display: 'swap', +}) + +export function CountdownTimer({ targetDate, onUpdate }: { targetDate: Date; onUpdate: (diff: TimeDiff) => void }) { + const [timeDiff, setTimeDiff] = useState({ + days: 0, + hours: 0, + minutes: 0, + seconds: 0, + isCountdown: true, + }) + + useEffect(() => { + const updateTimeDiff = () => { + const now = new Date() + const diff = targetDate.getTime() - now.getTime() + + const absDiff = Math.abs(diff) + const isCountdown = diff > 0 + + const days = Math.floor(absDiff / (1000 * 60 * 60 * 24)) + const hours = Math.floor((absDiff / (1000 * 60 * 60)) % 24) + const minutes = Math.floor((absDiff / (1000 * 60)) % 60) + const seconds = Math.floor((absDiff / 1000) % 60) + + setTimeDiff({ days, hours, minutes, seconds, isCountdown }) + onUpdate({ days, hours, minutes, seconds, isCountdown }) + } + + const intervalId = setInterval(updateTimeDiff, 1000) + + return () => clearInterval(intervalId) + }, []) + + return ( +
+
+ + + + +
+
+ + + + 小时 +
+
+ + + + 分钟 +
+
+ + + + +
+
+ ) +} diff --git a/src/pages/events/2025-lunar-countdown.tsx b/src/pages/events/2025-lunar-countdown.tsx new file mode 100644 index 0000000..0157821 --- /dev/null +++ b/src/pages/events/2025-lunar-countdown.tsx @@ -0,0 +1,33 @@ +import { CountdownTimer } from '@/components/events/CountdownTimer' +import { Box, Container, Typography } from '@mui/material' +import { Noto_Serif_TC } from 'next/font/google' +import { useState } from 'react' + +const serifFont = Noto_Serif_TC({ + weight: ['400', '500', '700'], + display: 'swap', +}) + +export default function LunarCountdownFor2025() { + const [isCountdown, setIsCountdown] = useState(true) + + return ( + + + + 距离 + + + 二〇二五乙巳年 + + + {isCountdown ? '还有' : '已经'} + + setIsCountdown(isCountdown)} + /> + + + ) +} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 9809784..5a5f616 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,4 +1,4 @@ -import { Box, Chip, Container, Grid2 as Grid, Link, Paper, Typography } from '@mui/material' +import { Alert, AlertTitle, Box, Button, Chip, Container, Grid2 as Grid, Link, Paper, Typography } from '@mui/material' import { Roboto_Serif } from 'next/font/google' import NextLink from 'next/link' import Image from 'next/image' @@ -21,6 +21,22 @@ export default function Home() { return ( <> + 🎉} + severity="info" + action={ + + + + } + > + 预祝农历新年 + 索尔幸茨的 2025 农历新年倒计时现已开启! + + company logo diff --git a/tailwind.config.ts b/tailwind.config.ts index 4834e9c..05afa3a 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -14,5 +14,5 @@ export default { }, }, }, - plugins: [require('@tailwindcss/typography')], + plugins: [require('@tailwindcss/typography'), require('daisyui')], } satisfies Config