feat: New notifications view, refactor all composables

This commit is contained in:
Jesse Wierzbinski 2024-04-26 15:28:12 -10:00
parent 7b8a02d49e
commit e0c41bb9b5
No known key found for this signature in database
23 changed files with 641 additions and 281 deletions

View file

@ -116,30 +116,28 @@ watch(
async () => {
if (skeleton.value) return;
parsedNote.value = (
await useParsedContent(
useParsedContent(
props.account?.note ?? "",
props.account?.emojis ?? [],
[],
)
).value;
parsedFields.value = await Promise.all(
props.account?.fields.map(async (field) => ({
name: await (
await useParsedContent(
field.name,
props.account?.emojis ?? [],
[],
)
).value,
value: await (
await useParsedContent(
field.value,
props.account?.emojis ?? [],
[],
)
).value,
})) ?? [],
);
).value ?? "";
parsedFields.value = props.account?.fields.map((field) => ({
name: (
useParsedContent(
field.name,
props.account?.emojis ?? [],
[],
)
).value ?? "",
value: (
useParsedContent(
field.value,
props.account?.emojis ?? [],
[],
)
).value ?? "",
})) ?? [];
},
{
immediate: true,

View file

@ -1,6 +1,6 @@
<template>
<NuxtLink :href="accountUrl" class="flex flex-row">
<Skeleton :enabled="skeleton" shape="rect" class="!h-12 w-12">
<Skeleton :enabled="!account" shape="rect" class="!h-12 w-12">
<div>
<img class="h-12 w-12 rounded ring-1 ring-white/5" :src="account?.avatar"
:alt="`${account?.acct}'s avatar'`" />
@ -9,14 +9,14 @@
<div class="flex flex-col items-start justify-around ml-4 grow overflow-hidden">
<div class="flex flex-row items-center justify-between w-full">
<div class="font-semibold text-gray-200 line-clamp-1 break-all">
<Skeleton :enabled="skeleton" :min-width="90" :max-width="170" shape="rect">
<Skeleton :enabled="!account" :min-width="90" :max-width="170" shape="rect">
{{
account?.display_name }}
</Skeleton>
</div>
</div>
<span class="text-gray-400 text-sm line-clamp-1 break-all w-full">
<Skeleton :enabled="skeleton" :min-width="130" :max-width="250" shape="rect">
<Skeleton :enabled="!account" :min-width="130" :max-width="250" shape="rect">
@{{
account?.acct
}}
@ -29,15 +29,9 @@
<script lang="ts" setup>
import type { Account } from "~/types/mastodon/account";
const props = withDefaults(
defineProps<{
account?: Account;
skeleton?: boolean;
}>(),
{
skeleton: false,
},
);
const props = defineProps<{
account?: Account;
}>();
const accountUrl = props.account && `/@${props.account.acct}`;
</script>