Release v0.19.0. See the `## [0.19.0] — 2026-09-29` section of [CHANGELOG.md](https://github.com/ralksta/immich-folio/blob/dev/CHANGELOG.md) for the full list. Highlights: client proofing links (#683), custom content pages (#738), asset picker search (#740), concurrent-edit detection (#742), env-locked settings (#739), an accessibility baseline (#741), three security fixes with advisories (#737, #755, #759), and a pre-release quality pass (#780–#797). --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Ralf <rohlenbo79@gmail.com> Co-authored-by: Paul Thies <110185070+ImScheinox@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com> Co-authored-by: Lance Martin <lancetaylor95@gmail.com>
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
/**
|
|
* Selection state of the asset picker's multi-select mode (#602), as plain
|
|
* functions so it can be tested without rendering the picker.
|
|
*
|
|
* The selection is an ordered list: the order you click in is the order the
|
|
* photos land in (hero list, photo grid), so a Set would lose information.
|
|
*/
|
|
|
|
export interface SelectionRules {
|
|
/** Assets the caller already uses; they cannot be picked again. */
|
|
disabled?: ReadonlySet<string>;
|
|
/** Most assets the caller can take; undefined means no limit. */
|
|
max?: number;
|
|
}
|
|
|
|
/**
|
|
* The selection after toggling `id`: removed when present, appended when not,
|
|
* unchanged when it is disabled or the limit is reached. With `max: 1` a new
|
|
* pick replaces the old one, which is how a single slot should feel.
|
|
*/
|
|
export function toggleSelection(
|
|
selected: readonly string[],
|
|
id: string,
|
|
rules: SelectionRules = {},
|
|
): string[] {
|
|
if (selected.includes(id)) return selected.filter((s) => s !== id);
|
|
if (rules.disabled?.has(id)) return [...selected];
|
|
if (rules.max === 1) return [id];
|
|
if (rules.max !== undefined && selected.length >= rules.max) return [...selected];
|
|
return [...selected, id];
|
|
}
|
|
|
|
/** Whether another asset can still be added without deselecting one first. */
|
|
export function canSelectMore(selected: readonly string[], max?: number): boolean {
|
|
return max === undefined || max === 1 || selected.length < max;
|
|
}
|
|
|
|
/** Client-side filter for lists the server returns whole (an album's assets). */
|
|
export function matchesQuery(asset: { originalFileName: string }, query: string): boolean {
|
|
const q = query.trim().toLowerCase();
|
|
return q === '' || asset.originalFileName.toLowerCase().includes(q);
|
|
}
|