From 8f04ea8eeef6ed055ddc599b584aa94bff6d2054 Mon Sep 17 00:00:00 2001 From: lazzzis Date: Thu, 4 Apr 2024 03:27:52 -0700 Subject: [PATCH] feat(ui): improve gif support (#2752) --- components/modal/ModalMediaPreviewCarousel.vue | 10 ++++++++-- components/status/StatusAttachment.vue | 16 +++++++++++++--- composables/settings/definition.ts | 2 ++ locales/en.json | 2 ++ pages/settings/preferences/index.vue | 6 ++++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/components/modal/ModalMediaPreviewCarousel.vue b/components/modal/ModalMediaPreviewCarousel.vue index f3141205..12c201ec 100644 --- a/components/modal/ModalMediaPreviewCarousel.vue +++ b/components/modal/ModalMediaPreviewCarousel.vue @@ -36,6 +36,8 @@ const isPinching = ref(false) const maxZoomOut = ref(1) const isZoomedIn = computed(() => scale.value > 1) +const enableAutoplay = usePreferences('enableAutoplay') + function goToFocusedSlide() { scale.value = 1 x.value = slide.value[modelValue.value].offsetLeft * scale.value @@ -264,8 +266,12 @@ const imageStyle = computed(() => ({ items-center justify-center > - ({ :draggable="false" :src="item.url || item.previewUrl" :alt="item.description || ''" - > + /> diff --git a/components/status/StatusAttachment.vue b/components/status/StatusAttachment.vue index 674a9f2b..f59fad42 100644 --- a/components/status/StatusAttachment.vue +++ b/components/status/StatusAttachment.vue @@ -68,6 +68,7 @@ const video = ref() const prefersReducedMotion = usePreferredReducedMotion() const isAudio = computed(() => attachment.type === 'audio') const isVideo = computed(() => attachment.type === 'video') +const isGif = computed(() => attachment.type === 'gifv') const enableAutoplay = usePreferences('enableAutoplay') @@ -164,7 +165,7 @@ watch(shouldLoadAttachment, () => {
- + +
diff --git a/composables/settings/definition.ts b/composables/settings/definition.ts index 15afdf4b..54c7b9cc 100644 --- a/composables/settings/definition.ts +++ b/composables/settings/definition.ts @@ -9,6 +9,7 @@ export type ColorMode = 'light' | 'dark' | 'system' export interface PreferencesSettings { hideAltIndicatorOnPosts: boolean + hideGifIndicatorOnPosts: boolean hideBoostCount: boolean hideReplyCount: boolean hideFavoriteCount: boolean @@ -64,6 +65,7 @@ export function getDefaultLanguage(languages: string[]) { export const DEFAULT__PREFERENCES_SETTINGS: PreferencesSettings = { hideAltIndicatorOnPosts: false, + hideGifIndicatorOnPosts: false, hideBoostCount: false, hideReplyCount: false, hideFavoriteCount: false, diff --git a/locales/en.json b/locales/en.json index 397f9a08..74e124a4 100644 --- a/locales/en.json +++ b/locales/en.json @@ -542,6 +542,7 @@ "hide_boost_count": "Hide boost count", "hide_favorite_count": "Hide favorite count", "hide_follower_count": "Hide following/follower count", + "hide_gif_indi_on_posts": "Hide gif indicator on posts", "hide_news": "Hide news", "hide_reply_count": "Hide reply count", "hide_tag_hover_card": "Hide tag hover card", @@ -614,6 +615,7 @@ "favourited_by": "Favorited By", "filter_hidden_phrase": "Filtered by", "filter_show_anyway": "Show anyway", + "gif": "GIF", "img_alt": { "ALT": "ALT", "desc": "Description", diff --git a/pages/settings/preferences/index.vue b/pages/settings/preferences/index.vue index b3a86c2f..b0d6d235 100644 --- a/pages/settings/preferences/index.vue +++ b/pages/settings/preferences/index.vue @@ -21,6 +21,12 @@ const userSettings = useUserSettings() > {{ $t('settings.preferences.hide_alt_indi_on_posts') }} + + {{ $t('settings.preferences.hide_gif_indi_on_posts') }} +