diff --git a/resources/js/components/gallery/AlbumHero.vue b/resources/js/components/gallery/AlbumHero.vue index b69a2b57ac3..e8ce2ed2db1 100644 --- a/resources/js/components/gallery/AlbumHero.vue +++ b/resources/js/components/gallery/AlbumHero.vue @@ -59,6 +59,24 @@ > +
(); +console.log(props.hasHidden); const emits = defineEmits<{ "open-sharing-modal": []; "open-statistics": []; diff --git a/resources/js/components/headers/AlbumsHeader.vue b/resources/js/components/headers/AlbumsHeader.vue index 2858bd9e577..984c28923c4 100644 --- a/resources/js/components/headers/AlbumsHeader.vue +++ b/resources/js/components/headers/AlbumsHeader.vue @@ -112,6 +112,7 @@ const props = defineProps<{ back_button_url: string; login_button_position: string; }; + hasHidden: boolean; }>(); const emits = defineEmits<{ @@ -279,13 +280,13 @@ const menu = computed(() => icon: "pi pi-eye-slash", type: "fn", callback: () => (lycheeStore.are_nsfw_visible = false), - if: isTouchDevice() && lycheeStore.are_nsfw_visible, + if: isTouchDevice() && props.hasHidden && lycheeStore.are_nsfw_visible, }, { icon: "pi pi-eye", type: "fn", callback: () => (lycheeStore.are_nsfw_visible = true), - if: isTouchDevice() && !lycheeStore.are_nsfw_visible, + if: isTouchDevice() && props.hasHidden && !lycheeStore.are_nsfw_visible, }, ].filter((item) => item.if), ) as ComputedRef; diff --git a/resources/js/composables/album/albumRefresher.ts b/resources/js/composables/album/albumRefresher.ts index a22bd9b80c7..eff2598d760 100644 --- a/resources/js/composables/album/albumRefresher.ts +++ b/resources/js/composables/album/albumRefresher.ts @@ -11,6 +11,7 @@ export function useAlbumRefresher(albumId: Ref, auth: AuthStore, isLogin const smartAlbum = ref(undefined); const album = computed(() => modelAlbum.value || tagAlbum.value || smartAlbum.value); const isAlbumConsented = ref(false); + const hasHidden = computed(() => modelAlbum.value !== undefined && modelAlbum.value.albums.filter((album) => album.is_nsfw).length > 0); const photos = ref([]); const config = ref(undefined); @@ -76,6 +77,7 @@ export function useAlbumRefresher(albumId: Ref, auth: AuthStore, isLogin rights, photos, config, + hasHidden, loadUser, loadAlbum, refresh, diff --git a/resources/js/composables/album/albumsRefresher.ts b/resources/js/composables/album/albumsRefresher.ts index ab3d749f570..8cc3266c95b 100644 --- a/resources/js/composables/album/albumsRefresher.ts +++ b/resources/js/composables/album/albumsRefresher.ts @@ -15,6 +15,7 @@ export function useAlbumsRefresher(auth: AuthStore, lycheeStore: LycheeStateStor const rootConfig = ref(undefined); const rootRights = ref(undefined); const selectableAlbums = computed(() => albums.value.concat(sharedAlbums.value.map((album) => album.data).flat())); + const hasHidden = computed(() => selectableAlbums.value.filter((album) => album.is_nsfw).length > 0); function refresh(): Promise<[void, void]> { isLoading.value = true; @@ -73,6 +74,7 @@ export function useAlbumsRefresher(auth: AuthStore, lycheeStore: LycheeStateStor rootConfig, rootRights, selectableAlbums, + hasHidden, refresh, }; } diff --git a/resources/js/views/gallery-panels/Album.vue b/resources/js/views/gallery-panels/Album.vue index 6182a457b95..0e69f517615 100644 --- a/resources/js/views/gallery-panels/Album.vue +++ b/resources/js/views/gallery-panels/Album.vue @@ -38,7 +38,13 @@ >{{ $t("lychee.UPLOAD_PHOTO") }}
- +