mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-21 17:05:22 +03:00
feat: add 'use star favorite icon' preference (#2067)
This commit is contained in:
parent
126cd4d535
commit
582a9847a1
9 changed files with 37 additions and 10 deletions
|
@ -16,6 +16,7 @@ const isSelf = $(useSelfAccount(() => account))
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const { client } = $(useMasto())
|
const { client } = $(useMasto())
|
||||||
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
|
|
||||||
async function toggleMute() {
|
async function toggleMute() {
|
||||||
if (!relationship!.muting && await openConfirmDialog({
|
if (!relationship!.muting && await openConfirmDialog({
|
||||||
|
@ -198,7 +199,7 @@ async function removeUserNote() {
|
||||||
<CommonDropdownItem :text="$t('account.pinned')" icon="i-ri:pushpin-line" :command="command" />
|
<CommonDropdownItem :text="$t('account.pinned')" icon="i-ri:pushpin-line" :command="command" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink to="/favourites">
|
<NuxtLink to="/favourites">
|
||||||
<CommonDropdownItem :text="$t('account.favourites')" icon="i-ri:heart-3-line" :command="command" />
|
<CommonDropdownItem :text="$t('account.favourites')" :icon="useStarFavoriteIcon ? 'i-ri:star-line' : 'i-ri:heart-3-line'" :command="command" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink to="/mutes">
|
<NuxtLink to="/mutes">
|
||||||
<CommonDropdownItem :text="$t('account.muted_users')" icon="i-ri:volume-mute-line" :command="command" />
|
<CommonDropdownItem :text="$t('account.muted_users')" icon="i-ri:volume-mute-line" :command="command" />
|
||||||
|
|
|
@ -3,6 +3,7 @@ const { command } = defineProps<{
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>()
|
||||||
const { notifications } = useNotifications()
|
const { notifications } = useNotifications()
|
||||||
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -22,7 +23,7 @@ const { notifications } = useNotifications()
|
||||||
</template>
|
</template>
|
||||||
</NavSideItem>
|
</NavSideItem>
|
||||||
<NavSideItem :text="$t('nav.conversations')" to="/conversations" icon="i-ri:at-line" user-only :command="command" />
|
<NavSideItem :text="$t('nav.conversations')" to="/conversations" icon="i-ri:at-line" user-only :command="command" />
|
||||||
<NavSideItem :text="$t('nav.favourites')" to="/favourites" icon="i-ri:heart-3-line" user-only :command="command" />
|
<NavSideItem :text="$t('nav.favourites')" to="/favourites" :icon="useStarFavoriteIcon ? 'i-ri:star-line' : 'i-ri:heart-3-line'" user-only :command="command" />
|
||||||
<NavSideItem :text="$t('nav.bookmarks')" to="/bookmarks" icon="i-ri:bookmark-line" user-only :command="command" />
|
<NavSideItem :text="$t('nav.bookmarks')" to="/bookmarks" icon="i-ri:bookmark-line" user-only :command="command" />
|
||||||
<NavSideItem :text="$t('action.compose')" to="/compose" icon="i-ri:quill-pen-line" user-only :command="command" />
|
<NavSideItem :text="$t('action.compose')" to="/compose" icon="i-ri:quill-pen-line" user-only :command="command" />
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ const focusEditor = inject<typeof noop>('focus-editor', noop)
|
||||||
const { details, command } = $(props)
|
const { details, command } = $(props)
|
||||||
|
|
||||||
const userSettings = useUserSettings()
|
const userSettings = useUserSettings()
|
||||||
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
|
|
||||||
const {
|
const {
|
||||||
status,
|
status,
|
||||||
|
@ -77,9 +78,11 @@ function reply() {
|
||||||
<StatusActionButton
|
<StatusActionButton
|
||||||
:content="$t('action.favourite')"
|
:content="$t('action.favourite')"
|
||||||
:text="!getPreferences(userSettings, 'hideFavoriteCount') && status.favouritesCount ? status.favouritesCount : ''"
|
:text="!getPreferences(userSettings, 'hideFavoriteCount') && status.favouritesCount ? status.favouritesCount : ''"
|
||||||
color="text-rose" hover="text-rose" elk-group-hover="bg-rose/10"
|
:color="useStarFavoriteIcon ? 'text-yellow' : 'text-rose'"
|
||||||
icon="i-ri:heart-3-line"
|
:hover="useStarFavoriteIcon ? 'text-yellow' : 'text-rose'"
|
||||||
active-icon="i-ri:heart-3-fill"
|
:elk-group-hover="useStarFavoriteIcon ? 'bg-yellow/10' : 'bg-rose/10'"
|
||||||
|
:icon="useStarFavoriteIcon ? 'i-ri:star-line' : 'i-ri:heart-3-line'"
|
||||||
|
:active-icon="useStarFavoriteIcon ? 'i-ri:star-fill' : 'i-ri:heart-3-fill'"
|
||||||
:active="!!status.favourited"
|
:active="!!status.favourited"
|
||||||
:disabled="isLoading.favourited"
|
:disabled="isLoading.favourited"
|
||||||
:command="command"
|
:command="command"
|
||||||
|
@ -97,7 +100,9 @@ function reply() {
|
||||||
<div flex-none>
|
<div flex-none>
|
||||||
<StatusActionButton
|
<StatusActionButton
|
||||||
:content="$t('action.bookmark')"
|
:content="$t('action.bookmark')"
|
||||||
color="text-yellow" hover="text-yellow" elk-group-hover="bg-yellow/10"
|
:color="useStarFavoriteIcon ? 'text-rose' : 'text-yellow'"
|
||||||
|
:hover="useStarFavoriteIcon ? 'text-rose' : 'text-yellow'"
|
||||||
|
:elk-group-hover="useStarFavoriteIcon ? 'bg-rose/10' : 'bg-yellow/10' "
|
||||||
icon="i-ri:bookmark-line"
|
icon="i-ri:bookmark-line"
|
||||||
active-icon="i-ri:bookmark-fill"
|
active-icon="i-ri:bookmark-fill"
|
||||||
:active="!!status.bookmarked"
|
:active="!!status.bookmarked"
|
||||||
|
|
|
@ -28,6 +28,7 @@ const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const userSettings = useUserSettings()
|
const userSettings = useUserSettings()
|
||||||
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
|
|
||||||
const isAuthor = $computed(() => status.account.id === currentUser.value?.account.id)
|
const isAuthor = $computed(() => status.account.id === currentUser.value?.account.id)
|
||||||
|
|
||||||
|
@ -149,8 +150,13 @@ function showFavoritedAndBoostedBy() {
|
||||||
|
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
:text="status.favourited ? $t('action.favourited') : $t('action.favourite')"
|
:text="status.favourited ? $t('action.favourited') : $t('action.favourite')"
|
||||||
:icon="status.favourited ? 'i-ri:heart-3-fill' : 'i-ri:heart-3-line'"
|
:icon="useStarFavoriteIcon
|
||||||
:class="status.favourited ? 'text-rose' : ''"
|
? status.favourited ? 'i-ri:star-fill' : 'i-ri:star-line'
|
||||||
|
: status.favourited ? 'i-ri:heart-3-fill' : 'i-ri:heart-3-line'"
|
||||||
|
:class="status.favourited
|
||||||
|
? useStarFavoriteIcon ? 'text-yellow' : 'text-rose'
|
||||||
|
: ''
|
||||||
|
"
|
||||||
:command="command"
|
:command="command"
|
||||||
:disabled="isLoading.favourited"
|
:disabled="isLoading.favourited"
|
||||||
@click="toggleFavourite()"
|
@click="toggleFavourite()"
|
||||||
|
@ -159,7 +165,10 @@ function showFavoritedAndBoostedBy() {
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
:text="status.bookmarked ? $t('action.bookmarked') : $t('action.bookmark')"
|
:text="status.bookmarked ? $t('action.bookmarked') : $t('action.bookmark')"
|
||||||
:icon="status.bookmarked ? 'i-ri:bookmark-fill' : 'i-ri:bookmark-line'"
|
:icon="status.bookmarked ? 'i-ri:bookmark-fill' : 'i-ri:bookmark-line'"
|
||||||
:class="status.bookmarked ? 'text-yellow' : ''"
|
:class="status.bookmarked
|
||||||
|
? useStarFavoriteIcon ? 'text-rose' : 'text-yellow'
|
||||||
|
: ''
|
||||||
|
"
|
||||||
:command="command"
|
:command="command"
|
||||||
:disabled="isLoading.bookmarked"
|
:disabled="isLoading.bookmarked"
|
||||||
@click="toggleBookmark()"
|
@click="toggleBookmark()"
|
||||||
|
|
|
@ -21,6 +21,7 @@ export interface PreferencesSettings {
|
||||||
enableAutoplay: boolean
|
enableAutoplay: boolean
|
||||||
enableDataSaving: boolean
|
enableDataSaving: boolean
|
||||||
enablePinchToZoom: boolean
|
enablePinchToZoom: boolean
|
||||||
|
useStarFavoriteIcon: boolean
|
||||||
zenMode: boolean
|
zenMode: boolean
|
||||||
experimentalVirtualScroller: boolean
|
experimentalVirtualScroller: boolean
|
||||||
experimentalGitHubCards: boolean
|
experimentalGitHubCards: boolean
|
||||||
|
@ -72,6 +73,7 @@ export const DEFAULT__PREFERENCES_SETTINGS: PreferencesSettings = {
|
||||||
enableAutoplay: true,
|
enableAutoplay: true,
|
||||||
enableDataSaving: false,
|
enableDataSaving: false,
|
||||||
enablePinchToZoom: false,
|
enablePinchToZoom: false,
|
||||||
|
useStarFavoriteIcon: false,
|
||||||
zenMode: false,
|
zenMode: false,
|
||||||
experimentalVirtualScroller: true,
|
experimentalVirtualScroller: true,
|
||||||
experimentalGitHubCards: true,
|
experimentalGitHubCards: true,
|
||||||
|
|
|
@ -454,6 +454,7 @@
|
||||||
"hide_username_emojis_description": "Hides emojis from usernames in timelines. Emojis will still be visible in their profiles.",
|
"hide_username_emojis_description": "Hides emojis from usernames in timelines. Emojis will still be visible in their profiles.",
|
||||||
"label": "Preferences",
|
"label": "Preferences",
|
||||||
"title": "Experimental Features",
|
"title": "Experimental Features",
|
||||||
|
"use_star_favorite_icon": "Use star favorite icon",
|
||||||
"user_picker": "User Picker",
|
"user_picker": "User Picker",
|
||||||
"virtual_scroll": "Virtual Scrolling",
|
"virtual_scroll": "Virtual Scrolling",
|
||||||
"wellbeing": "Wellbeing",
|
"wellbeing": "Wellbeing",
|
||||||
|
|
|
@ -454,6 +454,7 @@
|
||||||
"hide_username_emojis_description": "タイムライン上でユーザー名に含まれる絵文字を隠します。プロフィールでは絵文字は引き続き表示されます。",
|
"hide_username_emojis_description": "タイムライン上でユーザー名に含まれる絵文字を隠します。プロフィールでは絵文字は引き続き表示されます。",
|
||||||
"label": "環境設定",
|
"label": "環境設定",
|
||||||
"title": "実験的機能",
|
"title": "実験的機能",
|
||||||
|
"use_star_favorite_icon": "星のお気に入りアイコンを使用する",
|
||||||
"user_picker": "ユーザーピッカー",
|
"user_picker": "ユーザーピッカー",
|
||||||
"virtual_scroll": "仮想スクロール",
|
"virtual_scroll": "仮想スクロール",
|
||||||
"wellbeing": "ウェルビーイング",
|
"wellbeing": "ウェルビーイング",
|
||||||
|
|
|
@ -4,6 +4,7 @@ definePageMeta({
|
||||||
})
|
})
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
|
|
||||||
useHydratedHead({
|
useHydratedHead({
|
||||||
title: () => t('nav.favourites'),
|
title: () => t('nav.favourites'),
|
||||||
|
@ -14,7 +15,7 @@ useHydratedHead({
|
||||||
<MainContent>
|
<MainContent>
|
||||||
<template #title>
|
<template #title>
|
||||||
<NuxtLink to="/favourites" timeline-title-style flex items-center gap-2 @click="$scrollToTop">
|
<NuxtLink to="/favourites" timeline-title-style flex items-center gap-2 @click="$scrollToTop">
|
||||||
<div i-ri:heart-3-line />
|
<div :class="useStarFavoriteIcon ? 'i-ri:star-line' : 'i-ri:heart-3-line'" />
|
||||||
<span>{{ t('nav.favourites') }}</span>
|
<span>{{ t('nav.favourites') }}</span>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -49,6 +49,12 @@ const userSettings = useUserSettings()
|
||||||
>
|
>
|
||||||
{{ $t('settings.preferences.enable_pinch_to_zoom') }}
|
{{ $t('settings.preferences.enable_pinch_to_zoom') }}
|
||||||
</SettingsToggleItem>
|
</SettingsToggleItem>
|
||||||
|
<SettingsToggleItem
|
||||||
|
:checked="getPreferences(userSettings, 'useStarFavoriteIcon')"
|
||||||
|
@click="togglePreferences('useStarFavoriteIcon')"
|
||||||
|
>
|
||||||
|
{{ $t('settings.preferences.use_star_favorite_icon') }}
|
||||||
|
</SettingsToggleItem>
|
||||||
<h2 px6 py4 mt2 font-bold text-xl flex="~ gap-1" items-center>
|
<h2 px6 py4 mt2 font-bold text-xl flex="~ gap-1" items-center>
|
||||||
<div i-ri-hearts-line />
|
<div i-ri-hearts-line />
|
||||||
{{ $t('settings.preferences.wellbeing') }}
|
{{ $t('settings.preferences.wellbeing') }}
|
||||||
|
|
Loading…
Reference in a new issue