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"
|
||||
decoding="async"
|
||||
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" />
|
||||
<div class="absolute inset-x-0 top-0 flex items-start justify-between p-2">
|
||||
<span v-if="thumbBlurred(still)" class="sensitive-glow pointer-events-none absolute inset-0 opacity-80" />
|
||||
<div class="absolute inset-x-0 top-0 z-10 flex items-start justify-between p-2">
|
||||
<button
|
||||
v-if="stillHidden(still)"
|
||||
v-if="privacy"
|
||||
type="button"
|
||||
class="rounded-full bg-zinc-950/80 p-1.5 text-amber-100 hover:bg-zinc-900"
|
||||
:title="isRevealed(still.id) ? 'Hide thumbnail' : 'Reveal thumbnail'"
|
||||
@click.stop="toggleReveal(still.id)"
|
||||
class="rounded-full bg-zinc-950/80 p-1.5 text-amber-100 hover:bg-zinc-900 disabled:opacity-50"
|
||||
:title="still.hideInput ? 'Show thumbnail' : 'Hide thumbnail'"
|
||||
: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">
|
||||
<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" />
|
||||
</template>
|
||||
<template v-else>
|
||||
@@ -212,11 +213,13 @@ const props = withDefaults(defineProps<{
|
||||
stills: PickerStill[]
|
||||
folderId: string
|
||||
hideInputPreview?: boolean
|
||||
privacy?: boolean
|
||||
heading?: string
|
||||
stillOnly?: boolean
|
||||
open?: boolean
|
||||
}>(), {
|
||||
open: true
|
||||
open: true,
|
||||
privacy: false
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -236,6 +239,7 @@ const revealAll = ref(false)
|
||||
const revealedIds = ref<string[]>([])
|
||||
const picking = ref(false)
|
||||
const keepingId = ref('')
|
||||
const hidingId = ref('')
|
||||
const renamingId = ref('')
|
||||
const renameDraft = ref('')
|
||||
const renameInput = ref<HTMLInputElement | null>(null)
|
||||
@@ -273,28 +277,31 @@ const pickerHint = computed(() => {
|
||||
const hasHiddenItems = computed(() => visibleStills.value.some(still => stillHidden(still)))
|
||||
|
||||
function stillHidden(still: PickerStill) {
|
||||
return still.hideInput === true || props.hideInputPreview === true
|
||||
return still.hideInput === true
|
||||
}
|
||||
|
||||
function isRevealed(id: string) {
|
||||
return revealAll.value || revealedIds.value.includes(id)
|
||||
}
|
||||
|
||||
function toggleReveal(id: string) {
|
||||
if (revealAll.value) {
|
||||
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 thumbBlurred(still: PickerStill) {
|
||||
return stillHidden(still) && !isRevealed(still.id)
|
||||
}
|
||||
|
||||
function visibleHiddenIds() {
|
||||
return visibleStills.value.filter(still => stillHidden(still)).map(still => still.id)
|
||||
async function toggleHidden(still: PickerStill) {
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user