2022-11-17 22:09:05 +09:00
|
|
|
<script setup lang="ts">
|
2023-01-25 03:52:48 +09:00
|
|
|
import type { CommonRouteTabOption } from '~/components/common/CommonRouteTabs.vue'
|
|
|
|
|
2022-11-28 23:25:32 +09:00
|
|
|
const { t } = useI18n()
|
|
|
|
|
2023-02-03 19:40:54 +09:00
|
|
|
const search = $ref<{ input?: HTMLInputElement }>()
|
|
|
|
const route = useRoute()
|
|
|
|
watchEffect(() => {
|
|
|
|
if (isMediumOrLargeScreen && route.name === 'explore' && search?.input)
|
|
|
|
search?.input?.focus()
|
|
|
|
})
|
|
|
|
onActivated(() =>
|
|
|
|
search?.input?.focus(),
|
|
|
|
)
|
|
|
|
onDeactivated(() => search?.input?.blur())
|
|
|
|
|
2023-01-25 03:52:48 +09:00
|
|
|
const tabs = $computed<CommonRouteTabOption[]>(() => [
|
2022-12-11 19:52:36 +09:00
|
|
|
{
|
2023-01-11 23:50:47 +09:00
|
|
|
to: isHydrated.value ? `/${currentServer.value}/explore` : '/explore',
|
2023-01-13 03:35:26 +09:00
|
|
|
display: isHydrated.value ? t('tab.posts') : '',
|
2022-12-11 19:52:36 +09:00
|
|
|
},
|
|
|
|
{
|
2023-01-11 23:50:47 +09:00
|
|
|
to: isHydrated.value ? `/${currentServer.value}/explore/tags` : '/explore/tags',
|
2023-01-13 03:35:26 +09:00
|
|
|
display: isHydrated.value ? t('tab.hashtags') : '',
|
2022-12-11 19:52:36 +09:00
|
|
|
},
|
|
|
|
{
|
2023-01-11 23:50:47 +09:00
|
|
|
to: isHydrated.value ? `/${currentServer.value}/explore/links` : '/explore/links',
|
2023-01-13 03:35:26 +09:00
|
|
|
display: isHydrated.value ? t('tab.news') : '',
|
2022-12-11 19:52:36 +09:00
|
|
|
},
|
|
|
|
// This section can only be accessed after logging in
|
2022-12-26 14:39:18 +09:00
|
|
|
{
|
2023-01-11 23:50:47 +09:00
|
|
|
to: isHydrated.value ? `/${currentServer.value}/explore/users` : '/explore/users',
|
2023-01-13 03:35:26 +09:00
|
|
|
display: isHydrated.value ? t('tab.for_you') : '',
|
2023-01-15 17:38:02 +09:00
|
|
|
disabled: !isHydrated.value || !currentUser.value,
|
2022-12-26 14:39:18 +09:00
|
|
|
},
|
2023-01-25 03:52:48 +09:00
|
|
|
])
|
2022-11-17 22:09:05 +09:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-02-03 19:40:54 +09:00
|
|
|
<MainContent :no-overflow-hidden="isExtraLargeScreen" :back-on-small-screen="isExtraLargeScreen">
|
|
|
|
<template v-if="!isExtraLargeScreen" #title>
|
2023-01-05 08:17:30 +09:00
|
|
|
<span timeline-title-style flex items-center gap-2 cursor-pointer @click="$scrollToTop">
|
2022-11-30 05:15:53 +09:00
|
|
|
<div i-ri:hashtag />
|
2022-12-28 02:49:15 +09:00
|
|
|
<span>{{ t('nav.explore') }}</span>
|
2022-12-11 19:52:36 +09:00
|
|
|
</span>
|
2022-11-17 22:09:05 +09:00
|
|
|
</template>
|
2023-02-03 19:40:54 +09:00
|
|
|
<template v-else #title>
|
|
|
|
<SearchWidget v-if="isHydrated" ref="search" class="m-1" />
|
|
|
|
</template>
|
2022-11-24 15:42:26 +09:00
|
|
|
|
2022-12-11 19:52:36 +09:00
|
|
|
<template #header>
|
|
|
|
<CommonRouteTabs replace :options="tabs" />
|
|
|
|
</template>
|
2023-01-15 17:38:02 +09:00
|
|
|
<NuxtPage v-if="isHydrated" />
|
2022-11-17 22:09:05 +09:00
|
|
|
</MainContent>
|
|
|
|
</template>
|