High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
<script lang="ts">
import MenuOption from '#lib/components/shared-components/context-menu/MenuOption.svelte';
import { assetMultiSelectManager } from '#lib/managers/asset-multi-select-manager.svelte.ts';
import { authManager } from '#lib/managers/auth-manager.svelte.ts';
import GeolocationPointPickerModal from '#lib/modals/GeolocationPointPickerModal.svelte';
import { getOwnedAssetsWithWarning } from '#lib/utils/asset-utils.ts';
import { handleError } from '#lib/utils/handle-error.ts';
import { updateAssets } from '@immich/sdk';
import { modalManager, toastManager } from '@immich/ui';
import { mdiMapMarkerMultipleOutline } from '@mdi/js';
import { t } from 'svelte-i18n';
type Props = {
menuItem?: boolean;
};
let { menuItem = false }: Props = $props();
const onAction = async () => {
const point = await modalManager.show(GeolocationPointPickerModal, {});
if (!point) {
return;
}
const ids = getOwnedAssetsWithWarning(assetMultiSelectManager.assets, authManager.user);
try {
await updateAssets({ assetBulkUpdateDto: { ids, latitude: point.lat, longitude: point.lng } });
toastManager.primary();
assetMultiSelectManager.clear();
} catch (error) {
handleError(error, $t('errors.unable_to_update_location'));
}
};
</script>
{#if menuItem}
<MenuOption text={$t('change_location')} icon={mdiMapMarkerMultipleOutline} onClick={onAction} />
{/if}