blob: 9cc997a3948928348d13d71a73e55f395e4eab86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
---
import { gitDir } from "@lib/git";
import type { Commit } from "@lib/git/types";
import { toIso8601Full } from "@utils/datetime";
type Props = { commit: Commit; lang: string };
const dir = await gitDir();
const { hash, files, author, committer, signature } =
Astro.props.commit;
const formatter = new Intl.DateTimeFormat([Astro.props.lang], {
dateStyle: "short",
timeStyle: "short",
});
---
<section>
<details>
<summary>
Informações sobre o último commit que modificou ficheiros relacionados a
este blog post:
</summary>
<dl class="divider">
<dt>Hash</dt>
<dd><samp title={hash.long}>0x{hash.short.toUpperCase()}</samp></dd>
<dt>Ficheiros modificados</dt>
{
files.length > 0
? files.map((file) => (
<dd><samp>{file.path.pathname.replace(dir.pathname, "")}</samp></dd>
))
: <dd>Nenhum ficheiro modificado</dd>
}
<dt>
Autor (<time datetime={toIso8601Full(author.date)}>{
formatter.format(author.date)
}</time>)
</dt>
<dd>
{author.name} <<a href={`mailto:${author.email}`}>{
author.email
}</a>>
</dd>
<dt>
Commiter (<time datetime={toIso8601Full(committer.date)}>{
formatter.format(committer.date)
}</time>)
</dt>
<dd>
{committer.name} <<a href={`mailto:${committer.email}`}>{
committer.email
}</a>>
</dd>
{
signature &&
(
<dt>Assinatura do commit</dt>
<dd>
<dl>
<dt>Tipo</dt>
<dd><samp>{signature.type}</samp></dd>
<dt>Assinante</dt>
<dd>{signature.signer}</dd>
<dt>Fingerprint da chave</dt>
<dd><samp>0x{signature.key.short}</samp></dd>
</dl>
</dd>
)
}
</dl>
</details>
</section>
<style>
section {
font-size: smaller;
}
dl {
margin-block: 0;
}
details {
padding-block: 1rem;
}
</style>
|