디렉터리 페이지에 상위 디렉터리로 이동 버튼 추가

This commit is contained in:
static
2025-12-27 03:04:09 +09:00
parent 9eb67d5877
commit 576d41da7f
5 changed files with 48 additions and 8 deletions

View File

@@ -3,6 +3,7 @@
import { IconLabel } from "$lib/components/molecules";
import IconFolder from "~icons/material-symbols/folder";
import IconDriveFolderUpload from "~icons/material-symbols/drive-folder-upload";
import IconDraft from "~icons/material-symbols/draft";
interface Props {
@@ -11,7 +12,7 @@
subtext?: string;
textClass?: ClassValue;
thumbnail?: string;
type: "directory" | "file";
type: "directory" | "parent-directory" | "file";
}
let {
@@ -30,6 +31,8 @@
<img src={thumbnail} alt={name} loading="lazy" class="aspect-square rounded object-cover" />
{:else if type === "directory"}
<IconFolder />
{:else if type === "parent-directory"}
<IconDriveFolderUpload class="text-yellow-500" />
{:else}
<IconDraft class="text-blue-400" />
{/if}

View File

@@ -23,6 +23,7 @@ import { trpc } from "$trpc/client";
export type DirectoryInfo =
| {
id: "root";
parentId?: undefined;
dataKey?: undefined;
dataKeyVersion?: undefined;
name?: undefined;
@@ -31,6 +32,7 @@ export type DirectoryInfo =
}
| {
id: number;
parentId: DirectoryId;
dataKey?: CryptoKey;
dataKeyVersion?: Date;
name: string;
@@ -93,7 +95,13 @@ const fetchDirectoryInfoFromIndexedDB = async (
info.set({ id, subDirectoryIds, fileIds });
} else {
if (!directory) return;
info.set({ id, name: directory.name, subDirectoryIds, fileIds });
info.set({
id,
parentId: directory.parentId,
name: directory.name,
subDirectoryIds,
fileIds,
});
}
};
@@ -124,6 +132,7 @@ const fetchDirectoryInfoFromServer = async (
info.set({
id,
parentId: metadata!.parent,
dataKey,
dataKeyVersion: new Date(metadata!.dekVersion),
name,