File size: 1,100 Bytes
e99e7c2
 
 
 
 
 
eb17509
e584c54
a1a6daf
 
 
e99e7c2
a1a6daf
 
 
e99e7c2
 
a4df227
 
e99e7c2
 
 
 
 
 
eb17509
 
e584c54
e99e7c2
eb17509
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<script lang="ts">
	import { base } from "$app/paths";
	import { afterNavigate, goto } from "$app/navigation";
	import { useSettingsStore } from "$lib/stores/settings";
	import CarbonCheckmark from "~icons/carbon/checkmark";

	import Modal from "$lib/components/Modal.svelte";

	interface Props {
		children?: import("svelte").Snippet;
	}

	let { children }: Props = $props();

	let previousPage: string = $state(base);

	afterNavigate(({ from }) => {
		if (from?.url && !from.url.pathname.includes("settings")) {
			previousPage = from.url.toString() || previousPage || base;
		}
	});

	const settings = useSettingsStore();
</script>

<Modal
	on:close={() => goto(previousPage)}
	width="h-[95dvh] w-[90dvw] pb-0 overflow-hidden rounded-2xl bg-white shadow-2xl outline-none sm:h-[95dvh] xl:w-[1200px] 2xl:h-[75dvh]"
>
	{@render children?.()}
	{#if $settings.recentlySaved}
		<div
			class="absolute bottom-4 right-4 m-2 flex items-center gap-1.5 rounded-full border border-gray-300 bg-gray-200 px-3 py-1 text-black"
		>
			<CarbonCheckmark class="text-green-500" />
			Saved
		</div>
	{/if}
</Modal>