diff --git a/pages/users/[name].vue b/pages/users/[name].vue index 1747385..ac52aa8 100644 --- a/pages/users/[name].vue +++ b/pages/users/[name].vue @@ -6,25 +6,34 @@ <div class="my-5 mx-4 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> + <span + >{{ account?.nick }} <span class="text-xs">@{{ account?.name }}</span></span + > + <p> + {{ accountStatus.status ? accountStatus.status.label : accountStatus["is_online"] ? "Online" : "Offline" }} + </p> </div> </div> - <div class="mb-7"> - - </div> - <v-row> - <v-col row="12" lg="8"> - <post-list class="mx-[-2.5ch] mt-[-16px]" v-if="account" :author="account.name" /> + <v-col cols="12" lg="8"> + <v-card> + <v-card-text v-if="accountPageStatus.valueOf() === 'success'"> + <div class="prose prose-sm" style="max-width: unset"> + <m-d-c :value="accountPage.content" /> + </div> + </v-card-text> + <v-card-text v-else> + <p class="font-italic">The user has no account page.</p> + </v-card-text> + </v-card> </v-col> - <v-col row="12" lg="4" order="first" order-lg="last"> + <v-col cols="12" lg="4" order="first" order-lg="last"> <div class="sticky top-0 h-fit"> <v-card prepend-icon="mdi-identifier" title="About"> <v-card-text> <p><b>Description</b></p> - <p>{{ account.description }}</p> + <p>{{ account?.profile.description }}</p> <p class="mt-3"><b>Joined At</b></p> <p>{{ new Date(account.created_at).toLocaleString() }}</p> </v-card-text> @@ -41,8 +50,6 @@ const { t } = useI18n() const route = useRoute() const config = useRuntimeConfig() -const tab = ref(1) - const { data: account } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/id/users/${route.params.name}`) if (account.value == null) { @@ -52,6 +59,17 @@ if (account.value == null) { }) } -const urlOfAvatar = computed(() => account.value?.avatar ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${account.value.avatar}` : void 0) -const urlOfBanner = computed(() => account.value?.banner ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${account.value.banner}` : void 0) +const { data: accountPage, status: accountPageStatus } = await useFetch<any>( + `${config.public.solarNetworkApi}/cgi/id/users/${route.params.name}/page`, +) +const { data: accountStatus, status: accountStatusStatus } = await useFetch<any>( + `${config.public.solarNetworkApi}/cgi/id/users/${route.params.name}/status`, +) + +const urlOfAvatar = computed(() => + account.value?.avatar ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${account.value.avatar}` : void 0, +) +const urlOfBanner = computed(() => + account.value?.banner ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${account.value.banner}` : void 0, +) </script>