From 8a393e2934247f6302f3b0052f43e6d47fedc07c Mon Sep 17 00:00:00 2001 From: York Date: Fri, 21 Feb 2025 20:51:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=85=AC=E5=91=8A=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 45 +++++++++- src/components/RecordForm.tsx | 2 +- src/components/StatsChart.tsx | 47 ++-------- src/components/UpdateDialog.tsx | 155 ++++++++++++++++++++++++++++++++ 4 files changed, 205 insertions(+), 44 deletions(-) create mode 100644 src/components/UpdateDialog.tsx diff --git a/src/App.tsx b/src/App.tsx index 166d575..ca1e8f7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,9 +1,11 @@ import { useState } from 'react'; import './App.css'; -import { Container, CssBaseline, ThemeProvider, createTheme, Box, Tabs, Tab, Paper } from '@mui/material'; +import { Container, CssBaseline, ThemeProvider, createTheme, Box, Tabs, Tab, Paper, Button, Typography } from '@mui/material'; +import GitHubIcon from '@mui/icons-material/GitHub'; import { RecordForm } from './components/RecordForm'; import { StatsChart } from './components/StatsChart'; import { HistoryList } from './components/HistoryList'; +import { UpdateDialog } from './components/UpdateDialog'; interface TabPanelProps { children?: React.ReactNode; @@ -89,6 +91,7 @@ function App() { + @@ -99,6 +102,46 @@ function App() { + {/* 添加 GitHub Star 按钮 */} + + + 祝愿所有给本项目Star的小伙伴牛子长度翻倍! + + + + diff --git a/src/components/RecordForm.tsx b/src/components/RecordForm.tsx index 824521f..19f1330 100644 --- a/src/components/RecordForm.tsx +++ b/src/components/RecordForm.tsx @@ -186,7 +186,7 @@ export const RecordForm = () => { WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}> - 记录新的自慰 + 记录新的手艺活 { 统计数据 - - - 求求你给个Star! - - - + {/* 删除整个 GitHub Star 按钮的 Box 组件 */} @@ -371,7 +334,7 @@ export const StatsChart = () => { color: 'text.primary' }} > - 自慰日历 + 发射日历 { + const [open, setOpen] = useState(false); + + useEffect(() => { + const nextNoticeDate = localStorage.getItem(LOCAL_STORAGE_KEY); + const now = new Date(); + + if (!nextNoticeDate || new Date(nextNoticeDate) <= now) { + setOpen(true); + } + }, []); + + const handleClose = (dontShowFor3Days: boolean = false) => { + setOpen(false); + // 只有当用户选择"3天内不再提示 + if (dontShowFor3Days) { + const nextDate = new Date(); + nextDate.setDate(nextDate.getDate() + 3); + localStorage.setItem(LOCAL_STORAGE_KEY, nextDate.toISOString()); + } + }; + + return ( + + + 更新公告 + + + {VERSION_HISTORY.map((version, versionIndex) => ( + + + {version.version} + {versionIndex === 0 && ( + + 最新 + + )} + + + 发布日期:{version.date} + + + 更新内容: + + + {version.changes.map((change, index) => ( + + {change} + + ))} + + + ))} + + + + + + + ); +}; \ No newline at end of file