Skip to content

Commit ba624db

Browse files
committed
Announce new features with what's new modal and README updates
1 parent 02389f6 commit ba624db

3 files changed

Lines changed: 100 additions & 1 deletion

File tree

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ https://github.com/user-attachments/assets/2b9674c5-c705-4a22-ba6a-474cfc11cddd
1313
- **Dynamic Visualization**: Vertical bars present the sorting process in real-time.
1414
- **Step-by-Step Exploration**: Go through each step of the algorithm, and analyze what going on.
1515
- **Sound Experience**: Each vertical bar represents a value in the sorting array. As the algorithm works on a bar, a sound is produced based on its height. There are 24 different sound oscillator options to choose from.
16-
- **Input Array Options**: Customize the array to sort by shuffling, reversing, or arranging in a mountain and valley form. Choose array sizes ranging from 2 to 1024 elements.
16+
- **Side-by-Side Compare Mode**: Race two algorithms on the same array — toggle the compare icon in the header, pick algorithms per panel, switch between horizontal and vertical layout.
17+
- **Live Metrics**: Comparisons, swaps and array accesses counted in real time and displayed in the header. Non-comparison sorts (Counting, Radix) clearly show `Cmp = 0`.
18+
- **Keyboard Shortcuts**: `Space` start/stop, `` step, `R` shuffle, `↑/↓` faster/slower, `[/]` previous/next algorithm, `M` mute, `?` opens the full reference.
19+
- **Input Array Options**: Shuffle, Reverse, Valley, Mountain, **Wave**, **Nearly Sorted** and **Pipe Organ** patterns. Array sizes from 2 to 1024 elements. The selected pattern persists when you resize.
1720
- **Adjustable Speed**: Control the pace by dynamically changing the delay, to speed up or slow down the process, with precision up to 500 ms.
21+
- **Persistent Preferences**: Array size, delay, sound type and selected pattern survive page reloads.
1822
- **Themes**: Various themes from DaisyUI so that everyone can find something for themselves.
1923

2024
## 🤖 Supported Sorting Algorithms
@@ -45,6 +49,12 @@ https://github.com/user-attachments/assets/2b9674c5-c705-4a22-ba6a-474cfc11cddd
4549
- [Comb Sort](https://en.wikipedia.org/wiki/Comb_sort) - Improved Bubble Sort variant that uses gap-based comparisons
4650
- [Intro Sort](https://en.wikipedia.org/wiki/Introsort) - Hybrid algorithm combining Quick Sort, Heap Sort, and Insertion Sort
4751

52+
### 🌊 Recently Added Patterns
53+
54+
- **Wave** - Permutation of 1..n where bar heights trace a single sine period
55+
- **Nearly Sorted** - Sorted array with ~5% random swaps — adaptive sorts (Insertion, Tim) shine here
56+
- **Pipe Organ** - Three ascending mini-mountain peaks evoking organ pipes
57+
4858
## 🔍 Rationale
4959

5060
Visual Sorting was created to explore and learn Svelte, a modern JavaScript framework. Inspired by Timo Bingmann's captivating video "The Sound of Sorting" (https://www.youtube.com/watch?v=kPRA0W1kECg), which combines sorting algorithm visualizations with sound, I wanted to develop a tool that offers a similar educational and engaging experience. Visual Sorting aims to make learning sorting algorithms both enjoyable and insightful through dynamic visuals and sounds.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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>

src/routes/+page.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import LeaveAStarModal from '$lib/components/LeaveAStarModal.svelte';
2727
import KoFiSupportModal from '$lib/components/KoFiSupportModal.svelte';
2828
import HelpDialog from '$lib/components/HelpDialog.svelte';
29+
import WhatsNewModal from '$lib/components/WhatsNewModal.svelte';
2930
import { algorithms } from '$lib/sort-algorithms/algorithms';
3031
3132
let selectedTheme: Theme = 'dim';
@@ -491,4 +492,5 @@
491492
<LeaveAStarModal />
492493
<KoFiSupportModal />
493494
<HelpDialog bind:this={helpDialog} />
495+
<WhatsNewModal />
494496
</main>

0 commit comments

Comments
 (0)