diff options
author | João Augusto Costa Branco Marado Torres <torres.dev@disroot.org> | 2025-08-05 18:50:37 +0100 |
---|---|---|
committer | João Augusto Costa Branco Marado Torres <torres.dev@disroot.org> | 2025-08-05 18:50:37 +0100 |
commit | 0af094770c4ebabc56ff761a8bd215bc397c0f7e (patch) | |
tree | a9ad669c8b84b4d13897732ed93ccfcbbeb2cb25 /src/components/signature/Downloads.astro | |
parent | 84eef3f848c4efa18985a776021a58720744523a (diff) |
refactor: reading page review
Signed-off-by: João Augusto Costa Branco Marado Torres <torres.dev@disroot.org>
Diffstat (limited to 'src/components/signature/Downloads.astro')
-rw-r--r-- | src/components/signature/Downloads.astro | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/components/signature/Downloads.astro b/src/components/signature/Downloads.astro deleted file mode 100644 index 3497b37..0000000 --- a/src/components/signature/Downloads.astro +++ /dev/null @@ -1,63 +0,0 @@ ---- -import { gitDir } from "@lib/git"; -import { get } from "@utils/anonymous"; - -interface Props { - lang: string; -} - -const { lang } = Astro.props; - -let source = new URL( - `${Astro.url.href.replace(/\/$/, "")}.md`, -); - -const dir = await gitDir(); - -const format: Intl.NumberFormatOptions = { - notation: "compact", - style: "unit", - unit: "byte", - unitDisplay: "narrow", -}; - -const formatter = new Intl.NumberFormat(lang, format); - -const sourceSize = formatter.format( - await Deno.stat( - new URL("public" + source.pathname, dir), - ).then(get("size")), -); -const sig = await Deno.stat( - new URL("public" + source.pathname + ".sig", dir), -).then(get("size")).catch(() => undefined); -const sigSize = formatter.format(sig); ---- - -<section> - <p>Ficheiros para descarregar:</p> - <dl> - <dt>Blog post</dt> - <dd> - <a - id="message" - href={source} - download - type="text/markdown; charset=utf-8" - ><samp>text/markdown</samp>, <samp>{sourceSize}</samp></a> - </dd> - { - sig && ( - <dt>Assinatura digital</dt> - <dd> - <a - id="signature" - href={`${source}.sig`} - download - type="application/pgp-signature" - ><samp>application/pgp-signature</samp>, <samp>{sigSize}</samp></a> - </dd> - ) - } - </dl> -</section> |