Clear deleted stills from the stage and library detail pane.
The file and catalog row were already removed, but the selected object stayed on screen so its prompt could still be applied. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -120,7 +120,7 @@
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<aside v-if="detailAsset" class="lib-modal-detail">
|
||||
<aside v-if="entries.length && detailAsset" class="lib-modal-detail">
|
||||
<p class="lib-modal-detail-name">{{ detailLabel }}</p>
|
||||
<div v-if="detailAsset.kind !== 'track'" class="lib-modal-actions">
|
||||
<button type="button" @click="$emit('use-image', detailAsset)">Use image</button>
|
||||
@@ -228,19 +228,43 @@ const entries = computed(() => buildLibraryEntries({
|
||||
sort: 'date-desc'
|
||||
}))
|
||||
|
||||
const dismissedId = ref('')
|
||||
|
||||
function entryHasId(entry: LibraryEntry, id: string) {
|
||||
if (!id) return false
|
||||
if (entry.kind === 'clip' && entry.group) {
|
||||
return entry.group.head.id === id || entry.group.parts.some(part => part.id === id)
|
||||
}
|
||||
if (entry.kind === 'track' && entry.track) return entry.track.id === id
|
||||
if (entry.stillGroup) {
|
||||
return entry.stillGroup.head.id === id || entry.stillGroup.parts.some(part => part.id === id)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const focusedKey = computed(() => {
|
||||
const id = props.selected?.id
|
||||
if (!id) return ''
|
||||
const hit = entries.value.find(entry => assetFromEntry(entry)?.id === id)
|
||||
if (!id || id === dismissedId.value) return ''
|
||||
const hit = entries.value.find(entry => entryHasId(entry, id))
|
||||
return hit?.key || ''
|
||||
})
|
||||
|
||||
const detailAsset = computed(() => {
|
||||
if (props.selected) return props.selected
|
||||
if (!entries.value.length) return null
|
||||
const id = String(props.selected?.id || '')
|
||||
if (id && id === dismissedId.value) return null
|
||||
if (id) {
|
||||
const hit = entries.value.find(entry => entryHasId(entry, id))
|
||||
return hit ? assetFromEntry(hit) : null
|
||||
}
|
||||
const first = entries.value[0]
|
||||
return first ? assetFromEntry(first) : null
|
||||
})
|
||||
|
||||
watch(() => props.selected?.id, (id) => {
|
||||
if (id && id !== dismissedId.value) dismissedId.value = ''
|
||||
})
|
||||
|
||||
const detailLabel = computed(() => assetLabel(detailAsset.value))
|
||||
|
||||
const detailRows = computed(() => {
|
||||
@@ -297,6 +321,12 @@ function useAndClose() {
|
||||
function onDeleteClick() {
|
||||
const asset = detailAsset.value
|
||||
if (!asset?.id) return
|
||||
const id = String(asset.id)
|
||||
dismissedId.value = id
|
||||
stills.value = stills.value.filter(item => item.id !== id)
|
||||
clips.value = clips.value.filter(item => item.id !== id)
|
||||
tracks.value = tracks.value.filter(item => item.id !== id)
|
||||
emit('select', null)
|
||||
emit('delete', asset)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user