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