2023-06-10 21:06:13 +02:00
|
|
|
<script lang="ts">
|
2023-07-01 00:50:47 -04:00
|
|
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
2023-08-03 11:44:12 -04:00
|
|
|
import type { AssetInteractionStore } from '$lib/stores/asset-interaction.store';
|
2024-03-21 13:14:13 +01:00
|
|
|
import { type AssetStore, isSelectingAllAssets } from '$lib/stores/assets.store';
|
2024-05-07 22:05:19 -05:00
|
|
|
import { mdiSelectAll, mdiSelectRemove } from '@mdi/js';
|
2024-03-21 13:14:13 +01:00
|
|
|
import { selectAllAssets } from '$lib/utils/asset-utils';
|
2023-08-01 04:27:56 +03:00
|
|
|
|
|
|
|
|
export let assetStore: AssetStore;
|
|
|
|
|
export let assetInteractionStore: AssetInteractionStore;
|
2023-06-10 21:06:13 +02:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
const handleSelectAll = async () => {
|
2024-03-21 13:14:13 +01:00
|
|
|
await selectAllAssets(assetStore, assetInteractionStore);
|
|
|
|
|
};
|
2023-08-01 04:27:56 +03:00
|
|
|
|
2024-03-21 13:14:13 +01:00
|
|
|
const handleCancel = () => {
|
|
|
|
|
$isSelectingAllAssets = false;
|
2024-05-07 22:05:19 -05:00
|
|
|
assetInteractionStore.clearMultiselect();
|
2023-07-01 00:50:47 -04:00
|
|
|
};
|
2023-06-10 21:06:13 +02:00
|
|
|
</script>
|
|
|
|
|
|
2024-03-21 13:14:13 +01:00
|
|
|
{#if $isSelectingAllAssets}
|
2024-05-07 22:05:19 -05:00
|
|
|
<CircleIconButton title="Unselect all" icon={mdiSelectRemove} on:click={handleCancel} />
|
2024-03-21 13:14:13 +01:00
|
|
|
{:else}
|
2023-10-25 09:48:25 -04:00
|
|
|
<CircleIconButton title="Select all" icon={mdiSelectAll} on:click={handleSelectAll} />
|
2023-06-10 21:06:13 +02:00
|
|
|
{/if}
|