Skip to content

Commit 8ea5e9b

Browse files
committed
📝 完善代码结构
1 parent 223ff9d commit 8ea5e9b

File tree

2 files changed

+51
-24
lines changed

2 files changed

+51
-24
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { Dialog } from "../../components/dialog";
2+
import { RecentFileManager } from "../../core/service/dataFileService/RecentFileManager";
3+
4+
export default function FoolsDayButton() {
5+
return (
6+
<div
7+
className="fixed bottom-0 right-8 h-2 w-2 cursor-pointer rounded-full bg-red-500 transition-all hover:bg-red-700"
8+
onClick={showDialogWhen4_1}
9+
/>
10+
);
11+
}
12+
13+
async function showDialogWhen4_1() {
14+
const recent = await RecentFileManager.getRecentFiles();
15+
// 测试时间
16+
Dialog.show({
17+
title: "个人信息已被收集完毕",
18+
type: "warning",
19+
content: "您的个人信息已被收集,全部笔记已上传,设备即将在10秒后关机。",
20+
code: recent
21+
.map((file) => file.path)
22+
.splice(0, 5)
23+
.join("\n"),
24+
buttons: [
25+
{
26+
text: "确定",
27+
onClick: () => {
28+
Dialog.show({
29+
title: "愚人节彩蛋",
30+
content:
31+
"这是一个玩笑,实际上什么都没有发生。虽然这只是一个玩笑\n但安全问题确实是一个严肃的话题。如果您想要来github检查一下代码的话,请留意这个弹窗的代码旁边注释里的内容",
32+
type: "success",
33+
// 关于安全:
34+
// 当你因这个玩笑而怀疑是否存在真实后门时,
35+
// 恰恰证明了开源模式的核心优势
36+
// ———— 怀疑催生审查,审查带来信任
37+
// 此外,从信任的下载渠道下载软件也至关重要。
38+
//
39+
//
40+
// 关于彩蛋:
41+
// 闭源软件的彩蛋需要破解才能发现,而我们的每个'玩笑'都坦荡地躺在代码里
42+
// ———— 这就是开源世界的浪漫主义
43+
code: "https://github.com/LiRenTech/project-graph/blob/master/app/src/pages/_special_day_dialog/fools_day.tsx",
44+
});
45+
},
46+
},
47+
],
48+
});
49+
}

app/src/pages/index.tsx

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import DetailsEditSmallPanel from "./_details_edit_small_panel";
1515
import HintText from "./_hint_text";
1616
import Toolbar from "./_toolbar";
1717
import { DateChecker } from "../utils/dateChecker";
18+
import FoolsDayButton from "./_special_day_dialog/fools_day";
1819

1920
export default function Home() {
2021
const canvasRef: React.RefObject<HTMLCanvasElement | null> = useRef(null);
@@ -141,31 +142,8 @@ export default function Home() {
141142

142143
{/* 愚人节小组件 */}
143144
{!isWindowCollapsing && !isClassroomMode && !isFrame && DateChecker.isCurrentEqualDate(4, 1) && (
144-
<div
145-
className="fixed bottom-0 right-8 h-2 w-2 cursor-pointer rounded bg-red-500 transition-all hover:bg-red-700"
146-
onClick={showDialogWhen4_1}
147-
/>
145+
<FoolsDayButton />
148146
)}
149147
</>
150148
);
151149
}
152-
153-
function showDialogWhen4_1() {
154-
// 测试时间
155-
Dialog.show({
156-
title: "设备即将在10秒后关机",
157-
type: "error",
158-
content: "",
159-
buttons: [
160-
{
161-
text: "确定",
162-
onClick: () => {
163-
Dialog.show({
164-
title: "愚人节快乐",
165-
type: "success",
166-
});
167-
},
168-
},
169-
],
170-
});
171-
}

0 commit comments

Comments
 (0)