fix: removed gpg component that was breaking everything

THIS TOOK ME 4 HOURS
This commit is contained in:
Youwen Wu 2024-04-05 23:34:56 -07:00
parent 106dbc9349
commit 4d578139af
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
4 changed files with 2 additions and 68 deletions

1
.gitignore vendored
View file

@ -8,3 +8,4 @@ node_modules
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.vercel

View file

@ -1,57 +0,0 @@
<script lang="ts">
import * as AlertDialog from '$lib/components/ui/alert-dialog';
import { onMount } from 'svelte';
import { toast } from 'svelte-sonner';
import ScrollArea from './ui/scroll-area/scroll-area.svelte';
let gpg: Promise<string>;
async function getGpg() {
const res = await fetch(`/youwen.gpg`);
const text = await res.text();
if (res.ok) {
return text;
} else {
throw new Error(text);
}
}
async function copyGpg() {
try {
const text = await gpg;
navigator.clipboard.writeText(text);
toast('Copied GPG key to clipboard');
} catch (e) {
console.error(e);
toast('Failed to copy GPG key to clipboard');
}
}
onMount(() => {
gpg = getGpg();
});
</script>
<AlertDialog.Root>
<AlertDialog.Trigger><slot /></AlertDialog.Trigger>
<AlertDialog.Content>
<AlertDialog.Header>
<AlertDialog.Title>GPG Key</AlertDialog.Title>
<AlertDialog.Description class="flex justify-center">
{#await gpg then text}
<ScrollArea class="max-h-60 mb-4 max-w-60" orientation="both">
<p>{text}</p>
</ScrollArea>
{:catch}
<p class="text-destructive">Couldn't fetch GPG key.</p>
{/await}
</AlertDialog.Description>
</AlertDialog.Header>
<AlertDialog.Footer class="gap-1">
<a href="/youwen.gpg" download>
<AlertDialog.Action>Download</AlertDialog.Action>
</a>
<AlertDialog.Action on:click={copyGpg}>Copy</AlertDialog.Action>
<AlertDialog.Cancel>Close</AlertDialog.Cancel>
</AlertDialog.Footer>
</AlertDialog.Content>
</AlertDialog.Root>

View file

@ -6,15 +6,9 @@
import Button from '../ui/button/button.svelte';
import { Sun, Moon, Home, Person, File, Backpack } from 'svelte-radix';
import ThemePicker from '../ThemePicker.svelte';
let open: boolean = false;
const close = () => {
open = false;
};
</script>
<Drawer.Root shouldScaleBackground direction="top" bind:open>
<Drawer.Root shouldScaleBackground direction="top">
<Drawer.Trigger asChild let:builder>
<Button variant="outline" size="icon" builders={[builder]} class="px-2 md:hidden">
<HamburgerMenu class="icon border-1 border-primary" />

View file

@ -1,5 +1,4 @@
<script lang="ts">
import Gpg from '$lib/components/Gpg.svelte';
import Socials from '$lib/components/Socials.svelte';
import Button from '$lib/components/ui/button/button.svelte';
import * as Card from '$lib/components/ui/card';
@ -98,9 +97,6 @@
<Card.Content>
<h3>Find me on:</h3>
<Socials />
<Gpg>
<Button variant="outline" class="mt-4"><span class="mr-2">🔑</span> My GPG Key</Button>
</Gpg>
</Card.Content>
</Card.Root>
</div>