Skip to content

Commit 9d78d64

Browse files
committed
update log window,astro update,few things
1 parent a056b33 commit 9d78d64

15 files changed

Lines changed: 579 additions & 942 deletions

File tree

astro.config.mjs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import vercel from '@astrojs/vercel';
1111

1212
// https://astro.build/config
1313
export default defineConfig({
14-
site: 'https://maindraster.netlify.app',
14+
site: 'https://www.indratang.top',
1515
base: "/",
1616

1717
image: {
@@ -58,10 +58,11 @@ export default defineConfig({
5858
'./src/styles/picsize.css',
5959
'./src/styles/product.css'
6060
],
61-
social: {
62-
github: 'https://github.com/maindraster/maindraster.github.io',
63-
youtube: 'https://space.bilibili.com/3546706348084176'
64-
},
61+
social: [
62+
{ label: 'GitHub', icon: 'github', href: 'https://github.com/maindraster/maindraster.github.io' },
63+
{ label: 'BiliBili', icon: 'youtube', href: 'https://space.bilibili.com/3546706348084176' },
64+
// 其他社交链接...
65+
],
6566
components: {
6667
Header: "./src/components/Myheader.astro",
6768
MarkdownContent: "./src/components/MarkdownContent.astro",

package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "chasezhj",
33
"type": "module",
4-
"version": "0.0.1",
4+
"version": "0.1.0",
55
"scripts": {
66
"dev": "astro dev",
77
"start": "astro dev",
@@ -12,14 +12,14 @@
1212
},
1313
"dependencies": {
1414
"@astrojs/check": "^0.9.4",
15-
"@astrojs/markdown-remark": "^6.2.0",
15+
"@astrojs/markdown-remark": "^6.3.1",
1616
"@astrojs/rss": "^4.0.11",
17-
"@astrojs/starlight": "^0.32.2",
18-
"@astrojs/starlight-tailwind": "^3.0.0",
19-
"@astrojs/tailwind": "^6.0.0",
20-
"@astrojs/vercel": "^8.1.1",
17+
"@astrojs/starlight": "^0.33.1",
18+
"@astrojs/starlight-tailwind": "^3.0.1",
19+
"@astrojs/tailwind": "^6.0.2",
20+
"@astrojs/vercel": "^8.1.3",
2121
"@tsparticles/engine": "^3.8.1",
22-
"astro": "^5.4.2",
22+
"astro": "^5.6.1",
2323
"gsap": "^3.12.7",
2424
"hastscript": "^9.0.1",
2525
"micromark-util-symbol": "^2.0.1",
@@ -31,11 +31,10 @@
3131
"remark-embed-images": "^4.0.0",
3232
"remark-math": "^6.0.0",
3333
"sharp": "^0.33.5",
34-
"starlight-blog": "^0.17.3",
34+
"starlight-blog": "^0.20.0",
3535
"starlight-giscus": "^0.5.1",
3636
"starlight-image-zoom": "^0.8.0",
3737
"starlight-showcases": "^0.2.0",
38-
"starlight-site-graph": "^0.2.2",
3938
"tailwindcss": "^3.4.17",
4039
"typescript": "^5.8.2",
4140
"unist-util-visit": "^5.0.0"

pnpm-lock.yaml

Lines changed: 242 additions & 911 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/UpdateModal.astro

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
---
2+
interface Update {
3+
version: string;
4+
date: string;
5+
title: string;
6+
buttonText: string;
7+
buttonUrl: string;
8+
updates: string[];
9+
}
10+
11+
interface Props {
12+
updates: Update[];
13+
}
14+
15+
const { updates } = Astro.props;
16+
17+
// 定义不同类型的badge样式
18+
const badgeStyles = {
19+
'新增': 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300',
20+
'升级': 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300',
21+
'修复': 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300',
22+
'优化': 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300',
23+
'预告': 'bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-300',
24+
'删除': 'bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-300',
25+
};
26+
27+
// 修改 parseUpdate 函数以确保正确匹配
28+
function parseUpdate(update: string) {
29+
const match = update.match(/【(.*?)】(.*)/);
30+
if (match) {
31+
return {
32+
type: match[1],
33+
content: match[2].trim()
34+
};
35+
}
36+
return {
37+
type: '',
38+
content: update
39+
};
40+
}
41+
---
42+
43+
<div id="updateModal" class="fixed inset-0 z-50">
44+
<!-- 背景遮罩 -->
45+
<div class="absolute inset-0 bg-black bg-opacity-50"></div>
46+
47+
<!-- 弹窗内容 -->
48+
<div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[90%] max-w-md bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6">
49+
<!-- 弹窗头部 -->
50+
<div class="flex justify-between items-center mb-4">
51+
<div class="flex items-center gap-4">
52+
<h3 class="text-xl font-bold text-gray-900 dark:text-white">
53+
更新历史
54+
</h3>
55+
<a
56+
href="./zero2hero"
57+
rel="noopener noreferrer"
58+
class="px-3 py-1 text-sm bg-rose-500 text-white rounded hover:bg-rose-600 transition-colors"
59+
>
60+
➡ 文档/教程
61+
</a>
62+
</div>
63+
<button id="closeModal" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300">
64+
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
65+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
66+
</svg>
67+
</button>
68+
</div>
69+
70+
<!-- 修改可滚动的内容区域 -->
71+
<div class="max-h-[400px] overflow-y-auto pr-2">
72+
{updates.map((update) => (
73+
<div class="mb-6 last:mb-0">
74+
<div class="flex justify-between items-center mb-2">
75+
<div class="flex items-center gap-4">
76+
<h4 class="text-lg font-semibold text-gray-900 dark:text-white">
77+
{update.version} {update.title}
78+
</h4>
79+
<p class="text-sm text-gray-500 dark:text-gray-400">{update.date}</p>
80+
</div>
81+
</div>
82+
83+
<div class="space-y-2">
84+
<ul class="space-y-2">
85+
{update.updates.map(item => {
86+
const { type, content } = parseUpdate(item);
87+
return (
88+
<li class="flex items-start gap-2">
89+
{type && (
90+
<span class={`inline-flex items-center px-2 py-0.5 text-xs font-medium rounded ${badgeStyles[type] || 'bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-300'}`}>
91+
{type}
92+
</span>
93+
)}
94+
<span class="flex-1 text-gray-600 dark:text-gray-300">{content}</span>
95+
</li>
96+
);
97+
})}
98+
</ul>
99+
</div>
100+
</div>
101+
))}
102+
</div>
103+
</div>
104+
</div>
105+
106+
<script>
107+
const modal = document.getElementById('updateModal');
108+
const closeBtn = document.getElementById('closeModal');
109+
110+
// 关闭弹窗
111+
function closeModal() {
112+
if (modal) {
113+
modal.style.display = 'none';
114+
}
115+
}
116+
117+
// 点击背景关闭弹窗
118+
function handleClickOutside(event: MouseEvent) {
119+
const target = event.target as HTMLElement;
120+
if (target === modal) {
121+
closeModal();
122+
}
123+
}
124+
125+
// 添加事件监听
126+
closeBtn?.addEventListener('click', closeModal);
127+
modal?.addEventListener('click', handleClickOutside);
128+
129+
// 添加键盘事件监听(ESC键关闭弹窗)
130+
document.addEventListener('keydown', (event) => {
131+
if (event.key === 'Escape') {
132+
closeModal();
133+
}
134+
});
135+
</script>
136+
137+
<style>
138+
#updateModal {
139+
animation: fadeIn 0.3s ease-in-out;
140+
}
141+
142+
@keyframes fadeIn {
143+
from {
144+
opacity: 0;
145+
}
146+
to {
147+
opacity: 1;
148+
}
149+
}
150+
151+
/* 自定义滚动条样式 */
152+
.overflow-y-auto {
153+
scrollbar-width: thin;
154+
scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
155+
}
156+
157+
.overflow-y-auto::-webkit-scrollbar {
158+
width: 6px;
159+
}
160+
161+
.overflow-y-auto::-webkit-scrollbar-track {
162+
background: transparent;
163+
}
164+
165+
.overflow-y-auto::-webkit-scrollbar-thumb {
166+
background-color: rgba(156, 163, 175, 0.5);
167+
border-radius: 3px;
168+
}
169+
</style>

src/content/combine.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AstroError } from 'astro/errors'
1+
//import { AstroError } from 'astro/errors'
22
import { z, type ZodLiteral, type ZodNumber, type ZodObject, type ZodString, type ZodUnion } from 'astro/zod'
33

44
// 定义博客作者 schema
@@ -104,14 +104,14 @@ export const blogEntrySchema = ({ image }: SchemaContext) =>
104104
export function combinedSchema(context: SchemaContext) {
105105
// 检查上下文以提供更好的迁移错误消息
106106
if (!context) {
107-
throw new AstroError(
108-
'Missing schema validation context.',
109-
`You may need to update your content collections configuration in the \`src/content.config.ts\` file and pass the context to the schema function:
107+
// throw new AstroError(
108+
// 'Missing schema validation context.',
109+
// `You may need to update your content collections configuration in the \`src/content.config.ts\` file and pass the context to the schema function:
110110

111-
\`docs: defineCollection({ loader: docsLoader(), schema: docsSchema({ extend: (context) => combinedSchema(context) }) })\`
111+
// \`docs: defineCollection({ loader: docsLoader(), schema: docsSchema({ extend: (context) => combinedSchema(context) }) })\`
112112

113-
If you believe this is a bug, please file an issue at https://github.com/HiDeoo/starlight-blog/issues/new/choose`,
114-
)
113+
// If you believe this is a bug, please file an issue at https://github.com/HiDeoo/starlight-blog/issues/new/choose`,
114+
// )
115115
}
116116

117117
// 返回合并了 blog 和 topic 属性的 schema

src/content/docs/blog/blog10.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: 🛰️天下学科
3+
date: 2025-04-14
4+
tags: [目录页]
5+
featured: true
6+
---
7+
8+
import { ShowcaseText } from 'starlight-showcases'
9+
import { ShowcaseImage } from 'starlight-showcases'
10+
11+
## 人文社科
12+
13+
### 心理学
14+
15+
<ShowcaseText
16+
entries={[
17+
{
18+
href: '../../subjects/compsy',
19+
title: '传播心理学',
20+
description: '传播学 + 心理学',
21+
},
22+
]}
23+
/>
24+
25+
### 法学
26+
27+

src/content/docs/blog/blog2.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ date: 2024-11-04
44
excerpt: 本篇分享了信息搜集、筛选与整理的全过程。信息搜集介绍了信息源初筛、信息初筛的过程,并给出了一个例子。
55
tags:
66
- 个人成长
7-
featured: true
87
---
98

109
原本我打算做一期单纯的信息分享,但授人以鱼不如授人以渔,我会带大家走一遍从信息搜集、筛选再到整理的全过程,让你们充分了解如何在当今纷杂的世界享用纯净有价值的信息。最后还有一招压箱底的秘法来屏蔽垃圾信息。

src/content/docs/blog/blog7.mdx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
title: 阅读笔记
3-
date: 2025-03-31
4-
tags: [起始页]
2+
title: 📕图书馆
3+
date: 2025-04-14
4+
tags: [目录页]
5+
featured: true
56
---
67

78
import { ShowcaseText } from 'starlight-showcases'
@@ -14,19 +15,24 @@ import { ShowcaseImage } from 'starlight-showcases'
1415
<ShowcaseText
1516
entries={[
1617
{
17-
href: '../books/book1',
18+
href: '../../books/book1',
1819
title: '穷查理宝典',
1920
description: '知行查理芒格的智慧',
2021
},
2122
{
22-
href: '../books/book2',
23+
href: '../../books/book2',
2324
title: '微信背后的产品观',
2425
description: '张小龙的思维模型',
2526
},
2627
{
27-
href: '../books/book3',
28+
href: '../../books/book3',
2829
title: '韧性时代',
2930
description: '韧性、共情与效率、熵的决战',
3031
},
32+
{
33+
href: '../../books/book4',
34+
title: '五千天后的世界',
35+
description: '缺乏根据和逻辑的未来遐想',
36+
},
3137
]}
3238
/>

src/content/docs/blog/blog9.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
2-
title: 100个思维认知模型
2+
title: 💡思维认知模型
33
date: 2025-03-31
44
tags:
55
- 个人成长
66
featured: true
77
---
88

99
1. [伟大的棒球手要么不做要么最好](../books/book1)
10-
2. [复杂自适应系统研究方法](../books/book3#我们如何到达这里重新思考地球上的进化)
10+
2. [复杂自适应系统研究方法](../books/book3#我们如何到达这里重新思考地球上的进化)
11+
3.

src/content/docs/books/book4.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: 5000天后的世界
3+
lastupdate: 2025-04-01
4+
---
5+
6+
:::danger[主观评价]
7+
评分:★★☆☆☆ 4.0/10.0
8+
9+
点评:凭空想象,缺乏根据
10+
:::
11+
12+
凯文凯利以前的书确实不错,互联网时代他抓住了,《必然》的推断很有想象力和洞见。但是这一次,这本书明显反映了他思维的迟钝,对于AI和机器人的内容甚少,而且明显缺乏根据和逻辑。
13+

0 commit comments

Comments
 (0)