diff --git a/app/public/scripts/fetch-prompts.js b/app/public/scripts/fetch-prompts.js index 8936f84..e0cd7a6 100644 --- a/app/public/scripts/fetch-prompts.js +++ b/app/public/scripts/fetch-prompts.js @@ -22,16 +22,19 @@ if (!dateStr) return "–"; }; function renderPromptCard(prompt) { - const tagSpans = (prompt.tags ?? []).map(tag => + const sortedTags = (prompt.tags ?? []).slice().sort((a, b) => + a.toLowerCase().localeCompare(b.toLowerCase()) + ); + const tagSpans = sortedTags.map(tag => `${tag}` ).join(''); const escapedDescription = (prompt.description ?? '').replace(/\n/g, '
'); const notes = prompt.notes ?? ''; return ` -
-
+

${prompt.title}

${prompt.type}
-

${notes}

-
${tagSpans}
+

${notes}

+
${tagSpans}
View Details
@@ -61,7 +64,10 @@ function renderPromptCard(prompt) { } function updateFiltersFromTags(prompts) { - const tagSet = new Set(prompts.flatMap(p => p.tags ?? [])); + const sortedTags = Array.from(new Set( + prompts.flatMap(p => p.tags ?? []) + )).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())); + const tagSet = new Set(sortedTags); const tagContainer = document.querySelector('#filters fieldset > div'); if (!tagContainer) return; diff --git a/app/src/pages/index.astro b/app/src/pages/index.astro index e35f08e..0f9c5eb 100644 --- a/app/src/pages/index.astro +++ b/app/src/pages/index.astro @@ -31,7 +31,7 @@ const supabaseKey = import.meta.env.PUBLIC_SUPABASE_ANON_KEY; Filters ↓
-
Loading prompts…
+
Loading prompts…