카테고리 페이지에서, 하위 카테고리에만 등록된 파일인 경우 삭제 버튼을 표시하지 않도록 변경

This commit is contained in:
static
2025-01-22 23:19:06 +09:00
parent a1fbea3e45
commit b48b9719ca
2 changed files with 23 additions and 14 deletions

View File

@@ -9,7 +9,7 @@
interface Props {
info: Writable<FileInfo | null>;
onclick: (selectedFile: SelectedFile) => void;
onRemoveClick: (selectedFile: SelectedFile) => void;
onRemoveClick?: (selectedFile: SelectedFile) => void;
}
let { info, onclick, onRemoveClick }: Props = $props();
@@ -30,7 +30,7 @@
if (!dataKey || !dataKeyVersion) return; // TODO: Error handling
setTimeout(() => {
onRemoveClick({ id, dataKey, dataKeyVersion, name });
onRemoveClick!({ id, dataKey, dataKeyVersion, name });
}, 100);
};
</script>
@@ -46,13 +46,15 @@
<p title={$info.name} class="flex-grow truncate font-medium">
{$info.name}
</p>
<button
id="remove-file"
onclick={removeFile}
class="flex-shrink-0 rounded-full p-1 active:bg-gray-100"
>
<IconClose class="text-lg" />
</button>
{#if onRemoveClick}
<button
id="remove-file"
onclick={removeFile}
class="flex-shrink-0 rounded-full p-1 active:bg-gray-100"
>
<IconClose class="text-lg" />
</button>
{/if}
</div>
</div>
{/if}