Basis of publisher page

This commit is contained in:
2025-11-08 13:29:09 +08:00
parent 1724044bce
commit 209be30d45
9 changed files with 314 additions and 38 deletions

View File

@@ -1,16 +1,22 @@
<template>
<div class="flex gap-3 items-center">
<v-avatar :image="publisherAvatar" size="40" />
<div class="flex-grow-1 flex flex-col">
<p class="flex gap-1 items-baseline">
<div :class="['flex gap-3 items-center', { 'gap-2': compact }]">
<v-avatar :image="publisherAvatar" :size="compact ? 24 : 40" :border="compact" />
<div class="grow flex flex-col">
<p v-if="compact" class="flex gap-1 items-baseline text-sm">
<span class="font-bold">{{ props.item.publisher.nick }}</span>
<span class="text-xs">@{{ props.item.publisher.name }}</span>
</p>
<p class="text-xs flex gap-1">
<span>{{ DateTime.fromISO(props.item.createdAt).toRelative() }}</span>
<span class="font-bold">·</span>
<span>{{ DateTime.fromISO(props.item.createdAt).toLocaleString() }}</span>
<span class="text-xs opacity-80">{{ DateTime.fromISO(props.item.createdAt).toRelative() }}</span>
</p>
<template v-else>
<p class="flex gap-1 items-baseline">
<span class="font-bold">{{ props.item.publisher.nick }}</span>
<span class="text-xs">@{{ props.item.publisher.name }}</span>
</p>
<p class="text-xs flex gap-1">
<span>{{ DateTime.fromISO(props.item.createdAt).toRelative() }}</span>
<span class="font-bold">·</span>
<span>{{ DateTime.fromISO(props.item.createdAt).toLocaleString() }}</span>
</p>
</template>
</div>
</div>
</template>
@@ -20,7 +26,7 @@ import { computed } from 'vue'
import { DateTime } from 'luxon'
import type { SnPost } from '~/types/api';
const props = defineProps<{ item: SnPost }>()
const props = withDefaults(defineProps<{ item: SnPost, compact?: boolean }>(), { compact: false })
const apiBase = useSolarNetworkUrl();
const publisherAvatar = computed(() =>