~repos /website
git clone https://pyrossh.dev/repos/website.git
木 Personal website of pyrossh. Built with astrojs, shiki, vite.
485d57a3
—
pyrossh 6 months ago
add basic git commits
- bun.lock +3 -0
- package.json +1 -0
- src/components/Wrapper.astro +3 -1
- src/containers/Log.astro +14 -0
- src/content.config.ts +43 -0
- src/layouts/Base.css +3 -6
- src/pages/index.astro +10 -147
- src/pages/index.module.css +134 -0
- src/pages/posts/[...slug].astro +1 -0
- src/pages/posts/index.astro +4 -5
- src/pages/repos/[...slug]/commits/index.astro +48 -0
- src/pages/repos/[...slug]/index.astro +334 -0
- src/pages/repos/[...slug]/index.module.css +152 -0
bun.lock
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"@effective/css-reset": "^3.2.0",
|
|
11
11
|
"@tailwindcss/vite": "^4.1.4",
|
|
12
12
|
"astro": "^5.7.5",
|
|
13
|
+
"date-fns": "^4.1.0",
|
|
13
14
|
"simple-git": "^3.27.0",
|
|
14
15
|
"tailwindcss": "^4.1.4",
|
|
15
16
|
},
|
|
@@ -350,6 +351,8 @@
|
|
|
350
351
|
|
|
351
352
|
"cssesc": ["cssesc@3.0.0", "", { "bin": { "cssesc": "bin/cssesc" } }, "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg=="],
|
|
352
353
|
|
|
354
|
+
"date-fns": ["date-fns@4.1.0", "", {}, "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg=="],
|
|
355
|
+
|
|
353
356
|
"debug": ["debug@4.4.0", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA=="],
|
|
354
357
|
|
|
355
358
|
"decode-named-character-reference": ["decode-named-character-reference@1.1.0", "", { "dependencies": { "character-entities": "^2.0.0" } }, "sha512-Wy+JTSbFThEOXQIR2L6mxJvEs+veIzpmqD7ynWxMXGpnk3smkHQOp6forLdHsKpAMW9iJpaBBIxz285t1n1C3w=="],
|
package.json
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"@effective/css-reset": "^3.2.0",
|
|
15
15
|
"@tailwindcss/vite": "^4.1.4",
|
|
16
16
|
"astro": "^5.7.5",
|
|
17
|
+
"date-fns": "^4.1.0",
|
|
17
18
|
"simple-git": "^3.27.0",
|
|
18
19
|
"tailwindcss": "^4.1.4"
|
|
19
20
|
},
|
src/components/Wrapper.astro
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
<style>
|
|
6
6
|
div {
|
|
7
|
+
flex: 1;
|
|
8
|
+
/* width: calc(95ex - (1em * 2)); */
|
|
7
|
-
width: calc(
|
|
9
|
+
width: calc(104ex - (1em * 2));
|
|
8
10
|
margin-right: auto;
|
|
9
11
|
margin-left: auto;
|
|
10
12
|
padding-left: 1em;
|
src/containers/Log.astro
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { simpleGit } from "simple-git";
|
|
3
|
+
const res = await simpleGit().log();
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
{
|
|
7
|
+
res.all.map((commit) => (
|
|
8
|
+
<div>
|
|
9
|
+
<h4>{commit.hash}</h4>
|
|
10
|
+
<p>{commit.message}</p>
|
|
11
|
+
<span>{commit.date}</span>
|
|
12
|
+
</div>
|
|
13
|
+
))
|
|
14
|
+
}
|
src/content.config.ts
CHANGED
|
@@ -1,7 +1,50 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import { simpleGit } from "simple-git";
|
|
1
3
|
import { glob } from 'astro/loaders';
|
|
2
4
|
import { defineCollection, z } from 'astro:content';
|
|
5
|
+
import { REPOS } from './consts';
|
|
3
6
|
|
|
4
7
|
export const collections = {
|
|
8
|
+
repos: defineCollection({
|
|
9
|
+
loader: {
|
|
10
|
+
name: "loader",
|
|
11
|
+
load: async (ctx) => {
|
|
12
|
+
for (const r of REPOS) {
|
|
13
|
+
const repoPath = process.cwd() + "/../" + r.title;
|
|
14
|
+
const readmePath = repoPath + "/README.md";
|
|
15
|
+
console.log("loading repo " + repoPath)
|
|
16
|
+
const res = await simpleGit(repoPath).log();
|
|
17
|
+
ctx.store.set({
|
|
18
|
+
id: r.title,
|
|
19
|
+
data: {
|
|
20
|
+
title: r.title,
|
|
21
|
+
description: r.description,
|
|
22
|
+
commits: res.all.map((item) => ({
|
|
23
|
+
hash: item.hash,
|
|
24
|
+
message: item.message,
|
|
25
|
+
author_name: item.author_name,
|
|
26
|
+
date: item.date,
|
|
27
|
+
})),
|
|
28
|
+
},
|
|
29
|
+
rendered: {
|
|
30
|
+
html: fs.existsSync(readmePath) ? await (await import(readmePath)).compiledContent() : "",
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
schema: z.object({
|
|
37
|
+
title: z.string(),
|
|
38
|
+
description: z.string().max(80),
|
|
39
|
+
commits: z.array(z.object({
|
|
40
|
+
hash: z.string(),
|
|
41
|
+
message: z.string(),
|
|
42
|
+
author_name: z.string(),
|
|
43
|
+
date: z.string(),
|
|
44
|
+
// diff: z.string(),
|
|
45
|
+
})),
|
|
46
|
+
}),
|
|
47
|
+
}),
|
|
5
48
|
content: defineCollection({
|
|
6
49
|
loader: glob({ base: './src/content', pattern: '**/*.{md,mdx}' }),
|
|
7
50
|
// Type-check frontmatter using a schema
|
src/layouts/Base.css
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
--color-post-link: #3395ff;
|
|
13
13
|
--color-highlight-bg: #703be1;
|
|
14
14
|
--color-code-fg: rgb(244, 176, 176);
|
|
15
|
+
--color-md-table-bg: #343a40;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
[theme='light'] {
|
|
@@ -24,10 +25,7 @@
|
|
|
24
25
|
--color-post-link: #000000;
|
|
25
26
|
--color-highlight-bg: #9befee;
|
|
26
27
|
--color-code-fg: #d14;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
html {
|
|
30
|
-
|
|
28
|
+
--color-md-table-bg: #343a40;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
body {
|
|
@@ -52,8 +50,7 @@ body {
|
|
|
52
50
|
font-kerning: normal;
|
|
53
51
|
font-size: 14pt;
|
|
54
52
|
line-height: 1.6;
|
|
55
|
-
|
|
53
|
+
min-height: 100vh;
|
|
56
|
-
/* min-width: 992px !important; */
|
|
57
54
|
/* font-family: sans-serif; */
|
|
58
55
|
/* font-size: 1rem; */
|
|
59
56
|
/* text-align: initial; */
|
src/pages/index.astro
CHANGED
|
@@ -9,6 +9,8 @@ import zellij from "@/assets/logos/zellij.png";
|
|
|
9
9
|
import inkscape from "@/assets/logos/inkscape.png";
|
|
10
10
|
import ghostty from "@/assets/logos/ghostty.png";
|
|
11
11
|
import { REPOS } from "@/consts";
|
|
12
|
+
import Log from "@/containers/Log.astro";
|
|
13
|
+
import styles from "./index.module.css";
|
|
12
14
|
---
|
|
13
15
|
|
|
14
16
|
<Layout
|
|
@@ -37,7 +39,7 @@ import { REPOS } from "@/consts";
|
|
|
37
39
|
I've created a number of projects that are widely used.
|
|
38
40
|
</p>
|
|
39
41
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-8">
|
|
40
|
-
<section class=
|
|
42
|
+
<section class={styles.interests}>
|
|
41
43
|
<h2>Interests</h2>
|
|
42
44
|
<ul>
|
|
43
45
|
<li>HTML</li>
|
|
@@ -54,7 +56,7 @@ import { REPOS } from "@/consts";
|
|
|
54
56
|
<li>Iceberg</li>
|
|
55
57
|
</ul>
|
|
56
58
|
</section>
|
|
57
|
-
<section class=
|
|
59
|
+
<section class={styles.contact}>
|
|
58
60
|
<h2>Contact</h2>
|
|
59
61
|
<ul>
|
|
60
62
|
<li>
|
|
@@ -82,7 +84,7 @@ import { REPOS } from "@/consts";
|
|
|
82
84
|
</ul>
|
|
83
85
|
</section>
|
|
84
86
|
</div>
|
|
85
|
-
<section class=
|
|
87
|
+
<section class={styles.tools}>
|
|
86
88
|
<h2>Tools</h2>
|
|
87
89
|
<ul>
|
|
88
90
|
<li>
|
|
@@ -158,19 +160,15 @@ import { REPOS } from "@/consts";
|
|
|
158
160
|
</li>
|
|
159
161
|
</ul>
|
|
160
162
|
</section>
|
|
161
|
-
<section
|
|
163
|
+
<section>
|
|
162
164
|
<h2>Repos</h2>
|
|
163
|
-
<div class=
|
|
165
|
+
<div class={styles.repos}>
|
|
164
166
|
{
|
|
165
167
|
REPOS.map((repo) => (
|
|
166
|
-
<div class=
|
|
168
|
+
<div class={styles.repo}>
|
|
167
169
|
<h4>
|
|
168
|
-
<a href={`
|
|
170
|
+
<a href={`/repos/${repo.title}`}>{repo.title}</a>
|
|
169
|
-
{" "}
|
|
170
|
-
{repo.title}{" "}
|
|
171
|
-
</a>
|
|
172
171
|
</h4>
|
|
173
|
-
|
|
174
172
|
<p>{repo.description}</p>
|
|
175
173
|
</div>
|
|
176
174
|
))
|
|
@@ -179,140 +177,5 @@ import { REPOS } from "@/consts";
|
|
|
179
177
|
</section>
|
|
180
178
|
</div>
|
|
181
179
|
</div>
|
|
180
|
+
<!-- <Log /> -->
|
|
182
181
|
</Layout>
|
|
183
|
-
|
|
184
|
-
<style>
|
|
185
|
-
h2 {
|
|
186
|
-
font-size: 1.5rem;
|
|
187
|
-
font-weight: 600;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
section {
|
|
191
|
-
display: flex;
|
|
192
|
-
flex-direction: column;
|
|
193
|
-
margin-top: 1.5rem;
|
|
194
|
-
margin-bottom: 1rem;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.rounded-md {
|
|
198
|
-
border-radius: 0.375rem;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.projects {
|
|
202
|
-
.repos {
|
|
203
|
-
display: grid;
|
|
204
|
-
grid-template-columns: auto auto;
|
|
205
|
-
gap: 1rem;
|
|
206
|
-
margin-top: 0.5rem;
|
|
207
|
-
|
|
208
|
-
@media (max-width: 720px) {
|
|
209
|
-
gap: 1rem;
|
|
210
|
-
grid-template-columns: auto;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.event {
|
|
215
|
-
text-overflow: ellipsis;
|
|
216
|
-
overflow: hidden;
|
|
217
|
-
padding: 0.5rem;
|
|
218
|
-
background: var(--color-box-bg);
|
|
219
|
-
color: var(--color-text);
|
|
220
|
-
font-size: 0.95em;
|
|
221
|
-
|
|
222
|
-
a {
|
|
223
|
-
color: var(--color-card-link);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
h4 {
|
|
227
|
-
font-size: 1.1rem;
|
|
228
|
-
font-weight: 500;
|
|
229
|
-
line-height: 1.2;
|
|
230
|
-
border-bottom: 1px solid #495057;
|
|
231
|
-
text-overflow: ellipsis;
|
|
232
|
-
white-space: nowrap;
|
|
233
|
-
overflow: hidden;
|
|
234
|
-
margin-bottom: 0;
|
|
235
|
-
padding: 0;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.interests {
|
|
241
|
-
ul {
|
|
242
|
-
display: grid;
|
|
243
|
-
gap: 0.5rem;
|
|
244
|
-
grid-template-columns: auto auto auto;
|
|
245
|
-
text-align: center;
|
|
246
|
-
margin-top: 1rem;
|
|
247
|
-
li {
|
|
248
|
-
background-color: var(--color-box-bg);
|
|
249
|
-
padding: 0.25rem;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
.contact {
|
|
255
|
-
ul {
|
|
256
|
-
display: grid;
|
|
257
|
-
gap: 0.5rem;
|
|
258
|
-
grid-template-columns: auto;
|
|
259
|
-
margin-top: 1rem;
|
|
260
|
-
|
|
261
|
-
li {
|
|
262
|
-
display: flex;
|
|
263
|
-
flex-direction: row;
|
|
264
|
-
align-items: baseline;
|
|
265
|
-
padding: 0.25rem;
|
|
266
|
-
background-color: var(--color-box-bg);
|
|
267
|
-
|
|
268
|
-
@media (max-width: 720px) {
|
|
269
|
-
flex-direction: column;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
a {
|
|
274
|
-
color: var(--color-link);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
strong {
|
|
278
|
-
font-weight: 500;
|
|
279
|
-
margin-right: 0.5rem;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.tools {
|
|
285
|
-
img {
|
|
286
|
-
width: 36px;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
ul {
|
|
290
|
-
display: grid;
|
|
291
|
-
gap: 0.5rem;
|
|
292
|
-
grid-template-columns: auto auto auto auto;
|
|
293
|
-
text-align: center;
|
|
294
|
-
margin-top: 1rem;
|
|
295
|
-
@media (max-width: 720px) {
|
|
296
|
-
grid-template-columns: auto auto auto;
|
|
297
|
-
}
|
|
298
|
-
li {
|
|
299
|
-
background-color: var(--color-box-bg);
|
|
300
|
-
padding: 0.25rem;
|
|
301
|
-
|
|
302
|
-
a {
|
|
303
|
-
display: flex;
|
|
304
|
-
flex-direction: row;
|
|
305
|
-
align-items: center;
|
|
306
|
-
text-align: left;
|
|
307
|
-
margin-left: 0.25rem;
|
|
308
|
-
margin-right: 0.25rem;
|
|
309
|
-
font-size: 0.9em;
|
|
310
|
-
|
|
311
|
-
div {
|
|
312
|
-
flex: 1;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
</style>
|
src/pages/index.module.css
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
h2 {
|
|
2
|
+
font-size: 1.5rem;
|
|
3
|
+
font-weight: 600;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
section {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
margin-top: 1.5rem;
|
|
10
|
+
margin-bottom: 1rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.rounded-md {
|
|
14
|
+
border-radius: 0.375rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.repos {
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-template-columns: auto auto;
|
|
20
|
+
gap: 1rem;
|
|
21
|
+
margin-top: 0.5rem;
|
|
22
|
+
|
|
23
|
+
@media (max-width: 720px) {
|
|
24
|
+
gap: 1rem;
|
|
25
|
+
grid-template-columns: auto;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.repo {
|
|
30
|
+
text-overflow: ellipsis;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
padding: 0.5rem;
|
|
33
|
+
background: var(--color-box-bg);
|
|
34
|
+
color: var(--color-text);
|
|
35
|
+
font-size: 0.95em;
|
|
36
|
+
|
|
37
|
+
a {
|
|
38
|
+
color: var(--color-card-link);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
h4 {
|
|
42
|
+
font-size: 1.1rem;
|
|
43
|
+
font-weight: 500;
|
|
44
|
+
line-height: 1.2;
|
|
45
|
+
border-bottom: 1px solid #495057;
|
|
46
|
+
text-overflow: ellipsis;
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
margin-bottom: 0;
|
|
50
|
+
padding: 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.interests {
|
|
55
|
+
ul {
|
|
56
|
+
display: grid;
|
|
57
|
+
gap: 0.5rem;
|
|
58
|
+
grid-template-columns: auto auto auto;
|
|
59
|
+
text-align: center;
|
|
60
|
+
margin-top: 1rem;
|
|
61
|
+
|
|
62
|
+
li {
|
|
63
|
+
background-color: var(--color-box-bg);
|
|
64
|
+
padding: 0.25rem;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.contact {
|
|
70
|
+
ul {
|
|
71
|
+
display: grid;
|
|
72
|
+
gap: 0.5rem;
|
|
73
|
+
grid-template-columns: auto;
|
|
74
|
+
margin-top: 1rem;
|
|
75
|
+
|
|
76
|
+
li {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: row;
|
|
79
|
+
align-items: baseline;
|
|
80
|
+
padding: 0.25rem;
|
|
81
|
+
background-color: var(--color-box-bg);
|
|
82
|
+
|
|
83
|
+
@media (max-width: 720px) {
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
a {
|
|
89
|
+
color: var(--color-link);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
strong {
|
|
93
|
+
font-weight: 500;
|
|
94
|
+
margin-right: 0.5rem;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.tools {
|
|
100
|
+
img {
|
|
101
|
+
width: 36px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
ul {
|
|
105
|
+
display: grid;
|
|
106
|
+
gap: 0.5rem;
|
|
107
|
+
grid-template-columns: auto auto auto auto;
|
|
108
|
+
text-align: center;
|
|
109
|
+
margin-top: 1rem;
|
|
110
|
+
|
|
111
|
+
@media (max-width: 720px) {
|
|
112
|
+
grid-template-columns: auto auto auto;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
li {
|
|
116
|
+
background-color: var(--color-box-bg);
|
|
117
|
+
padding: 0.25rem;
|
|
118
|
+
|
|
119
|
+
a {
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: row;
|
|
122
|
+
align-items: center;
|
|
123
|
+
text-align: left;
|
|
124
|
+
margin-left: 0.25rem;
|
|
125
|
+
margin-right: 0.25rem;
|
|
126
|
+
font-size: 0.9em;
|
|
127
|
+
|
|
128
|
+
div {
|
|
129
|
+
flex: 1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
src/pages/posts/[...slug].astro
CHANGED
|
@@ -16,6 +16,7 @@ type Props = CollectionEntry<"content">;
|
|
|
16
16
|
const {
|
|
17
17
|
data: { title, description, pubDate },
|
|
18
18
|
} = Astro.props;
|
|
19
|
+
console.log(Astro.props);
|
|
19
20
|
const { Content } = await render(Astro.props);
|
|
20
21
|
---
|
|
21
22
|
|
src/pages/posts/index.astro
CHANGED
|
@@ -27,7 +27,6 @@ const posts = (await getCollection("content")).sort(
|
|
|
27
27
|
}
|
|
28
28
|
</ul>
|
|
29
29
|
</div>
|
|
30
|
-
<hr />
|
|
31
30
|
</Layout>
|
|
32
31
|
<style>
|
|
33
32
|
.container {
|
|
@@ -43,10 +42,10 @@ const posts = (await getCollection("content")).sort(
|
|
|
43
42
|
|
|
44
43
|
span {
|
|
45
44
|
font-size: 13pt;
|
|
46
|
-
/* text-gray-900 */
|
|
47
45
|
}
|
|
46
|
+
|
|
47
|
+
time {
|
|
48
|
+
font-size: 12pt;
|
|
48
|
-
|
|
49
|
+
}
|
|
49
|
-
hr {
|
|
50
|
-
padding-bottom: 75%;
|
|
51
50
|
}
|
|
52
51
|
</style>
|
src/pages/repos/[...slug]/commits/index.astro
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { type CollectionEntry, getCollection } from "astro:content";
|
|
3
|
+
import { render } from "astro:content";
|
|
4
|
+
import Layout from "@/layouts/Base.astro";
|
|
5
|
+
import { intlFormatDistance } from "date-fns";
|
|
6
|
+
import styles from "./slug.module.css";
|
|
7
|
+
|
|
8
|
+
export async function getStaticPaths() {
|
|
9
|
+
const repos = await getCollection("repos");
|
|
10
|
+
return repos.map((repo) => ({
|
|
11
|
+
params: { slug: repo.id },
|
|
12
|
+
props: repo,
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
type Props = CollectionEntry<"repos">;
|
|
16
|
+
const {
|
|
17
|
+
data: { title, description, commits },
|
|
18
|
+
} = Astro.props;
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<Layout title={title} description={description}>
|
|
22
|
+
<div class="event-list mb-2">
|
|
23
|
+
{
|
|
24
|
+
commits.map((commit) => (
|
|
25
|
+
<div class={styles.event}>
|
|
26
|
+
<div>
|
|
27
|
+
<a
|
|
28
|
+
href={`/repos/${title}/commits/${commit.hash}`}
|
|
29
|
+
title={commit.hash}
|
|
30
|
+
rel="nofollow"
|
|
31
|
+
>
|
|
32
|
+
{commit.hash.substring(0, 8)}
|
|
33
|
+
</a>
|
|
34
|
+
— {commit.author_name}
|
|
35
|
+
<small class="pull-right">
|
|
36
|
+
<a href={`/repos/${title}/logs?from=??`} rel="nofollow">
|
|
37
|
+
<span title={commit.date}>
|
|
38
|
+
{intlFormatDistance(commit.date, new Date())}
|
|
39
|
+
</span>
|
|
40
|
+
</a>
|
|
41
|
+
</small>
|
|
42
|
+
</div>
|
|
43
|
+
<pre class="commit">{commit.message}</pre>
|
|
44
|
+
</div>
|
|
45
|
+
))
|
|
46
|
+
}
|
|
47
|
+
</div>
|
|
48
|
+
</Layout>
|
src/pages/repos/[...slug]/index.astro
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { type CollectionEntry, getCollection } from "astro:content";
|
|
3
|
+
import { render } from "astro:content";
|
|
4
|
+
import Layout from "@/layouts/Base.astro";
|
|
5
|
+
import { intlFormatDistance } from "date-fns";
|
|
6
|
+
import styles from "./index.module.css";
|
|
7
|
+
|
|
8
|
+
export async function getStaticPaths() {
|
|
9
|
+
const repos = await getCollection("repos");
|
|
10
|
+
return repos.map((repo) => ({
|
|
11
|
+
params: { slug: repo.id },
|
|
12
|
+
props: repo,
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
type Props = CollectionEntry<"repos">;
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
data: { title, description, commits },
|
|
19
|
+
} = Astro.props;
|
|
20
|
+
const latestCommits = commits.slice(0, 3);
|
|
21
|
+
const { Content } = await render(Astro.props);
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<Layout title={title} description={description}>
|
|
25
|
+
<div class={styles.header}>
|
|
26
|
+
<h1>{title}</h1>
|
|
27
|
+
</div>
|
|
28
|
+
<hr />
|
|
29
|
+
<div class={styles.headerExtension}>
|
|
30
|
+
<h2 class=".expand">{description}</h2>
|
|
31
|
+
<!-- <h2>git@pyrossh.dev:~repos/website.git</h2> -->
|
|
32
|
+
</div>
|
|
33
|
+
<div class={styles.summary}>
|
|
34
|
+
<div>
|
|
35
|
+
<div class="event-list mb-2">
|
|
36
|
+
{
|
|
37
|
+
latestCommits.map((commit) => (
|
|
38
|
+
<div class={styles.event}>
|
|
39
|
+
<div>
|
|
40
|
+
<a
|
|
41
|
+
href={`/repos/${title}/commits/${commit.hash}`}
|
|
42
|
+
title={commit.hash}
|
|
43
|
+
rel="nofollow"
|
|
44
|
+
>
|
|
45
|
+
{commit.hash.substring(0, 8)}
|
|
46
|
+
</a>
|
|
47
|
+
— {commit.author_name}
|
|
48
|
+
<small class="pull-right">
|
|
49
|
+
<a href={`/repos/${title}/logs?from=??`} rel="nofollow">
|
|
50
|
+
<span title={commit.date}>
|
|
51
|
+
{intlFormatDistance(commit.date, new Date())}
|
|
52
|
+
</span>
|
|
53
|
+
</a>
|
|
54
|
+
</small>
|
|
55
|
+
</div>
|
|
56
|
+
<pre class="commit">{commit.message}</pre>
|
|
57
|
+
</div>
|
|
58
|
+
))
|
|
59
|
+
}
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
<div class={styles.sectionRight}>
|
|
63
|
+
<!-- <div class={styles.left}>
|
|
64
|
+
<h3>refs</h3>
|
|
65
|
+
<dl>
|
|
66
|
+
<dt>main</dt>
|
|
67
|
+
<dd>
|
|
68
|
+
<a href="/~pyrossh/website/tree" rel="nofollow"
|
|
69
|
+
>browse <span
|
|
70
|
+
class="icon icon-caret-right"
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
><svg
|
|
73
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
74
|
+
width="24"
|
|
75
|
+
height="24"
|
|
76
|
+
viewBox="0 0 192 512"
|
|
77
|
+
><path
|
|
78
|
+
d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"
|
|
79
|
+
></path></svg
|
|
80
|
+
>
|
|
81
|
+
</span></a
|
|
82
|
+
>
|
|
83
|
+
<a href="/~pyrossh/website/log" rel="nofollow"
|
|
84
|
+
>log <span class="icon icon-caret-right" aria-hidden="true"
|
|
85
|
+
><svg
|
|
86
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
87
|
+
width="24"
|
|
88
|
+
height="24"
|
|
89
|
+
viewBox="0 0 192 512"
|
|
90
|
+
><path
|
|
91
|
+
d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"
|
|
92
|
+
></path></svg
|
|
93
|
+
>
|
|
94
|
+
</span></a
|
|
95
|
+
>
|
|
96
|
+
</dd>
|
|
97
|
+
</dl>
|
|
98
|
+
</div> -->
|
|
99
|
+
<div class={styles.right}>
|
|
100
|
+
<h3>clone</h3>
|
|
101
|
+
|
|
102
|
+
<dl>
|
|
103
|
+
<dt>read-only</dt>
|
|
104
|
+
<dd>
|
|
105
|
+
<a href={`https://pyrossh.dev/repos/${title}`}>
|
|
106
|
+
https://pyrossh.dev/repos/{title}.git
|
|
107
|
+
</a>
|
|
108
|
+
</dd>
|
|
109
|
+
<dt>read/write</dt>
|
|
110
|
+
<dd>git@pyrossh.dev:~repos/website.git</dd>
|
|
111
|
+
</dl>
|
|
112
|
+
<div class={styles.bottom}>
|
|
113
|
+
<a href="/~pyrossh/website/send-email" class={styles.btnPrimary}
|
|
114
|
+
>Prepare a patchset <span
|
|
115
|
+
class="icon icon-caret-right"
|
|
116
|
+
aria-hidden="true"
|
|
117
|
+
><svg
|
|
118
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
119
|
+
width="24"
|
|
120
|
+
height="24"
|
|
121
|
+
viewBox="0 0 192 512"
|
|
122
|
+
><path
|
|
123
|
+
d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"
|
|
124
|
+
></path></svg
|
|
125
|
+
>
|
|
126
|
+
</span></a
|
|
127
|
+
>
|
|
128
|
+
<p class="text-muted text-centered">
|
|
129
|
+
<small>
|
|
130
|
+
Use this or <a href="https://git-send-email.io">git send-email</a>
|
|
131
|
+
to send changes upstream.
|
|
132
|
+
</small>
|
|
133
|
+
</p>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
<div class={styles.nav}>
|
|
139
|
+
<ul>
|
|
140
|
+
<li class="nav-item">
|
|
141
|
+
<a class="nav-link active" href={`/${title}`}>Readme</a>
|
|
142
|
+
</li>
|
|
143
|
+
<div>|</div>
|
|
144
|
+
<li class="nav-item">
|
|
145
|
+
<a class="nav-link" href={`/${title}/files`}>Files</a>
|
|
146
|
+
</li>
|
|
147
|
+
<div>|</div>
|
|
148
|
+
<li class="nav-item">
|
|
149
|
+
<a class="nav-link" href={`${title}/commits`}>Commits</a>
|
|
150
|
+
</li>
|
|
151
|
+
<div>|</div>
|
|
152
|
+
<li class="nav-item">
|
|
153
|
+
<a class="nav-link" href={`/${title}/branches`}>Branches</a>
|
|
154
|
+
</li>
|
|
155
|
+
<div>|</div>
|
|
156
|
+
<li class="nav-item">
|
|
157
|
+
<a class="nav-link" href={`/${title}/tags`}>Tags</a>
|
|
158
|
+
</li>
|
|
159
|
+
</ul>
|
|
160
|
+
</div>
|
|
161
|
+
<div class="markdown">
|
|
162
|
+
<Content />
|
|
163
|
+
</div>
|
|
164
|
+
</Layout>
|
|
165
|
+
<style>
|
|
166
|
+
h1,
|
|
167
|
+
h2 {
|
|
168
|
+
margin-top: 0;
|
|
169
|
+
|
|
170
|
+
small {
|
|
171
|
+
font-size: 12px;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
h3 {
|
|
176
|
+
font-size: 1.3rem;
|
|
177
|
+
border-bottom: 1px solid var(--color-gray-200);
|
|
178
|
+
padding-bottom: 0.25rem;
|
|
179
|
+
|
|
180
|
+
small {
|
|
181
|
+
font-size: 1rem;
|
|
182
|
+
margin-left: 1rem;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
h4 {
|
|
187
|
+
font-size: 1.1rem;
|
|
188
|
+
border-bottom: 1px solid var(--color-gray-200);
|
|
189
|
+
padding-bottom: 0.25rem;
|
|
190
|
+
|
|
191
|
+
small {
|
|
192
|
+
font-size: 0.8rem;
|
|
193
|
+
margin-left: 1rem;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
h5 {
|
|
198
|
+
font-size: 1rem;
|
|
199
|
+
font-weight: bold;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.markdown {
|
|
203
|
+
font-size: 12pt;
|
|
204
|
+
|
|
205
|
+
table {
|
|
206
|
+
width: 100%;
|
|
207
|
+
max-width: 100%;
|
|
208
|
+
margin-bottom: 1rem;
|
|
209
|
+
border-collapse: collapse;
|
|
210
|
+
text-indent: initial;
|
|
211
|
+
unicode-bidi: isolate;
|
|
212
|
+
border-spacing: 2px;
|
|
213
|
+
border-color: gray;
|
|
214
|
+
color: white;
|
|
215
|
+
font-size: 1rem;
|
|
216
|
+
|
|
217
|
+
thead {
|
|
218
|
+
th {
|
|
219
|
+
padding: 0.1rem 0.75rem;
|
|
220
|
+
border: none;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
tbody {
|
|
225
|
+
td {
|
|
226
|
+
position: relative;
|
|
227
|
+
background-clip: padding-box;
|
|
228
|
+
vertical-align: middle;
|
|
229
|
+
padding: 0.1rem 0.75rem;
|
|
230
|
+
border: 1px solid var(--color-gray-400);
|
|
231
|
+
background-color: white;
|
|
232
|
+
|
|
233
|
+
label {
|
|
234
|
+
margin-bottom: 0;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
table,
|
|
241
|
+
table tbody tr,
|
|
242
|
+
table tbody td,
|
|
243
|
+
table thead th {
|
|
244
|
+
/* background: var(--color-gray-800); */
|
|
245
|
+
background: #343a40;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
table tbody td {
|
|
249
|
+
/* border: 1px solid var(--color-gray-900); */
|
|
250
|
+
border: 1px solid #212529;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
h1,
|
|
254
|
+
h2,
|
|
255
|
+
h3,
|
|
256
|
+
h4,
|
|
257
|
+
h5,
|
|
258
|
+
h6 {
|
|
259
|
+
position: relative;
|
|
260
|
+
margin-top: 1em;
|
|
261
|
+
|
|
262
|
+
&:first-child {
|
|
263
|
+
margin-top: 0;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
& > a:first-child {
|
|
267
|
+
transition: opacity 0.15s linear;
|
|
268
|
+
opacity: 0;
|
|
269
|
+
position: absolute;
|
|
270
|
+
font-size: inherit;
|
|
271
|
+
left: -0.7em;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
@media (prefers-reduced-motion) {
|
|
275
|
+
& > a:first-child {
|
|
276
|
+
transition: none;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
&:hover > a:first-child {
|
|
281
|
+
opacity: 1;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
img {
|
|
285
|
+
margin: 0 0.2rem;
|
|
286
|
+
max-width: 100%;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
blockquote {
|
|
291
|
+
padding-left: 0.5rem;
|
|
292
|
+
border-left: 3px solid #aaa;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
pre {
|
|
296
|
+
background: $pre-background;
|
|
297
|
+
padding: 0.25rem;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
code {
|
|
301
|
+
margin: 0;
|
|
302
|
+
background: transparent;
|
|
303
|
+
color: white;
|
|
304
|
+
font-size: 87.5%;
|
|
305
|
+
/* color: #e83e8c; */
|
|
306
|
+
word-break: break-word;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.alert {
|
|
310
|
+
padding: 0.5rem;
|
|
311
|
+
border-radius: 0;
|
|
312
|
+
|
|
313
|
+
.form-group & {
|
|
314
|
+
margin-top: 1rem;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.text-centered {
|
|
319
|
+
text-align: center;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.text-right {
|
|
323
|
+
text-align: right;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.pull-left {
|
|
327
|
+
float: left;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.pull-right {
|
|
331
|
+
float: right;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
</style>
|
src/pages/repos/[...slug]/index.module.css
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
.header {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex: 1;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
align-items: baseline;
|
|
6
|
+
|
|
7
|
+
@media (max-width: 720px) {
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
align-items: start;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
h1 {
|
|
13
|
+
text-align: left;
|
|
14
|
+
font-size: 27pt;
|
|
15
|
+
font-weight: bold;
|
|
16
|
+
line-height: 1;
|
|
17
|
+
margin-top: 0.5rem;
|
|
18
|
+
margin-bottom: 0.1rem;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.headerExtension {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex: 1;
|
|
25
|
+
background: #131618;
|
|
26
|
+
/* margin-bottom: 1rem; */
|
|
27
|
+
padding-top: 0.3rem;
|
|
28
|
+
padding-left: 0.3rem;
|
|
29
|
+
font-size: 0.95rem;
|
|
30
|
+
|
|
31
|
+
@media (max-width: 720px) {
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: start;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.expand {
|
|
37
|
+
flex: 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.nav {
|
|
42
|
+
margin-bottom: 1rem;
|
|
43
|
+
|
|
44
|
+
ul {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
|
|
48
|
+
@media (max-width: 720px) {
|
|
49
|
+
margin-top: 0.5rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
div {
|
|
53
|
+
padding-right: 0.5rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
li {
|
|
57
|
+
font-size: 12pt;
|
|
58
|
+
padding-right: 0.5rem;
|
|
59
|
+
color: #65686a;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
color: #ced4da;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
time {
|
|
67
|
+
text-align: left;
|
|
68
|
+
color: rgb(var(--gray));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.summary {
|
|
72
|
+
display: grid;
|
|
73
|
+
grid-template-columns: auto auto;
|
|
74
|
+
gap: 12px;
|
|
75
|
+
|
|
76
|
+
@media (max-width: 720px) {
|
|
77
|
+
grid-template-columns: auto;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.event {
|
|
82
|
+
background: #131618;
|
|
83
|
+
color: #fff;
|
|
84
|
+
text-overflow: ellipsis;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
padding: 0.5rem;
|
|
87
|
+
margin: 0.5rem 0;
|
|
88
|
+
font-size: 11pt;
|
|
89
|
+
|
|
90
|
+
a {
|
|
91
|
+
color: #3395ff;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
small {
|
|
95
|
+
font-size: 85%;
|
|
96
|
+
font-weight: 400;
|
|
97
|
+
float: right;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.sectionRight {
|
|
102
|
+
display: grid;
|
|
103
|
+
grid-template-columns: auto;
|
|
104
|
+
gap: 1rem;
|
|
105
|
+
font-size: 12pt;
|
|
106
|
+
margin-left: 1rem;
|
|
107
|
+
margin-top: 0.5rem;
|
|
108
|
+
|
|
109
|
+
h3, h4 {
|
|
110
|
+
/* border-bottom-color: #e9ecef; */
|
|
111
|
+
font-size: 1.3rem;
|
|
112
|
+
border-bottom: 1px solid #495057;
|
|
113
|
+
padding-bottom: .25rem;
|
|
114
|
+
margin-bottom: .5rem;
|
|
115
|
+
font-weight: 400;
|
|
116
|
+
line-height: 1.2;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
a {
|
|
120
|
+
color: var(--color-link);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.left {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.right {
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
|
|
132
|
+
.bottom {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
align-items: center;
|
|
136
|
+
margin-top: 1rem;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.btnPrimary {
|
|
142
|
+
display: flex;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
background: #0062cc;
|
|
145
|
+
border: #001933 1px solid;
|
|
146
|
+
color: #fff !important;
|
|
147
|
+
border-radius: 0;
|
|
148
|
+
padding: .1rem .75rem;
|
|
149
|
+
font-size: .9rem;
|
|
150
|
+
width: 100%;
|
|
151
|
+
text-align: center;
|
|
152
|
+
}
|