From df0e8909f2cad19b5b9d047af14ff86c0e06afa8 Mon Sep 17 00:00:00 2001 From: Catherine Renelle <32781029+catrenelle@users.noreply.github.com> Date: Fri, 27 Feb 2026 23:43:38 -0500 Subject: [PATCH] Fix checklist item ordering and add move up/down buttons The BASE_CHARS in fractional-index.ts had digits after letters (A-Za-z0-9), but PostgreSQL sorts digits before letters (0-9A-Za-z), causing items to appear out of order once positions reached the digit range. Reordered BASE_CHARS to match DB collation. Also added up/down arrow buttons on checklist items so users can reorder them within the list. Co-Authored-By: Claude Opus 4.6 --- src/lib/components/ChecklistSection.svelte | 80 +++++++++++++++++++--- src/lib/utils/fractional-index.ts | 4 +- 2 files changed, 73 insertions(+), 11 deletions(-) diff --git a/src/lib/components/ChecklistSection.svelte b/src/lib/components/ChecklistSection.svelte index fa70bb2..b00856a 100644 --- a/src/lib/components/ChecklistSection.svelte +++ b/src/lib/components/ChecklistSection.svelte @@ -1,5 +1,6 @@
@@ -132,7 +168,7 @@
- {#each cl.items as item} + {#each cl.items as item, idx}
{#if canEdit} {#if canEdit} - +
+ + + +
{/if}
{/each} diff --git a/src/lib/utils/fractional-index.ts b/src/lib/utils/fractional-index.ts index f035ac0..1acaede 100644 --- a/src/lib/utils/fractional-index.ts +++ b/src/lib/utils/fractional-index.ts @@ -8,8 +8,8 @@ * https://observablehq.com/@dgreensp/implementing-fractional-indexing */ -const BASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; -const MIDPOINT = 'N'; // roughly middle of uppercase range +const BASE_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; +const MIDPOINT = 'V'; // roughly middle of the charset /** * Generate a position string between `before` and `after`.