2023-01-27 18:15:46 +03:00
|
|
|
<script setup lang="ts">
|
2023-02-03 00:02:39 +03:00
|
|
|
import type { CommonRouteTabOption } from '~/components/common/CommonRouteTabs.vue'
|
|
|
|
|
2023-02-03 00:35:18 +03:00
|
|
|
definePageMeta({
|
|
|
|
middleware: 'auth',
|
|
|
|
})
|
|
|
|
|
2023-02-03 00:02:39 +03:00
|
|
|
const route = useRoute()
|
2023-02-05 15:10:19 +03:00
|
|
|
const { t } = useI18n()
|
|
|
|
|
2024-02-21 18:20:08 +03:00
|
|
|
const list = computed(() => route.params.list as string)
|
|
|
|
const server = computed(() => (route.params.server ?? currentServer.value) as string)
|
2023-01-27 18:15:46 +03:00
|
|
|
|
2024-02-21 18:20:08 +03:00
|
|
|
const tabs = computed<CommonRouteTabOption[]>(() => [
|
2023-02-03 00:02:39 +03:00
|
|
|
{
|
|
|
|
to: {
|
|
|
|
name: 'list',
|
2024-02-21 18:20:08 +03:00
|
|
|
params: { server: server.value, list: list.value },
|
2023-02-03 00:02:39 +03:00
|
|
|
},
|
|
|
|
display: t('tab.posts'),
|
|
|
|
icon: 'i-ri:list-unordered',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
to: {
|
|
|
|
name: 'list-accounts',
|
2024-02-21 18:20:08 +03:00
|
|
|
params: { server: server.value, list: list.value },
|
2023-02-03 00:02:39 +03:00
|
|
|
},
|
|
|
|
display: t('tab.accounts'),
|
|
|
|
icon: 'i-ri:user-line',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
)
|
2023-01-27 18:15:46 +03:00
|
|
|
|
2024-02-21 18:20:08 +03:00
|
|
|
const { client } = useMasto()
|
|
|
|
const { data: listInfo, refresh } = await useAsyncData(() => client.value.v1.lists.$select(list.value).fetch(), { default: () => shallowRef() })
|
2023-01-27 18:15:46 +03:00
|
|
|
|
2023-02-03 00:02:39 +03:00
|
|
|
if (listInfo) {
|
2023-04-16 22:33:51 +03:00
|
|
|
useHydratedHead({
|
2024-02-21 18:20:08 +03:00
|
|
|
title: () => `${listInfo.value.title} | ${route.fullPath.endsWith('/accounts') ? t('tab.accounts') : t('tab.posts')} | ${t('nav.lists')}`,
|
2023-02-03 00:02:39 +03:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
onReactivated(() => {
|
|
|
|
// Silently update data when reentering the page
|
|
|
|
// The user will see the previous content first, and any changes will be updated to the UI when the request is completed
|
|
|
|
refresh()
|
|
|
|
})
|
2023-01-27 18:15:46 +03:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-02-03 00:02:39 +03:00
|
|
|
<MainContent back>
|
|
|
|
<template #title>
|
|
|
|
<span text-lg font-bold>{{ listInfo ? listInfo.title : t('nav.list') }}</span>
|
|
|
|
</template>
|
|
|
|
<template #header>
|
|
|
|
<CommonRouteTabs replace :options="tabs" />
|
|
|
|
</template>
|
|
|
|
<NuxtPage v-if="isHydrated" />
|
|
|
|
</MainContent>
|
2023-01-27 18:15:46 +03:00
|
|
|
</template>
|