From d057e23a32717339022f3544ecfd9e59b98a9e1f Mon Sep 17 00:00:00 2001 From: Alan Grainger Date: Thu, 4 Jun 2026 11:15:41 +1200 Subject: [PATCH] Move icons to separate file --- app/src/client/icons.ts | 23 +++++++++++++++++++++++ app/src/client/lightbox-ui.ts | 3 ++- app/src/client/sidebar.ts | 3 ++- app/src/client/state.ts | 21 ++------------------- app/src/client/tiles.ts | 3 ++- 5 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 app/src/client/icons.ts diff --git a/app/src/client/icons.ts b/app/src/client/icons.ts new file mode 100644 index 0000000..a4aef6f --- /dev/null +++ b/app/src/client/icons.ts @@ -0,0 +1,23 @@ +// Inline SVG icons used across the gallery client. All paths are from +// Material Design Icons (Apache 2.0) - the same set Immich uses for its +// own viewer, so the UI vocabulary stays consistent with the upstream app. +// +// PhotoSwipe toolbar buttons need `class="pswp__icn"` for the lightbox's +// built-in sizing; other surfaces (sidebar field rows, selection check) +// use plain SVGs and the consumer's own CSS. + +export const ICON_DOWNLOAD = '' +export const ICON_FULLSCREEN = '' +export const ICON_FULLSCREEN_EXIT = '' +export const ICON_INFO = '' +export const ICON_BACK = '' +export const ICON_CLOSE = '' + +// Sidebar field rows (file / camera / lens / map) +export const ICON_IMAGE = '' +export const ICON_CAMERA = '' +export const ICON_IRIS = '' +export const ICON_MAP = '' + +// Check glyph shown inside selected tiles' checkmark circle +export const CHECK_SVG = '' diff --git a/app/src/client/lightbox-ui.ts b/app/src/client/lightbox-ui.ts index a901db5..34966a5 100644 --- a/app/src/client/lightbox-ui.ts +++ b/app/src/client/lightbox-ui.ts @@ -2,7 +2,8 @@ // download button, fullscreen toggle. Each is gated by config or feature // detection. The info sidebar lives in `sidebar.ts`. -import { state, ICON_BACK, ICON_DOWNLOAD, ICON_FULLSCREEN, ICON_FULLSCREEN_EXIT } from './state.js' +import { state } from './state.js' +import { ICON_BACK, ICON_DOWNLOAD, ICON_FULLSCREEN, ICON_FULLSCREEN_EXIT } from './icons.js' // PhotoSwipe types are not bundled with the project. These two interfaces // describe just enough of the surface we touch to keep the rest of the file diff --git a/app/src/client/sidebar.ts b/app/src/client/sidebar.ts index c6d487e..2d16143 100644 --- a/app/src/client/sidebar.ts +++ b/app/src/client/sidebar.ts @@ -4,7 +4,8 @@ // button top-left, sections only render when their data is present. Toggled // by the toolbar info button or the `i` key, persisted via localStorage. -import { state, ICON_INFO, ICON_CLOSE, ICON_IMAGE, ICON_CAMERA, ICON_IRIS, ICON_MAP, SIDEBAR_STORAGE_KEY } from './state.js' +import { state, SIDEBAR_STORAGE_KEY } from './state.js' +import { ICON_INFO, ICON_CLOSE, ICON_IMAGE, ICON_CAMERA, ICON_IRIS, ICON_MAP } from './icons.js' import type { GalleryItem, GalleryExif } from '../shared/types.js' // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/app/src/client/state.ts b/app/src/client/state.ts index 0547891..b0abda3 100644 --- a/app/src/client/state.ts +++ b/app/src/client/state.ts @@ -1,7 +1,7 @@ // Shared mutable state for the client gallery. Every module that touches // gallery-wide state goes through `state` rather than holding its own -// top-level `let`s. Constants and icon strings live here too because they -// are read by multiple modules. +// top-level `let`s. Layout / scroll-tuning constants live here too because +// they are read by multiple modules. SVG icon strings live in `icons.ts`. import type { GalleryItem, LightboxConfig, MetadataConfig } from '../shared/types.js' @@ -22,23 +22,6 @@ export const GROUP_GAP = 16 // Long-press threshold for entering select mode via touch/mouse export const LONG_PRESS_MS = 500 -// ----- icons ---------------------------------------------------------------- - -// MDI icons (Apache 2.0). Same icon set Immich uses for its viewer. -export const ICON_DOWNLOAD = '' -export const ICON_FULLSCREEN = '' -export const ICON_FULLSCREEN_EXIT = '' -export const ICON_INFO = '' -export const ICON_BACK = '' -export const ICON_CLOSE = '' -// MDI camera / iris / image icons for the sidebar field rows -export const ICON_IMAGE = '' -export const ICON_CAMERA = '' -export const ICON_IRIS = '' -export const ICON_MAP = '' -// Inline SVG for the check icon shown inside selected tiles' checkmark circle -export const CHECK_SVG = '' - // localStorage key for sidebar open state export const SIDEBAR_STORAGE_KEY = 'ipp-sidebar-open' // Width of the sidebar when docked (must match the CSS rule) diff --git a/app/src/client/tiles.ts b/app/src/client/tiles.ts index bdbbcc9..78b9a94 100644 --- a/app/src/client/tiles.ts +++ b/app/src/client/tiles.ts @@ -5,7 +5,8 @@ // @ts-expect-error - browser-only ESM URL import { thumbHashToDataURL } from '/share/static/thumbhash/thumbhash.js' // eslint-disable-line import/no-absolute-path -import { state, CHECK_SVG, LONG_PRESS_MS } from './state.js' +import { state, LONG_PRESS_MS } from './state.js' +import { CHECK_SVG } from './icons.js' import { enterSelectMode, toggleSelection } from './selection.js' import { openLightbox } from './lightbox.js'