diff --git a/client/src/apiTypes.ts b/client/src/apiTypes.ts index f5665c185..d02a68677 100644 --- a/client/src/apiTypes.ts +++ b/client/src/apiTypes.ts @@ -23,8 +23,8 @@ export interface ApiAsset { id: AssetId; name: string; owner: string; - fileHash?: string; - children?: ApiAsset[]; + fileHash: string | null; + children: ApiAsset[] | null; shares: ApiAssetShare[]; } export interface ApiAssetShare { diff --git a/client/src/assets/ui/drag.ts b/client/src/assets/ui/drag.ts index bdbf398e5..a55984b71 100644 --- a/client/src/assets/ui/drag.ts +++ b/client/src/assets/ui/drag.ts @@ -68,7 +68,7 @@ async function onDrop(event: DragEvent): Promise { } } -function startDrag(event: DragEvent, file: AssetId, assetHash?: string): void { +function startDrag(event: DragEvent, file: AssetId, assetHash: string | null): void { if (event.dataTransfer === null) return; if (!canEdit(file, false)) { return; @@ -148,7 +148,7 @@ async function stopDrag(event: DragEvent, target: AssetId): Promise { export interface DragComposable { dragState: Ref; - startDrag: (event: DragEvent, file: AssetId, fileHash?: string) => void; + startDrag: (event: DragEvent, file: AssetId, fileHash: string | null) => void; moveDrag: (event: DragEvent) => void; leaveDrag: (event: DragEvent) => void; onDragEnd: (event: DragEvent) => void; diff --git a/client/src/dashboard/games/CreateGame.vue b/client/src/dashboard/games/CreateGame.vue index 72127aaa5..b279346f4 100644 --- a/client/src/dashboard/games/CreateGame.vue +++ b/client/src/dashboard/games/CreateGame.vue @@ -38,7 +38,7 @@ async function create(): Promise { async function setLogo(): Promise { const data = await modals.assetPicker(); - if (data === undefined || data.fileHash === undefined) return; + if (data === undefined || data.fileHash === null) return; logo.path = data.fileHash; logo.id = data.id; } diff --git a/client/src/dashboard/games/GameList.vue b/client/src/dashboard/games/GameList.vue index 1007bfd07..cb927e614 100644 --- a/client/src/dashboard/games/GameList.vue +++ b/client/src/dashboard/games/GameList.vue @@ -105,7 +105,7 @@ async function setLogo(): Promise { logo: data.id, }); if (success.ok) { - state.focussed.logo = data.fileHash; + state.focussed.logo = data.fileHash ?? undefined; } } diff --git a/client/src/game/dropAsset.ts b/client/src/game/dropAsset.ts index db888483c..481918d2d 100644 --- a/client/src/game/dropAsset.ts +++ b/client/src/game/dropAsset.ts @@ -40,8 +40,7 @@ export async function handleDropEvent(event: DragEvent): Promise { // External files are dropped if (!transferInfo && event.dataTransfer.files.length > 0) { for (const asset of await assetSystem.upload(event.dataTransfer.files, { target: () => assetState.raw.root })) { - if (asset.fileHash !== undefined) - await dropHelper({ assetHash: asset.fileHash, assetId: asset.id }, location); + if (asset.fileHash !== null) await dropHelper({ assetHash: asset.fileHash, assetId: asset.id }, location); } } else if (transferInfo) { const assetInfo = JSON.parse(transferInfo) as { diff --git a/client/src/game/ui/settings/floor/PatternSettings.vue b/client/src/game/ui/settings/floor/PatternSettings.vue index 73e2aeb15..f16b4b591 100644 --- a/client/src/game/ui/settings/floor/PatternSettings.vue +++ b/client/src/game/ui/settings/floor/PatternSettings.vue @@ -27,7 +27,7 @@ const backgroundPattern = computed(() => getPattern(props.pattern) ?? defaultPat async function setPatternImage(): Promise { const data = await modals.assetPicker(); - if (data === undefined || data.fileHash === undefined) return; + if (data === undefined || data.fileHash === null) return; emit("update:pattern", patternToString({ ...backgroundPattern.value, hash: data.fileHash })); } diff --git a/client/src/game/ui/settings/shape/ExtraSettings.vue b/client/src/game/ui/settings/shape/ExtraSettings.vue index 785203c37..a24bf92f5 100644 --- a/client/src/game/ui/settings/shape/ExtraSettings.vue +++ b/client/src/game/ui/settings/shape/ExtraSettings.vue @@ -47,7 +47,7 @@ const showSvgSection = computed(() => gameState.reactive.isDm && activeShapeStor async function uploadSvg(): Promise { const asset = await modals.assetPicker(); - if (asset === undefined || asset.fileHash === undefined) return; + if (asset === undefined || asset.fileHash === null) return; const shape = getShape(activeShapeStore.state.id!); if (shape === undefined) return; @@ -165,18 +165,24 @@ function applyDDraft(): void {