Skip to content

Commit

Permalink
fix: make nav button label setting reactive
Browse files Browse the repository at this point in the history
  • Loading branch information
shuuji3 committed Jan 1, 2025
1 parent 411fcc8 commit fe99f78
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 26 deletions.
3 changes: 1 addition & 2 deletions components/nav/button/Bookmark.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ defineProps<{
}>()
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
<NuxtLink to="/bookmarks" :aria-label="$t('nav.bookmarks')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:bookmark-line />
<span v-if="!hideLabel" text-xs>{{ $t('nav.bookmarks') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.bookmarks') }}</span>
</NuxtLink>
</template>
4 changes: 2 additions & 2 deletions components/nav/button/Compose.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ defineProps<{
}>()
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
// const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
<NuxtLink to="/compose" :aria-label="$t('nav.favourites')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:quill-pen-line />
<span v-if="!hideLabel" text-xs>{{ $t('nav.favourites') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.favourites') }}</span>
</NuxtLink>
</template>
3 changes: 1 addition & 2 deletions components/nav/button/Explore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ defineProps<{
const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, '')
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
Expand All @@ -20,6 +19,6 @@ const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
@click="$scrollToTop"
>
<div i-ri:compass-3-line />
<span v-if="!hideLabel" text-xs>{{ $t('nav.explore') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.explore') }}</span>
</NuxtLink>
</template>
3 changes: 1 addition & 2 deletions components/nav/button/Favorite.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ defineProps<{
}>()
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
<NuxtLink to="/favourites" :aria-label="$t('nav.favourites')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:heart-line />
<span v-if="!hideLabel" text-xs>{{ $t('nav.favourites') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.favourites') }}</span>
</NuxtLink>
</template>
3 changes: 1 addition & 2 deletions components/nav/button/Federated.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ defineProps<{
}>()
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
<NuxtLink :to="`/${currentServer}/public`" :aria-label="$t('nav.federated')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:earth-line />
<span v-if="!hideLabel" text-xs>{{ $t('nav.federated') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.federated') }}</span>
</NuxtLink>
</template>
3 changes: 1 addition & 2 deletions components/nav/button/Hashtag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ defineProps<{
}>()
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
<NuxtLink to="/hashtags" :aria-label="$t('nav.hashtags')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:hashtag />
<span v-if="!hideLabel" text-xs>{{ $t('nav.hashtags') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.hashtags') }}</span>
</NuxtLink>
</template>
3 changes: 1 addition & 2 deletions components/nav/button/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ defineProps<{
}>()
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
<NuxtLink to="/home" :aria-label="$t('nav.home')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:home-5-line />
<span v-if="!hideLabel" text-xs>{{ $t('nav.home') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.home') }}</span>
</NuxtLink>
</template>
3 changes: 1 addition & 2 deletions components/nav/button/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ defineProps<{
}>()
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
Expand All @@ -16,6 +15,6 @@ const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
class="coarse-pointer:select-none" @click="$scrollToTop"
>
<div i-ri:list-check />
<span v-if="!hideLabel" text-xs>{{ $t('nav.lists') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.lists') }}</span>
</NuxtLink>
</template>
3 changes: 1 addition & 2 deletions components/nav/button/Local.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ defineProps<{
}>()
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
Expand All @@ -16,6 +15,6 @@ const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
@click="$scrollToTop"
>
<div i-ri:group-2-line />
<span v-if="!hideLabel" text-xs>{{ $t('nav.local') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.local') }}</span>
</NuxtLink>
</template>
3 changes: 1 addition & 2 deletions components/nav/button/Mention.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ defineProps<{
}>()
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
Expand All @@ -15,6 +14,6 @@ const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
@click="$scrollToTop"
>
<div i-ri:at-line />
<span v-if="!hideLabel" text-xs>{{ $t('nav.conversations') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.conversations') }}</span>
</NuxtLink>
</template>
3 changes: 1 addition & 2 deletions components/nav/button/MoreMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
const model = defineModel<boolean>()
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
Expand All @@ -17,7 +16,7 @@ const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
@click="toggleVisible"
>
<span :class="show ? 'i-ri:close-fill' : 'i-ri:more-fill'" />
<span v-if="!hideLabel" text-xs>{{ $t('nav.more_menu') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.more_menu') }}</span>
</button>
</NavBottomMoreMenu>
</template>
3 changes: 1 addition & 2 deletions components/nav/button/Notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const { notifications } = useNotifications()
const lastAccessedNotificationRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE, '')
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
Expand All @@ -19,6 +18,6 @@ const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
{{ notifications < 10 ? notifications : '•' }}
</div>
</div>
<span v-if="!hideLabel" text-xs>{{ $t('nav.notifications') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.notifications') }}</span>
</NuxtLink>
</template>
3 changes: 1 addition & 2 deletions components/nav/button/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ defineProps<{
}>()
const userSettings = useUserSettings()
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
</script>

<template>
<NuxtLink to="/search" :aria-label="$t('nav.search')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:search-line />
<span v-if="!hideLabel" text-xs>{{ $t('nav.search') }}</span>
<span v-if="!getPreferences(userSettings, 'hideBottomNavLabel')" text-xs>{{ $t('nav.search') }}</span>
</NuxtLink>
</template>

0 comments on commit fe99f78

Please sign in to comment.