Skip to content

Commit

Permalink
fix: apply headerTabsWhenNotLogin to all pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Astro-CQM committed Dec 1, 2023
1 parent 4f6091b commit 34387b2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
9 changes: 8 additions & 1 deletion packages/frontend/src/pages/flash/flash-index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only

<template>
<MkStickyContainer>
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<template #header><MkPageHeader v-model:tab="tab" :actions="$i ? headerActions : null" :tabs="$i ? headerTabs : headerTabsWhenNotLogin"/></template>
<MkSpacer :contentMax="700">
<div v-if="tab === 'featured'">
<MkPagination v-slot="{items}" :pagination="featuredFlashsPagination">
Expand Down Expand Up @@ -41,6 +41,7 @@ import { computed } from 'vue';
import MkFlashPreview from '@/components/MkFlashPreview.vue';
import MkPagination from '@/components/MkPagination.vue';
import { useRouter } from '@/router.js';
import { $i } from '@/account.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';

Expand Down Expand Up @@ -85,6 +86,12 @@ const headerTabs = $computed(() => [{
icon: 'ti ti-heart',
}]);

const headerTabsWhenNotLogin = $computed(() => [{
key: 'featured',
title: i18n.ts._play.featured,
icon: 'ti ti-flare',
}]);

definePageMetadata(computed(() => ({
title: 'Play',
icon: 'ti ti-player-play',
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/flash/flash.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="actions _panel">
<MkButton v-if="flash.isLiked" v-tooltip="i18n.ts.unlike" asLike class="button" rounded primary @click="unlike()"><i class="ti ti-heart"></i><span v-if="flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
<MkButton v-else v-tooltip="i18n.ts.like" asLike class="button" rounded @click="like()"><i class="ti ti-heart"></i><span v-if="flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
<MkButton v-tooltip="i18n.ts.shareWithNote" class="button" rounded @click="shareWithNote"><i class="ti ti-repeat ti-fw"></i></MkButton>
<MkButton v-if="$i !== null" v-tooltip="i18n.ts.shareWithNote" class="button" rounded @click="shareWithNote"><i class="ti ti-repeat ti-fw"></i></MkButton>
<MkButton v-tooltip="i18n.ts.copyLink" class="button" rounded @click="copyLink"><i class="ti ti-link ti-fw"></i></MkButton>
<MkButton v-if="isSupportShare()" v-tooltip="i18n.ts.share" class="button" rounded @click="share"><i class="ti ti-share ti-fw"></i></MkButton>
</div>
Expand Down
9 changes: 8 additions & 1 deletion packages/frontend/src/pages/gallery/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only

<template>
<MkStickyContainer>
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<template #header><MkPageHeader v-model:tab="tab" :actions="$i ? headerActions : null" :tabs="$i ? headerTabs : headerTabsWhenNotLogin"/></template>
<MkSpacer :contentMax="1400">
<div class="_root">
<div v-if="tab === 'explore'">
Expand Down Expand Up @@ -51,6 +51,7 @@ import MkFoldableSection from '@/components/MkFoldableSection.vue';
import MkPagination from '@/components/MkPagination.vue';
import MkGalleryPostPreview from '@/components/MkGalleryPostPreview.vue';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { $i } from '@/account.js';
import { i18n } from '@/i18n.js';
import { useRouter } from '@/router.js';

Expand Down Expand Up @@ -117,6 +118,12 @@ const headerTabs = $computed(() => [{
icon: 'ti ti-edit',
}]);

const headerTabsWhenNotLogin = $computed(() => [{
key: 'explore',
title: i18n.ts.gallery,
icon: 'ti ti-icons',
}]);

definePageMetadata({
title: i18n.ts.gallery,
icon: 'ti ti-icons',
Expand Down
9 changes: 8 additions & 1 deletion packages/frontend/src/pages/pages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only

<template>
<MkStickyContainer>
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<template #header><MkPageHeader v-model:tab="tab" :actions="$i ? headerActions : null" :tabs="$i ? headerTabs : headerTabsWhenNotLogin"/></template>
<MkSpacer :contentMax="700">
<div v-if="tab === 'featured'">
<MkPagination v-slot="{items}" :pagination="featuredPagesPagination">
Expand Down Expand Up @@ -40,6 +40,7 @@ import { computed } from 'vue';
import MkPagePreview from '@/components/MkPagePreview.vue';
import MkPagination from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue';
import { $i } from '@/account.js';
import { useRouter } from '@/router.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
Expand Down Expand Up @@ -85,6 +86,12 @@ const headerTabs = $computed(() => [{
icon: 'ti ti-heart',
}]);

const headerTabsWhenNotLogin = $computed(() => [{
key: 'featured',
title: i18n.ts._pages.featured,
icon: 'ti ti-flare',
}]);

definePageMetadata(computed(() => ({
title: i18n.ts.pages,
icon: 'ti ti-note',
Expand Down

0 comments on commit 34387b2

Please sign in to comment.