Skip to content

Commit a3fc056

Browse files
committed
docs: 优化鸣谢页面
1 parent 0cc8eb0 commit a3fc056

File tree

3 files changed

+56
-33
lines changed

3 files changed

+56
-33
lines changed

app/src/core/service/GlobalMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313

1414
import { loadAllServicesAfterInit, loadAllServicesBeforeInit } from "@/core/loadAllServices";
1515
import { Project } from "@/core/Project";
16-
import { activeProjectAtom, isClassroomModeAtom, projectsAtom, store } from "@/state";
16+
import { activeProjectAtom, isClassroomModeAtom, isDevAtom, projectsAtom, store } from "@/state";
1717
import AIWindow from "@/sub/AIWindow";
1818
import AttachmentsWindow from "@/sub/AttachmentsWindow";
1919
import LogicNodePanel from "@/sub/AutoComputeWindow";
@@ -147,7 +147,7 @@ export function GlobalMenu() {
147147
const [recentFiles, setRecentFiles] = useState<RecentFileManager.RecentFile[]>([]);
148148
const [version, setVersion] = useState<string>("");
149149
const [isUnstableVersion, setIsUnstableVersion] = useState(false);
150-
const [isDev, setIsDev] = useState(false);
150+
const [isDev, setIsDev] = useAtom(isDevAtom);
151151
const { t } = useTranslation("globalMenu");
152152

153153
useEffect(() => {

app/src/state.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ export const isWindowAlwaysOnTopAtom = atom<boolean>(false);
1717
export const isWindowMaxsizedAtom = atom<boolean>(false);
1818
// 窗口穿透点击相关
1919
export const isClickThroughEnabledAtom = atom<boolean>(false);
20+
21+
export const isDevAtom = atom<boolean>(false);

app/src/sub/SettingsWindow/credits.tsx

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { cn } from "@/utils/cn";
33
import { open } from "@tauri-apps/plugin-shell";
44
import { Calendar, ExternalLink, Heart, Server, User } from "lucide-react";
55
import "./assets/font.css";
6+
import { isDevAtom } from "@/state";
7+
import { useAtom } from "jotai";
68

79
interface DonationData {
810
user: string;
@@ -180,8 +182,9 @@ const donations: DonationData[] = [
180182
*/
181183
export default function CreditsTab() {
182184
const totalAmount = donations.reduce((sum, donation) => sum + donation.amount, 0);
185+
const [isDev] = useAtom(isDevAtom);
183186

184-
// 计算从2024年9月1日到现在的月数
187+
// 计算从2024年9月1日到现在的天数
185188
const startDate = new Date(2024, 8, 1);
186189
const currentDate = new Date();
187190
const monthsDiff =
@@ -190,40 +193,58 @@ export default function CreditsTab() {
190193
(currentDate.getDate() >= startDate.getDate() ? 0 : -1);
191194
const actualMonths = Math.max(monthsDiff + 1, 1); // 至少为1个月
192195
const averageMonthlyAmount = totalAmount / actualMonths;
196+
const diffTime = currentDate.getTime() - startDate.getTime();
197+
const daysDiff = Math.floor(diffTime / (1000 * 60 * 60 * 24));
198+
const actualDays = Math.max(daysDiff + 1, 1); // 至少为1天
193199

194200
return (
195201
<div className="mx-auto flex w-2/3 flex-col overflow-auto py-4">
196202
<div className="mb-4 flex gap-4">
197-
<div className="bg-muted/50 flex flex-1 flex-col gap-2 rounded-lg border p-4">
198-
<div className="flex items-center justify-center gap-2">
199-
<Heart className="h-5 w-5" />
200-
<span className="text-lg">合计</span>
201-
</div>
202-
<div
203-
className={cn(
204-
"flex items-end justify-center gap-2 text-center *:font-[DINPro]",
205-
totalAmount < 0 ? "text-red-500" : "text-green-500",
206-
)}
207-
>
208-
<span className="text-3xl">{totalAmount.toFixed(2)}</span>
209-
<span className="text-xl">CNY</span>
210-
</div>
211-
</div>
212-
<div className="bg-muted/50 flex flex-1 flex-col gap-2 rounded-lg border p-4">
213-
<div className="flex items-center justify-center gap-2">
214-
<Calendar className="h-5 w-5" />
215-
<span className="text-lg">平均每月</span>
216-
</div>
217-
<div
218-
className={cn(
219-
"flex items-end justify-center gap-2 text-center *:font-[DINPro]",
220-
averageMonthlyAmount < 0 ? "text-red-500" : "text-green-500",
221-
)}
222-
>
223-
<span className="text-3xl">{averageMonthlyAmount.toFixed(2)}</span>
224-
<span className="text-xl">CNY</span>
225-
</div>
226-
</div>
203+
{!isDev ? (
204+
<>
205+
<div className="bg-muted/50 flex flex-1 flex-col gap-2 rounded-lg border p-4">
206+
<div className="flex items-center justify-center gap-2">
207+
<Heart className="h-5 w-5" />
208+
<span className="text-lg">合计</span>
209+
</div>
210+
<div
211+
className={cn(
212+
"flex items-end justify-center gap-2 text-center *:font-[DINPro]",
213+
totalAmount < 0 ? "text-red-500" : "text-green-500",
214+
)}
215+
>
216+
<span className="text-3xl">{totalAmount.toFixed(2)}</span>
217+
<span className="text-xl">CNY</span>
218+
</div>
219+
</div>
220+
<div className="bg-muted/50 flex flex-1 flex-col gap-2 rounded-lg border p-4">
221+
<div className="flex items-center justify-center gap-2">
222+
<Calendar className="h-5 w-5" />
223+
<span className="text-lg">平均每月</span>
224+
</div>
225+
<div
226+
className={cn(
227+
"flex items-end justify-center gap-2 text-center *:font-[DINPro]",
228+
averageMonthlyAmount < 0 ? "text-red-500" : "text-green-500",
229+
)}
230+
>
231+
<span className="text-3xl">{averageMonthlyAmount.toFixed(2)}</span>
232+
<span className="text-xl">CNY</span>
233+
</div>
234+
</div>
235+
</>
236+
) : (
237+
<>
238+
<div className="bg-muted/50 flex flex-1 flex-col items-center gap-2 rounded-lg border p-4 text-sm">
239+
<p className="text-center">在过去的{actualDays}个日夜中,是屏幕前您的认可与支持,给了我们最温暖的鼓励</p>
240+
<div className="flex flex-nowrap items-center justify-center gap-1">
241+
<Heart className="size-4" />
242+
<span className="text-sm">谨以此墙,致敬所有同行者</span>
243+
</div>
244+
</div>
245+
</>
246+
)}
247+
227248
<Popover.Confirm
228249
title="提示"
229250
description="此列表并不是实时更新的,开发者将在您捐赠后的下一个版本中手动更新此列表,当您选择要捐赠时,请在开头添加备注“pg”,以便开发者能区分您的捐赠的项目是project-graph。"

0 commit comments

Comments
 (0)