detached 8769977

refactor: simplify color-picker by binding directly to value

commit
8769977bfbc45401b462b8b3e890a2d7c0efe8fd
author
brice · · 2026-01-24 16:40 UTC
parent
5c01908
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +3 -11
M webui/src/lib/components/ui/color-picker/color-picker.svelte +3 -11
@@ -21,14 +21,6 @@
2121
2222 let open = $state(false);
2323
24- // svelte-awesome-color-picker uses hex binding - use state to sync with value
25- let hex = $state(value);
26-
27- // Sync hex when value changes externally
28- $effect(() => {
29- hex = value;
30- });
31-
3224 function handleInput(event: { hex: string | null }) {
3325 if (event.hex) {
3426 value = event.hex;
@@ -59,7 +51,7 @@
5951 sideOffset={4}
6052 >
6153 <ColorPicker
62- bind:hex
54+ bind:hex={value}
6355 onInput={handleInput}
6456 isDialog={false}
6557 />
@@ -67,10 +59,10 @@
6759 <div class="mt-2 flex items-center gap-2">
6860 <span
6961 class="block h-6 w-6 shrink-0 border border-border"
70- style="background-color: {hex};"
62+ style="background-color: {value};"
7163 aria-hidden="true"
7264 ></span>
73- <span class="font-mono text-sm text-foreground">{hex}</span>
65+ <span class="font-mono text-sm text-foreground">{value}</span>
7466 </div>
7567 </Popover.Content>
7668 </Popover.Portal>
@@ -21,14 +21,6 @@
21 21
22 let open = $state(false);22 let open = $state(false);
23 23
24- // svelte-awesome-color-picker uses hex binding - use state to sync with value
25- let hex = $state(value);
26-
27- // Sync hex when value changes externally
28- $effect(() => {
29- hex = value;
30- });
31-
32 function handleInput(event: { hex: string | null }) {24 function handleInput(event: { hex: string | null }) {
33 if (event.hex) {25 if (event.hex) {
34 value = event.hex;26 value = event.hex;
@@ -59,7 +51,7 @@
59 sideOffset={4}51 sideOffset={4}
60 >52 >
61 <ColorPicker53 <ColorPicker
62- bind:hex54+ bind:hex={value}
63 onInput={handleInput}55 onInput={handleInput}
64 isDialog={false}56 isDialog={false}
65 />57 />
@@ -67,10 +59,10 @@
67 <div class="mt-2 flex items-center gap-2">59 <div class="mt-2 flex items-center gap-2">
68 <span60 <span
69 class="block h-6 w-6 shrink-0 border border-border"61 class="block h-6 w-6 shrink-0 border border-border"
70- style="background-color: {hex};"62+ style="background-color: {value};"
71 aria-hidden="true"63 aria-hidden="true"
72 ></span>64 ></span>
73- <span class="font-mono text-sm text-foreground">{hex}</span>65+ <span class="font-mono text-sm text-foreground">{value}</span>
74 </div>66 </div>
75 </Popover.Content>67 </Popover.Content>
76 </Popover.Portal>68 </Popover.Portal>

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close