Let every XAI input thumbnail toggle hide, not only ones already flagged.
The picker hid the eye on unflagged stills, so a visible input could not be concealed. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -100,19 +100,20 @@
|
|||||||
loading="lazy"
|
loading="lazy"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
class="h-full w-full object-cover"
|
class="h-full w-full object-cover"
|
||||||
:class="stillHidden(still) && !isRevealed(still.id) ? 'scale-110 blur-xl' : ''"
|
:class="thumbBlurred(still) ? 'scale-110 blur-xl' : ''"
|
||||||
>
|
>
|
||||||
<span v-if="stillHidden(still) && !isRevealed(still.id)" class="sensitive-glow pointer-events-none absolute inset-0 opacity-80" />
|
<span v-if="thumbBlurred(still)" class="sensitive-glow pointer-events-none absolute inset-0 opacity-80" />
|
||||||
<div class="absolute inset-x-0 top-0 flex items-start justify-between p-2">
|
<div class="absolute inset-x-0 top-0 z-10 flex items-start justify-between p-2">
|
||||||
<button
|
<button
|
||||||
v-if="stillHidden(still)"
|
v-if="privacy"
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded-full bg-zinc-950/80 p-1.5 text-amber-100 hover:bg-zinc-900"
|
class="rounded-full bg-zinc-950/80 p-1.5 text-amber-100 hover:bg-zinc-900 disabled:opacity-50"
|
||||||
:title="isRevealed(still.id) ? 'Hide thumbnail' : 'Reveal thumbnail'"
|
:title="still.hideInput ? 'Show thumbnail' : 'Hide thumbnail'"
|
||||||
@click.stop="toggleReveal(still.id)"
|
:disabled="hidingId === still.id"
|
||||||
|
@click.stop="toggleHidden(still)"
|
||||||
>
|
>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="h-4 w-4">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="h-4 w-4">
|
||||||
<template v-if="isRevealed(still.id)">
|
<template v-if="!still.hideInput">
|
||||||
<path stroke-linecap="round" d="M3 3l18 18M10.6 10.6a2 2 0 102.8 2.8M9.9 5.1A9.8 9.8 0 0121 12a9.8 9.8 0 01-1.7 2.9M6.1 6.1A9.8 9.8 0 003 12a9.8 9.8 0 0012.9 6.1" />
|
<path stroke-linecap="round" d="M3 3l18 18M10.6 10.6a2 2 0 102.8 2.8M9.9 5.1A9.8 9.8 0 0121 12a9.8 9.8 0 01-1.7 2.9M6.1 6.1A9.8 9.8 0 003 12a9.8 9.8 0 0012.9 6.1" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
@@ -212,11 +213,13 @@ const props = withDefaults(defineProps<{
|
|||||||
stills: PickerStill[]
|
stills: PickerStill[]
|
||||||
folderId: string
|
folderId: string
|
||||||
hideInputPreview?: boolean
|
hideInputPreview?: boolean
|
||||||
|
privacy?: boolean
|
||||||
heading?: string
|
heading?: string
|
||||||
stillOnly?: boolean
|
stillOnly?: boolean
|
||||||
open?: boolean
|
open?: boolean
|
||||||
}>(), {
|
}>(), {
|
||||||
open: true
|
open: true,
|
||||||
|
privacy: false
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@@ -236,6 +239,7 @@ const revealAll = ref(false)
|
|||||||
const revealedIds = ref<string[]>([])
|
const revealedIds = ref<string[]>([])
|
||||||
const picking = ref(false)
|
const picking = ref(false)
|
||||||
const keepingId = ref('')
|
const keepingId = ref('')
|
||||||
|
const hidingId = ref('')
|
||||||
const renamingId = ref('')
|
const renamingId = ref('')
|
||||||
const renameDraft = ref('')
|
const renameDraft = ref('')
|
||||||
const renameInput = ref<HTMLInputElement | null>(null)
|
const renameInput = ref<HTMLInputElement | null>(null)
|
||||||
@@ -273,28 +277,31 @@ const pickerHint = computed(() => {
|
|||||||
const hasHiddenItems = computed(() => visibleStills.value.some(still => stillHidden(still)))
|
const hasHiddenItems = computed(() => visibleStills.value.some(still => stillHidden(still)))
|
||||||
|
|
||||||
function stillHidden(still: PickerStill) {
|
function stillHidden(still: PickerStill) {
|
||||||
return still.hideInput === true || props.hideInputPreview === true
|
return still.hideInput === true
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRevealed(id: string) {
|
function isRevealed(id: string) {
|
||||||
return revealAll.value || revealedIds.value.includes(id)
|
return revealAll.value || revealedIds.value.includes(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleReveal(id: string) {
|
function thumbBlurred(still: PickerStill) {
|
||||||
if (revealAll.value) {
|
return stillHidden(still) && !isRevealed(still.id)
|
||||||
revealAll.value = false
|
|
||||||
revealedIds.value = visibleHiddenIds().filter(item => item !== id)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (revealedIds.value.includes(id)) {
|
|
||||||
revealedIds.value = revealedIds.value.filter(item => item !== id)
|
|
||||||
} else {
|
|
||||||
revealedIds.value = [...revealedIds.value, id]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function visibleHiddenIds() {
|
async function toggleHidden(still: PickerStill) {
|
||||||
return visibleStills.value.filter(still => stillHidden(still)).map(still => still.id)
|
if (hidingId.value) return
|
||||||
|
hidingId.value = still.id
|
||||||
|
try {
|
||||||
|
emit('updated', await $fetch(`/api/library/stills/${still.id}`, {
|
||||||
|
method: 'PATCH',
|
||||||
|
body: { hideInput: still.hideInput !== true }
|
||||||
|
}))
|
||||||
|
revealedIds.value = revealedIds.value.filter(id => id !== still.id)
|
||||||
|
} catch (error: any) {
|
||||||
|
emit('error', error?.data?.statusMessage || 'Could not update thumbnail')
|
||||||
|
} finally {
|
||||||
|
hidingId.value = ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleRevealAll() {
|
function toggleRevealAll() {
|
||||||
|
|||||||
@@ -2071,6 +2071,7 @@
|
|||||||
:stills="stills"
|
:stills="stills"
|
||||||
:folder-id="folderId"
|
:folder-id="folderId"
|
||||||
:hide-input-preview="hideInputPreview"
|
:hide-input-preview="hideInputPreview"
|
||||||
|
:privacy="showPrivacyToggles"
|
||||||
:heading="pickerHeading"
|
:heading="pickerHeading"
|
||||||
:still-only="permanencePicker"
|
:still-only="permanencePicker"
|
||||||
@close="pickerOpen = false"
|
@close="pickerOpen = false"
|
||||||
|
|||||||
@@ -21,8 +21,5 @@ export default defineEventHandler(async (event) => {
|
|||||||
else await renameStill(owner, id, body.name || '')
|
else await renameStill(owner, id, body.name || '')
|
||||||
}
|
}
|
||||||
if (hasHide) setStillHidden(owner, id, body.hideInput === true, family)
|
if (hasHide) setStillHidden(owner, id, body.hideInput === true, family)
|
||||||
if (hasHide && !folderId && !hasName) {
|
|
||||||
return { id, hideInput: body.hideInput === true }
|
|
||||||
}
|
|
||||||
return publicLibrary(event)
|
return publicLibrary(event)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user