사소한 리팩토링

This commit is contained in:
static
2026-01-18 12:03:24 +09:00
parent bcb57bb12d
commit 14693160b8
10 changed files with 17 additions and 24 deletions

View File

@@ -9,8 +9,8 @@
class?: ClassValue; class?: ClassValue;
onclick?: () => void; onclick?: () => void;
onRemoveClick?: () => void; onRemoveClick?: () => void;
selected?: boolean;
removable?: boolean; removable?: boolean;
selected?: boolean;
} }
let { let {
@@ -38,7 +38,7 @@
<span> <span>
{@render children()} {@render children()}
</span> </span>
{#if selected && removable} {#if removable && selected}
<button <button
onclick={(e) => { onclick={(e) => {
e.stopPropagation(); e.stopPropagation();

View File

@@ -24,7 +24,7 @@
<div class="h-full w-full bg-gray-100"></div> <div class="h-full w-full bg-gray-100"></div>
{/if} {/if}
{#if info.isFavorite} {#if info.isFavorite}
<div class={["absolute bottom-0.5 right-0.5", !thumbnail && "rounded-full bg-white p-0.5"]}> <div class={["absolute bottom-0.5 right-0.5"]}>
<IconFavorite <IconFavorite
class="text-sm text-red-500" class="text-sm text-red-500"
style="filter: drop-shadow(0 0 1px white) drop-shadow(0 0 1px white)" style="filter: drop-shadow(0 0 1px white) drop-shadow(0 0 1px white)"

View File

@@ -25,9 +25,9 @@
{#if showBackButton} {#if showBackButton}
<button <button
onclick={onBackClick ?? (() => history.back())} onclick={onBackClick ?? (() => history.back())}
class="w-[2.3rem] flex-shrink-0 rounded-full p-1 active:bg-black active:bg-opacity-[0.04]" class="w-full rounded-full p-1 text-2xl active:bg-black active:bg-opacity-[0.04]"
> >
<IconArrowBack class="text-2xl" /> <IconArrowBack />
</button> </button>
{/if} {/if}
</div> </div>

View File

@@ -77,12 +77,8 @@
}; };
const toggleFavorite = async () => { const toggleFavorite = async () => {
if (!info?.exists) return; await requestFavoriteToggle(data.id, !!info?.isFavorite);
const isFavorite = !!info.isFavorite; void getFileInfo(data.id, $masterKeyStore?.get(1)?.key!); // TODO: FIXME
const success = await requestFavoriteToggle(data.id, isFavorite);
if (success) {
info.isFavorite = !isFavorite;
}
}; };
$effect(() => { $effect(() => {
@@ -154,9 +150,9 @@
<div onclick={(e) => e.stopPropagation()}> <div onclick={(e) => e.stopPropagation()}>
<button <button
onclick={() => (isMenuOpen = !isMenuOpen)} onclick={() => (isMenuOpen = !isMenuOpen)}
class="w-[2.3rem] flex-shrink-0 rounded-full p-1 active:bg-black active:bg-opacity-[0.04]" class="w-full rounded-full p-1 text-2xl active:bg-black active:bg-opacity-[0.04]"
> >
<IconMoreVert class="text-2xl" /> <IconMoreVert />
</button> </button>
<TopBarMenu <TopBarMenu
bind:isOpen={isMenuOpen} bind:isOpen={isMenuOpen}

View File

@@ -46,7 +46,7 @@
{#if isOpen && (directoryId || downloadUrl || fileBlob)} {#if isOpen && (directoryId || downloadUrl || fileBlob)}
<div <div
class="absolute right-2 top-full z-20 min-w-44 space-y-1 rounded-lg bg-white px-1 py-2 shadow-2xl" class="absolute right-2 top-full z-20 min-w-40 space-y-1 rounded-lg bg-white px-1 py-2 shadow-2xl"
transition:fly={{ y: -8, duration: 200 }} transition:fly={{ y: -8, duration: 200 }}
> >
<p class="px-3 pt-2 text-sm font-semibold text-gray-600">더보기</p> <p class="px-3 pt-2 text-sm font-semibold text-gray-600">더보기</p>
@@ -57,16 +57,14 @@
onclick: () => void, onclick: () => void,
)} )}
<button {onclick} class="rounded-xl active:bg-gray-100"> <button {onclick} class="rounded-xl active:bg-gray-100">
<div <div class="flex items-center gap-x-3 px-3 py-2 text-gray-700 transition active:scale-95">
class="flex items-center gap-x-3 px-3 py-2 text-lg text-gray-700 transition active:scale-95"
>
<Icon /> <Icon />
<p class="font-medium">{text}</p> <p class="font-medium">{text}</p>
</div> </div>
</button> </button>
{/snippet} {/snippet}
{#if typeof isFavorite === "boolean"} {#if isFavorite !== undefined}
{@render menuButton( {@render menuButton(
isFavorite ? IconFavorite : IconFavoriteOutline, isFavorite ? IconFavorite : IconFavoriteOutline,
isFavorite ? "즐겨찾기 해제" : "즐겨찾기", isFavorite ? "즐겨찾기 해제" : "즐겨찾기",

View File

@@ -58,6 +58,7 @@ export const requestFavoriteToggle = async (fileId: number, isFavorite: boolean)
} }
return true; return true;
} catch { } catch {
// TODO: Error Handling
return false; return false;
} }
}; };

View File

@@ -56,8 +56,7 @@ export const requestLegacyFiles = async (
), ),
), ),
); );
return files;
return files as MaybeFileInfo[];
}; };
const createState = (status: MigrationStatus): MigrationState => { const createState = (status: MigrationStatus): MigrationState => {

View File

@@ -61,8 +61,7 @@ export const requestMissingThumbnailFiles = async (
), ),
), ),
); );
return files;
return files as MaybeFileInfo[];
}; };
const requestThumbnailUpload = limitFunction( const requestThumbnailUpload = limitFunction(

View File

@@ -24,7 +24,7 @@
id: info.id, id: info.id,
dataKey: info.dataKey, dataKey: info.dataKey,
name: info.name, name: info.name,
isFavorite: info.isFavorite ?? false, isFavorite: info.isFavorite,
}); });
}; };
</script> </script>

View File

@@ -20,7 +20,7 @@
id: info.id, id: info.id,
dataKey: info.dataKey, dataKey: info.dataKey,
name: info.name, name: info.name,
isFavorite: info.isFavorite ?? false, isFavorite: info.isFavorite,
}); });
}; };
</script> </script>