mirror of
https://github.com/immich-app/immich.git
synced 2024-12-28 06:31:58 +00:00
chore(web): move enum out of .svelte file (#14144)
* chore(web): clean up todo task * chore(web): move enums out of .svelte file
This commit is contained in:
parent
d6a70bc7e5
commit
d1085e8a02
8 changed files with 26 additions and 31 deletions
|
@ -1,8 +1,9 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { shortcuts } from '$lib/actions/shortcut';
|
import { shortcuts } from '$lib/actions/shortcut';
|
||||||
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
||||||
import ProgressBar, { ProgressBarStatus } from '$lib/components/shared-components/progress-bar/progress-bar.svelte';
|
import ProgressBar from '$lib/components/shared-components/progress-bar/progress-bar.svelte';
|
||||||
import SlideshowSettings from '$lib/components/slideshow-settings.svelte';
|
import SlideshowSettings from '$lib/components/slideshow-settings.svelte';
|
||||||
|
import { ProgressBarStatus } from '$lib/constants';
|
||||||
import { SlideshowNavigation, slideshowStore } from '$lib/stores/slideshow.store';
|
import { SlideshowNavigation, slideshowStore } from '$lib/stores/slideshow.store';
|
||||||
import { mdiChevronLeft, mdiChevronRight, mdiClose, mdiCog, mdiFullscreen, mdiPause, mdiPlay } from '@mdi/js';
|
import { mdiChevronLeft, mdiChevronRight, mdiClose, mdiCog, mdiFullscreen, mdiPause, mdiPlay } from '@mdi/js';
|
||||||
import { onDestroy, onMount } from 'svelte';
|
import { onDestroy, onMount } from 'svelte';
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
<script lang="ts" module>
|
|
||||||
const enum ToggleVisibility {
|
|
||||||
HIDE_ALL = 'hide-all',
|
|
||||||
HIDE_UNNANEMD = 'hide-unnamed',
|
|
||||||
SHOW_ALL = 'show-all',
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { shortcut } from '$lib/actions/shortcut';
|
import { shortcut } from '$lib/actions/shortcut';
|
||||||
import ImageThumbnail from '$lib/components/assets/thumbnail/image-thumbnail.svelte';
|
import ImageThumbnail from '$lib/components/assets/thumbnail/image-thumbnail.svelte';
|
||||||
|
@ -23,6 +15,7 @@
|
||||||
import { mdiClose, mdiEye, mdiEyeOff, mdiEyeSettings, mdiRestart } from '@mdi/js';
|
import { mdiClose, mdiEye, mdiEyeOff, mdiEyeSettings, mdiRestart } from '@mdi/js';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
||||||
|
import { ToggleVisibility } from '$lib/constants';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
people: PersonResponseDto[];
|
people: PersonResponseDto[];
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
<script module lang="ts">
|
|
||||||
export enum ProgressBarStatus {
|
|
||||||
Playing = 'playing',
|
|
||||||
Paused = 'paused',
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { ProgressBarStatus } from '$lib/constants';
|
||||||
import { handlePromiseError } from '$lib/utils';
|
import { handlePromiseError } from '$lib/utils';
|
||||||
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
|
@ -2,12 +2,7 @@
|
||||||
import type { SearchLocationFilter } from './search-location-section.svelte';
|
import type { SearchLocationFilter } from './search-location-section.svelte';
|
||||||
import type { SearchDisplayFilters } from './search-display-section.svelte';
|
import type { SearchDisplayFilters } from './search-display-section.svelte';
|
||||||
import type { SearchDateFilter } from './search-date-section.svelte';
|
import type { SearchDateFilter } from './search-date-section.svelte';
|
||||||
|
import { MediaType } from '$lib/constants';
|
||||||
export enum MediaType {
|
|
||||||
All = 'all',
|
|
||||||
Image = 'image',
|
|
||||||
Video = 'video',
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SearchFilter = {
|
export type SearchFilter = {
|
||||||
query: string;
|
query: string;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import RadioButton from '$lib/components/elements/radio-button.svelte';
|
import RadioButton from '$lib/components/elements/radio-button.svelte';
|
||||||
import { MediaType } from './search-filter-modal.svelte';
|
import { MediaType } from '$lib/constants';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
@ -360,3 +360,20 @@ export enum PersonPageViewMode {
|
||||||
BIRTH_DATE = 'birth-date',
|
BIRTH_DATE = 'birth-date',
|
||||||
UNASSIGN_ASSETS = 'unassign-faces',
|
UNASSIGN_ASSETS = 'unassign-faces',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum MediaType {
|
||||||
|
All = 'all',
|
||||||
|
Image = 'image',
|
||||||
|
Video = 'video',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum ProgressBarStatus {
|
||||||
|
Playing = 'playing',
|
||||||
|
Paused = 'paused',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum ToggleVisibility {
|
||||||
|
HIDE_ALL = 'hide-all',
|
||||||
|
HIDE_UNNANEMD = 'hide-unnamed',
|
||||||
|
SHOW_ALL = 'show-all',
|
||||||
|
}
|
||||||
|
|
|
@ -18,16 +18,12 @@
|
||||||
|
|
||||||
let { data }: Props = $props();
|
let { data }: Props = $props();
|
||||||
|
|
||||||
enum Field {
|
const getFieldItems = (items: SearchExploreResponseDto[], field: string) => {
|
||||||
CITY = 'exifInfo.city',
|
|
||||||
}
|
|
||||||
|
|
||||||
const getFieldItems = (items: SearchExploreResponseDto[], field: Field) => {
|
|
||||||
const targetField = items.find((item) => item.fieldName === field);
|
const targetField = items.find((item) => item.fieldName === field);
|
||||||
return targetField?.items || [];
|
return targetField?.items || [];
|
||||||
};
|
};
|
||||||
|
|
||||||
let places = $derived(getFieldItems(data.items, Field.CITY));
|
let places = $derived(getFieldItems(data.items, 'exifInfo.city'));
|
||||||
let people = $state(data.response.people);
|
let people = $state(data.response.people);
|
||||||
|
|
||||||
let hasPeople = $derived(data.response.total > 0);
|
let hasPeople = $derived(data.response.total > 0);
|
||||||
|
|
|
@ -9,8 +9,7 @@ process.env.PUBLIC_IMMICH_PAY_HOST = process.env.PUBLIC_IMMICH_PAY_HOST || 'http
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
// TODO: migrate all enums to .ts files and remove `{script: true}` once
|
preprocess: vitePreprocess(),
|
||||||
preprocess: vitePreprocess({ script: true }),
|
|
||||||
kit: {
|
kit: {
|
||||||
adapter: adapter({
|
adapter: adapter({
|
||||||
fallback: 'index.html',
|
fallback: 'index.html',
|
||||||
|
|
Loading…
Reference in a new issue