diff --git a/src/lib/actions.ts b/src/lib/actions.ts index 72c554f..9240375 100644 --- a/src/lib/actions.ts +++ b/src/lib/actions.ts @@ -14,7 +14,8 @@ export function tooltip(elem: HTMLElement, { text, offset }: TooltipOptions) { arrow: false, theme: 'cauldron', hideOnClick: true, - offset: offset ? offset : [0, -10] + offset: offset ? offset : [0, -10], + touch: false }); return { diff --git a/src/lib/components/PaletteCard.svelte b/src/lib/components/PaletteCard.svelte index 6ac31c6..3203f4a 100644 --- a/src/lib/components/PaletteCard.svelte +++ b/src/lib/components/PaletteCard.svelte @@ -30,21 +30,28 @@ } async function downloadPalette() { - let paletteData = await fetch(`/api/palette/`, { - method: 'POST', - body: JSON.stringify(palette) + toast.promise(savePalette(), { + loading: 'Saving palette...', + success: 'Palette saved!', + error: 'Failed to save palette' }); - const paletteDataURI = await paletteData.blob(); - const paletteFile = new File([paletteDataURI], `${palette.name}.png`, { type: 'image/png' }); - if (navigator.share) { - navigator.share({ files: [paletteFile] }); - } else { - const url = URL.createObjectURL(paletteFile); - const a = document.createElement('a'); - a.href = url; - a.download = paletteFile.name; - a.click(); - URL.revokeObjectURL(url); + async function savePalette() { + let paletteData = await fetch(`/api/palette/`, { + method: 'POST', + body: JSON.stringify(palette) + }); + const paletteDataURI = await paletteData.blob(); + const paletteFile = new File([paletteDataURI], `${palette.name}.png`, { type: 'image/png' }); + if (navigator.share) { + navigator.share({ files: [paletteFile] }); + } else { + const url = URL.createObjectURL(paletteFile); + const a = document.createElement('a'); + a.href = url; + a.download = paletteFile.name; + a.click(); + URL.revokeObjectURL(url); + } } } diff --git a/src/lib/components/gen/SharePalette.svelte b/src/lib/components/generated/SharePalette.svelte similarity index 65% rename from src/lib/components/gen/SharePalette.svelte rename to src/lib/components/generated/SharePalette.svelte index 39e47fb..aae52e8 100644 --- a/src/lib/components/gen/SharePalette.svelte +++ b/src/lib/components/generated/SharePalette.svelte @@ -1,11 +1,15 @@
{color.hex}
+{color.name}
+ {/each}