refacto: use microcosm endpoint and change types
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import BackButton from "@/components/BackButton.vue"
|
||||
import { usePublicNoteList } from "@/hooks/usePublicNoteList.hook"
|
||||
import { getUniqueAka } from "@/modules/atproto/getAka"
|
||||
import { getAuthor } from "@/modules/atproto/getAuthor"
|
||||
import { computedAsync } from "@vueuse/core"
|
||||
import { computed } from "vue"
|
||||
import { vInfiniteScroll } from "@vueuse/components"
|
||||
@@ -11,14 +11,14 @@ const did = computed(() => props.did)
|
||||
|
||||
const { notes, isLoading, canLoadMore, onLoadMore } = usePublicNoteList(did)
|
||||
|
||||
const author = computedAsync(async () => getUniqueAka(did.value))
|
||||
const author = computedAsync(async () => getAuthor(did.value))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="public-note-list-view">
|
||||
<div class="header">
|
||||
<back-button class="back-button" :fallback="{ name: 'Home' }" />
|
||||
<h1>{{ author?.alias ?? did }}</h1>
|
||||
<h1>{{ author?.handle ?? did }}</h1>
|
||||
</div>
|
||||
<div v-if="isLoading"></div>
|
||||
<div v-else>
|
||||
|
||||
@@ -3,7 +3,7 @@ import BackButton from "@/components/BackButton.vue"
|
||||
import { usePublicNoteList } from "@/hooks/usePublicNoteList.hook"
|
||||
import { vInfiniteScroll } from "@vueuse/components"
|
||||
|
||||
const { notes, isLoading, canLoadMore, onLoadMore, getAlias } =
|
||||
const { notes, isLoading, canLoadMore, onLoadMore, getAuthor } =
|
||||
usePublicNoteList()
|
||||
</script>
|
||||
|
||||
@@ -32,14 +32,14 @@ const { notes, isLoading, canLoadMore, onLoadMore, getAlias } =
|
||||
|
||||
<div class="text-xs opacity-80 alias">
|
||||
<router-link
|
||||
v-if="getAlias(note.did)"
|
||||
v-if="getAuthor(note.did)"
|
||||
:to="{
|
||||
name: 'PublicNoteListByDidView',
|
||||
params: { did: note.did },
|
||||
}"
|
||||
class="link link-hover"
|
||||
>
|
||||
{{ getAlias(note.did) }}
|
||||
{{ getAuthor(note.did) }}
|
||||
</router-link>
|
||||
<span v-if="note.publishedAt"
|
||||
> • {{
|
||||
|
||||
@@ -4,7 +4,7 @@ import { markdownBuilder } from "@/hooks/useMarkdown.hook"
|
||||
import BackButton from "@/components/BackButton.vue"
|
||||
import StackedPublicNote from "@/components/StackedPublicNote.vue"
|
||||
import { useRouteQueryStackedNotes } from "@/hooks/useRouteQueryStackedNotes.hook"
|
||||
import { getUniqueAka } from "@/modules/atproto/getAka"
|
||||
import { getAuthor } from "@/modules/atproto/getAuthor"
|
||||
import type { PublicNoteRecord } from "@/modules/atproto/publicNote.types"
|
||||
import { withATProtoImages } from "@/modules/atproto/withATProtoImages"
|
||||
import { getUrl } from "@/modules/atproto/getUrl"
|
||||
@@ -18,9 +18,10 @@ const props = defineProps<{ did: string; rkey: string }>()
|
||||
const did = computed(() => props.did)
|
||||
const rkey = computed(() => props.rkey)
|
||||
|
||||
const author = computedAsync(async () => getUniqueAka(did.value))
|
||||
const url = computedAsync(async () =>
|
||||
getUrl({ did: did.value, rkey: rkey.value }),
|
||||
const author = computedAsync(async () => getAuthor(did.value))
|
||||
const url = computedAsync(
|
||||
async () => getUrl({ did: did.value, rkey: rkey.value }),
|
||||
null,
|
||||
)
|
||||
|
||||
const noteRecord = computedAsync(async () =>
|
||||
@@ -50,7 +51,7 @@ const content = computed(() =>
|
||||
noteRecord.value?.value.content && author.value
|
||||
? toHTML(
|
||||
withATProtoImages(noteRecord.value.value.content, {
|
||||
endpoint: author.value.endpoint,
|
||||
pds: author.value.pds,
|
||||
did: did.value,
|
||||
}),
|
||||
)
|
||||
@@ -95,7 +96,7 @@ watch(
|
||||
:to="{ name: 'PublicNoteListByDidView', params: { did: did } }"
|
||||
class="link link-hover"
|
||||
>
|
||||
{{ author.alias }}
|
||||
{{ author.handle }}
|
||||
</router-link>
|
||||
<span v-if="publishedAt"> • {{ publishedAt }}</span>
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user