1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-20 07:49:57 +00:00
elk/pages/[[server]]/explore.vue

57 lines
1.5 KiB
Vue
Raw Normal View History

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