From 7f3e5157702e32e6a1a20befc492a44703900851 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 21c96348f0aa..831bad8ffd83 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 82fde284c16b..a4f79a7e1876 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 12e2db2293e6..3f0c44f8a411 100644 --- a/packages/frontend/src/pages/timeline.vue +++ b/packages/frontend/src/pages/timeline.vue @@ -135,7 +135,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, @@ -154,7 +154,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,