1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02: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:
Alex 2024-11-14 09:41:11 -06:00 committed by GitHub
parent d6a70bc7e5
commit d1085e8a02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 26 additions and 31 deletions

View File

@ -1,8 +1,9 @@
<script lang="ts">
import { shortcuts } from '$lib/actions/shortcut';
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 { ProgressBarStatus } from '$lib/constants';
import { SlideshowNavigation, slideshowStore } from '$lib/stores/slideshow.store';
import { mdiChevronLeft, mdiChevronRight, mdiClose, mdiCog, mdiFullscreen, mdiPause, mdiPlay } from '@mdi/js';
import { onDestroy, onMount } from 'svelte';

View File

@ -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">
import { shortcut } from '$lib/actions/shortcut';
import ImageThumbnail from '$lib/components/assets/thumbnail/image-thumbnail.svelte';
@ -23,6 +15,7 @@
import { mdiClose, mdiEye, mdiEyeOff, mdiEyeSettings, mdiRestart } from '@mdi/js';
import { t } from 'svelte-i18n';
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
import { ToggleVisibility } from '$lib/constants';
interface Props {
people: PersonResponseDto[];

View File

@ -1,11 +1,5 @@
<script module lang="ts">
export enum ProgressBarStatus {
Playing = 'playing',
Paused = 'paused',
}
</script>
<script lang="ts">
import { ProgressBarStatus } from '$lib/constants';
import { handlePromiseError } from '$lib/utils';
import { onMount } from 'svelte';

View File

@ -2,12 +2,7 @@
import type { SearchLocationFilter } from './search-location-section.svelte';
import type { SearchDisplayFilters } from './search-display-section.svelte';
import type { SearchDateFilter } from './search-date-section.svelte';
export enum MediaType {
All = 'all',
Image = 'image',
Video = 'video',
}
import { MediaType } from '$lib/constants';
export type SearchFilter = {
query: string;

View File

@ -1,6 +1,6 @@
<script lang="ts">
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';
interface Props {

View File

@ -360,3 +360,20 @@ export enum PersonPageViewMode {
BIRTH_DATE = 'birth-date',
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',
}

View File

@ -18,16 +18,12 @@
let { data }: Props = $props();
enum Field {
CITY = 'exifInfo.city',
}
const getFieldItems = (items: SearchExploreResponseDto[], field: Field) => {
const getFieldItems = (items: SearchExploreResponseDto[], field: string) => {
const targetField = items.find((item) => item.fieldName === field);
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 hasPeople = $derived(data.response.total > 0);

View File

@ -9,8 +9,7 @@ process.env.PUBLIC_IMMICH_PAY_HOST = process.env.PUBLIC_IMMICH_PAY_HOST || 'http
/** @type {import('@sveltejs/kit').Config} */
const config = {
// TODO: migrate all enums to .ts files and remove `{script: true}` once
preprocess: vitePreprocess({ script: true }),
preprocess: vitePreprocess(),
kit: {
adapter: adapter({
fallback: 'index.html',