From 4eaf24eea90b33b1426933a94f028a11247c77df Mon Sep 17 00:00:00 2001 From: clear Date: Sun, 21 Dec 2025 23:25:55 +0800 Subject: [PATCH] feat(local-settings): show_gallery_thumbnails --- src/lang/en/home.json | 5 +++++ src/pages/home/folder/Folder.tsx | 6 +++--- src/store/local_settings.ts | 6 ++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/lang/en/home.json b/src/lang/en/home.json index 29c30a0e7..c98dfaeb7 100644 --- a/src/lang/en/home.json +++ b/src/lang/en/home.json @@ -164,6 +164,11 @@ "direct": "Direct", "dblclick": "Double click", "disable_while_checked": "Disable while checked" + }, + "show_gallery_thumbnails": "Show gallery thumbnails", + "show_gallery_thumbnails_options": { + "none": "None", + "visible": "Visible" } }, "package_download": { diff --git a/src/pages/home/folder/Folder.tsx b/src/pages/home/folder/Folder.tsx index e769e38ed..ce15e4ccd 100644 --- a/src/pages/home/folder/Folder.tsx +++ b/src/pages/home/folder/Folder.tsx @@ -11,7 +11,7 @@ import { layout } from "~/store" import { ContextMenu } from "./context-menu" import { Pager } from "./Pager" import { useLink, useT } from "~/hooks" -import { objStore } from "~/store" +import { objStore, local } from "~/store" import { ObjType } from "~/types" import { bus } from "~/utils" import lightGallery from "lightgallery" @@ -39,7 +39,7 @@ const Folder = () => { dynamicGallery = lightGallery(document.createElement("div"), { addClass: "lightgallery-container", dynamic: true, - thumbnail: true, + thumbnail: local["show_gallery_thumbnails"] === "visible", plugins: [lgZoom, lgThumbnail, lgRotate, lgAutoplay, lgFullscreen], dynamicEl: images().map((obj) => { const raw = rawLink(obj, true) @@ -52,7 +52,7 @@ const Folder = () => { }) } createEffect( - on(images, () => { + on([images, () => local["show_gallery_thumbnails"]], () => { dynamicGallery?.destroy() dynamicGallery = undefined }), diff --git a/src/store/local_settings.ts b/src/store/local_settings.ts index 69325c787..d02d0d915 100644 --- a/src/store/local_settings.ts +++ b/src/store/local_settings.ts @@ -71,6 +71,12 @@ export const initialLocalSettings = [ default: "14", type: "number", }, + { + key: "show_gallery_thumbnails", + default: "visible", + type: "select", + options: ["none", "visible"], + }, ] export type LocalSetting = (typeof initialLocalSettings)[number] for (const setting of initialLocalSettings) {