Skip to content

Commit 37e468e

Browse files
fix: ensure tags ordered by type
1 parent f7b5e90 commit 37e468e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pages/projects/[handle].vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111

112112
<script setup lang="ts">
113113
import { marked } from 'marked'
114-
import type { ProjectWithTags } from '~/types/supabase'
114+
import type { ProjectWithTags, Tag, TagClass } from '~/types/supabase'
115115
116116
const route = useRoute()
117117
const handle = route.params.handle as string
@@ -145,7 +145,14 @@ const { data: project, error } = await useLazyAsyncData<ProjectWithTags>(
145145
const tags = data.project_tags?.map(pt => pt.tags).filter(Boolean) || []
146146
const projectData = { ...data }
147147
delete projectData.project_tags
148-
return { ...projectData, tags }
148+
return {
149+
...projectData,
150+
tags: tags.sort((a: Tag, b: Tag) => {
151+
// Sort by tag class: tech first, then topic, then event
152+
const classOrder: Record<TagClass, number> = { tech: 1, topic: 2, event: 3 }
153+
return classOrder[a.class] - classOrder[b.class]
154+
})
155+
}
149156
},
150157
{
151158
default: () => null

0 commit comments

Comments
 (0)