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