mirror of
https://github.com/immich-app/immich.git
synced 2026-03-08 02:57:48 +03:00
* chore(web): another missing translations * unused removed * more keys * lint fix * test fixed * dynamic translation fix * fixes * people search translation * params fixed * keep filter setting fix * lint fix * $t fixes * Update web/src/lib/i18n/en.json Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> * another missing * activity translation * link sharing translations * expiration dropdown fix - didn't work localized * notification title * device logout * search results * reset to default * unsaved change * select from computer * selected * select-2 * select-3 * unmerge * pluralize, force icu message * Update web/src/lib/components/asset-viewer/asset-viewer.svelte Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> * review fixes * remove user * plural fixes * ffmpeg settings * fixes * error title * plural fixes * onboarding * change password * more more * console log fix * another * api key desc * map marker * format fix * key fix * asset-utils * utils * misc --------- Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com>
60 lines
2.0 KiB
Svelte
60 lines
2.0 KiB
Svelte
<script lang="ts">
|
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
|
import { getKey } from '$lib/utils';
|
|
import { handleError } from '$lib/utils/handle-error';
|
|
import { removeSharedLinkAssets, type SharedLinkResponseDto } from '@immich/sdk';
|
|
import { mdiDeleteOutline } from '@mdi/js';
|
|
import { NotificationType, notificationController } from '../../shared-components/notification/notification';
|
|
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
|
|
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
|
import { t } from 'svelte-i18n';
|
|
|
|
export let sharedLink: SharedLinkResponseDto;
|
|
|
|
const { getAssets, clearSelect } = getAssetControlContext();
|
|
|
|
const handleRemove = async () => {
|
|
const isConfirmed = await dialogController.show({
|
|
id: 'remove-from-shared-link',
|
|
title: $t('remove_assets_title'),
|
|
prompt: $t('remove_assets_shared_link_confirmation', { values: { count: getAssets().size } }),
|
|
confirmText: $t('remove'),
|
|
});
|
|
|
|
if (!isConfirmed) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const results = await removeSharedLinkAssets({
|
|
id: sharedLink.id,
|
|
assetIdsDto: {
|
|
assetIds: [...getAssets()].map((asset) => asset.id),
|
|
},
|
|
key: getKey(),
|
|
});
|
|
|
|
for (const result of results) {
|
|
if (!result.success) {
|
|
continue;
|
|
}
|
|
|
|
sharedLink.assets = sharedLink.assets.filter((asset) => asset.id !== result.assetId);
|
|
}
|
|
|
|
const count = results.filter((item) => item.success).length;
|
|
|
|
notificationController.show({
|
|
type: NotificationType.Info,
|
|
message: $t('assets_removed_count', { values: { count: count } }),
|
|
});
|
|
|
|
clearSelect();
|
|
} catch (error) {
|
|
handleError(error, $t('errors.unable_to_remove_assets_from_shared_link'));
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<CircleIconButton title={$t('remove_from_shared_link')} on:click={handleRemove} icon={mdiDeleteOutline} />
|