2024-08-11 07:36:56 +00:00
|
|
|
<template>
|
2024-08-11 08:14:40 +00:00
|
|
|
<v-container class="content-container mx-auto">
|
|
|
|
<v-img v-if="urlOfBanner" :src="urlOfBanner" :aspect-ratio="16 / 5" class="rounded-md mb-3" cover />
|
2024-08-11 07:36:56 +00:00
|
|
|
|
2024-08-11 08:14:40 +00:00
|
|
|
<div class="mx-[2.5ch]">
|
|
|
|
<div class="my-5 flex flex-row gap-4">
|
|
|
|
<v-avatar :image="urlOfAvatar" />
|
|
|
|
<div class="flex flex-col">
|
|
|
|
<span>{{ account.nick }} <span class="text-xs">@{{ account.name }}</span></span>
|
|
|
|
<span class="text-sm">{{ account.description }}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mb-5 text-xs text-grey flex flex-col">
|
|
|
|
<span>Solar Network User Web Preview</span>
|
2024-08-13 09:54:13 +00:00
|
|
|
<span>
|
|
|
|
To get full view of this user's profile, open it on <a class="underline" :href="externalOpenLink">Solian</a>
|
|
|
|
</span>
|
2024-08-11 08:14:40 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
2024-08-13 09:54:13 +00:00
|
|
|
<h1 class="text-xl">{{ t("userActivity") }}</h1>
|
|
|
|
<span>{{ t("userActivityCaption") }}</span>
|
2024-08-11 08:14:40 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<v-infinite-scroll :items="posts" :onLoad="loadPost">
|
|
|
|
<template v-for="item in posts" :key="item">
|
|
|
|
<post-item :post="item" />
|
|
|
|
</template>
|
|
|
|
</v-infinite-scroll>
|
|
|
|
</v-container>
|
2024-08-11 07:36:56 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2024-08-11 14:26:29 +00:00
|
|
|
definePageMeta({
|
2024-08-13 09:54:13 +00:00
|
|
|
alias: ["/@:name(.*)*"],
|
2024-08-11 14:26:29 +00:00
|
|
|
})
|
|
|
|
|
2024-08-13 09:54:13 +00:00
|
|
|
const { t } = useI18n()
|
2024-08-11 08:14:40 +00:00
|
|
|
const route = useRoute()
|
|
|
|
const config = useRuntimeConfig()
|
|
|
|
|
|
|
|
const posts = ref<any[]>([])
|
|
|
|
|
|
|
|
const { data: account } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/auth/users/${route.params.name}`)
|
2024-08-11 07:36:56 +00:00
|
|
|
|
2024-08-11 08:14:40 +00:00
|
|
|
const urlOfAvatar = computed(() => account.value.avatar ? `${config.public.solarNetworkApi}/cgi/files/attachments/${account.value.avatar}` : void 0)
|
|
|
|
const urlOfBanner = computed(() => account.value.banner ? `${config.public.solarNetworkApi}/cgi/files/attachments/${account.value.banner}` : void 0)
|
|
|
|
|
|
|
|
const externalOpenLink = computed(() => `${config.public.solianUrl}/accounts/view/${route.params.name}`)
|
|
|
|
|
|
|
|
async function loadPost({ done }: any) {
|
|
|
|
const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts?take=10&author=${route.params.name}&offset=${posts.value.length}`)
|
|
|
|
const result = await res.json()
|
|
|
|
|
|
|
|
posts.value.push(...result.data)
|
|
|
|
|
|
|
|
done("ok")
|
|
|
|
}
|
2024-08-11 07:36:56 +00:00
|
|
|
</script>
|
2024-08-11 08:14:40 +00:00
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.content-container {
|
|
|
|
max-width: 70ch !important;
|
|
|
|
}
|
|
|
|
</style>
|