fix: author typing

This commit is contained in:
Julien Calixte
2026-02-14 19:46:14 +01:00
parent ecd18fbb40
commit f92f5f4adf
3 changed files with 18 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { getAka } from "@/modules/atproto/getAka"
import { Author, getAka } from "@/modules/atproto/getAka"
import { PublicNoteListItem } from "@/modules/note/models/Note"
import { computedAsync, useAsyncState } from "@vueuse/core"
@@ -13,14 +13,16 @@ const { state, isLoading } = useAsyncState<{
{ notes: [] },
)
const aka = computedAsync<Map<string, string>>(async () => {
const aka = computedAsync<Map<string, Author>>(async () => {
if (state.value.notes.length === 0) {
return new Map()
}
return getAka(new Set(state.value.notes.map((n) => n.did)))
}, new Map())
const getAlias = (did: string) => aka.value.get(did) ?? ""
const getAlias = (did: string) =>
aka.value.has(did) ? aka.value.get(did)?.alias : ""
</script>
<template>

View File

@@ -61,8 +61,6 @@ watch(article, () => {
downloadFont(article.value.value.fontFamily)
}
console.log("font size:", article.value?.value.fontSize)
if (article.value?.value.fontSize) {
const root = document.documentElement
root.style.setProperty("--font-size", `${article.value.value.fontSize}pt`)
@@ -122,9 +120,11 @@ watch(
>{{ title }}</a
>
</div>
<span class="badge badge-accent badge-author" v-if="author">{{
author.alias
}}</span>
<span class="badge" v-if="publishedAt">{{ publishedAt }}</span>
<span class="badge badge-accent badge-author" v-if="author">
{{ author.alias }}</span
>
<article class="note-display" v-html="content"></article>
<router-link
:to="{ name: 'Home' }"