From c2969cc0fc867a2b85b2105e694b582541ffbfa1 Mon Sep 17 00:00:00 2001 From: aliceif <7098860+aliceif@users.noreply.github.com> Date: Fri, 20 Sep 2024 12:05:52 +0200 Subject: [PATCH] sort antennas and lists in frontend --- packages/frontend/src/pages/my-antennas/index.vue | 2 +- packages/frontend/src/pages/my-lists/index.vue | 2 +- packages/frontend/src/pages/timeline.vue | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/pages/my-antennas/index.vue b/packages/frontend/src/pages/my-antennas/index.vue index f3877407282e..2f4b5226bed3 100644 --- a/packages/frontend/src/pages/my-antennas/index.vue +++ b/packages/frontend/src/pages/my-antennas/index.vue @@ -35,7 +35,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js'; import { antennasCache } from '@/cache.js'; import { infoImageUrl } from '@/instance.js'; -const antennas = computed(() => antennasCache.value.value ?? []); +const antennas = computed(() => (antennasCache.value.value ?? []).sort((x, y) => x.name.localeCompare(y.name))); function fetch() { antennasCache.fetch(); diff --git a/packages/frontend/src/pages/my-lists/index.vue b/packages/frontend/src/pages/my-lists/index.vue index 6cbcca73c2ae..aebd5e7a682a 100644 --- a/packages/frontend/src/pages/my-lists/index.vue +++ b/packages/frontend/src/pages/my-lists/index.vue @@ -41,7 +41,7 @@ import { signinRequired } from '@/account.js'; const $i = signinRequired(); -const items = computed(() => userListsCache.value.value ?? []); +const items = computed(() => (userListsCache.value.value ?? []).sort((x, y) => x.name.localeCompare(y.name))); function fetch() { userListsCache.fetch(); diff --git a/packages/frontend/src/pages/timeline.vue b/packages/frontend/src/pages/timeline.vue index 044a1908ab41..c0966402e8ed 100644 --- a/packages/frontend/src/pages/timeline.vue +++ b/packages/frontend/src/pages/timeline.vue @@ -131,7 +131,7 @@ function top(): void { } async function chooseList(ev: MouseEvent): Promise { - const lists = await userListsCache.fetch(); + const lists = (await userListsCache.fetch()).sort((x, y) => x.name.localeCompare(y.name)); const items: MenuItem[] = [ ...lists.map(list => ({ type: 'link' as const, @@ -150,7 +150,7 @@ async function chooseList(ev: MouseEvent): Promise { } async function chooseAntenna(ev: MouseEvent): Promise { - const antennas = await antennasCache.fetch(); + const antennas = (await antennasCache.fetch()).sort((x, y) => x.name.localeCompare(y.name)); const items: MenuItem[] = [ ...antennas.map(antenna => ({ type: 'link' as const,