|
| 1 | +<script lang="ts"> |
| 2 | + import { onMount } from 'svelte'; |
| 3 | + import { trackEvent } from '../umami'; |
| 4 | +
|
| 5 | + // Bump this key when shipping a new batch of features to surface the modal |
| 6 | + // again to returning visitors. |
| 7 | + const VERSION_KEY = 'whats-new-2026-05'; |
| 8 | +
|
| 9 | + let ref: HTMLDialogElement; |
| 10 | +
|
| 11 | + onMount(() => { |
| 12 | + if (localStorage.getItem(VERSION_KEY)) return; |
| 13 | + // Small delay so the rest of the UI is rendered first. |
| 14 | + setTimeout(() => { |
| 15 | + ref?.showModal(); |
| 16 | + trackEvent('modal-shown', { modal: 'whats-new', version: VERSION_KEY }); |
| 17 | + }, 800); |
| 18 | + }); |
| 19 | +
|
| 20 | + const dismiss = (action: 'gotIt' | 'backdrop') => { |
| 21 | + localStorage.setItem(VERSION_KEY, '1'); |
| 22 | + trackEvent('modal-action-whats-new', { action }); |
| 23 | + ref?.close(); |
| 24 | + }; |
| 25 | +</script> |
| 26 | + |
| 27 | +<dialog |
| 28 | + bind:this={ref} |
| 29 | + class="modal modal-bottom sm:modal-middle" |
| 30 | + on:close={() => localStorage.setItem(VERSION_KEY, '1')} |
| 31 | +> |
| 32 | + <div class="modal-box max-w-lg"> |
| 33 | + <h3 class="text-lg font-bold mb-1">✨ What's new</h3> |
| 34 | + <p class="text-sm opacity-70 mb-4"> |
| 35 | + A bunch of fresh features landed. Here's the highlights: |
| 36 | + </p> |
| 37 | + <ul class="space-y-3"> |
| 38 | + <li> |
| 39 | + <div class="font-semibold">Compare two algorithms</div> |
| 40 | + <div class="text-sm opacity-70"> |
| 41 | + Toggle the compare icon in the header to race two algorithms on the |
| 42 | + same array, side-by-side or stacked. |
| 43 | + </div> |
| 44 | + </li> |
| 45 | + <li> |
| 46 | + <div class="font-semibold">Live metrics</div> |
| 47 | + <div class="text-sm opacity-70"> |
| 48 | + Comparisons, swaps and array accesses ticking in the header — see why |
| 49 | + non-comparison sorts skip <kbd class="kbd kbd-xs">Cmp</kbd> entirely. |
| 50 | + </div> |
| 51 | + </li> |
| 52 | + <li> |
| 53 | + <div class="font-semibold">Keyboard shortcuts</div> |
| 54 | + <div class="text-sm opacity-70"> |
| 55 | + <kbd class="kbd kbd-xs">Space</kbd> start/stop, |
| 56 | + <kbd class="kbd kbd-xs">→</kbd> step, |
| 57 | + <kbd class="kbd kbd-xs">R</kbd> shuffle, plus speed and algorithm |
| 58 | + cycling. Press <kbd class="kbd kbd-xs">?</kbd> for the full list. |
| 59 | + </div> |
| 60 | + </li> |
| 61 | + <li> |
| 62 | + <div class="font-semibold">New array patterns</div> |
| 63 | + <div class="text-sm opacity-70"> |
| 64 | + <strong>Wave</strong>, <strong>Nearly Sorted</strong> and |
| 65 | + <strong>Pipe Organ</strong> joined the pattern picker next to the |
| 66 | + shuffle button. |
| 67 | + </div> |
| 68 | + </li> |
| 69 | + <li> |
| 70 | + <div class="font-semibold">Your preferences stick</div> |
| 71 | + <div class="text-sm opacity-70"> |
| 72 | + Size, delay, sound and selected pattern persist between visits. |
| 73 | + </div> |
| 74 | + </li> |
| 75 | + </ul> |
| 76 | + <div class="modal-action"> |
| 77 | + <form method="dialog"> |
| 78 | + <button class="btn btn-primary" on:click={() => dismiss('gotIt')} |
| 79 | + >Got it</button |
| 80 | + > |
| 81 | + </form> |
| 82 | + </div> |
| 83 | + </div> |
| 84 | + <form method="dialog" class="modal-backdrop"> |
| 85 | + <button on:click={() => dismiss('backdrop')}>close</button> |
| 86 | + </form> |
| 87 | +</dialog> |
0 commit comments