Skip to content

Commit 4386891

Browse files
feat(frontend): Organisations are now sorted alphabetically in dashboard and on user pages (#3755)
* feat: Organisations are now sorted alphabetically in dashboard and on user pages * Use computed ref --------- Co-authored-by: Prospector <prospectordev@gmail.com> Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
1 parent 6741aba commit 4386891

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

apps/frontend/src/pages/dashboard/organizations.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<template v-if="orgs?.length > 0">
1515
<div class="orgs-grid">
1616
<nuxt-link
17-
v-for="org in orgs"
17+
v-for="org in sortedOrgs"
1818
:key="org.id"
1919
:to="`/organization/${org.slug}`"
2020
class="universal-card button-base recessed org"
@@ -67,6 +67,8 @@ const { data: orgs, error } = useAsyncData("organizations", () => {
6767
});
6868
});
6969
70+
const sortedOrgs = computed(() => orgs.value.sort((a, b) => a.name.localeCompare(b.name)));
71+
7072
const onlyAcceptedMembers = (members) => members.filter((member) => member?.accepted);
7173
7274
if (error.value) {

apps/frontend/src/pages/user/[id].vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@
303303
<h2 class="text-lg text-contrast">{{ formatMessage(messages.profileOrganizations) }}</h2>
304304
<div class="flex flex-wrap gap-2">
305305
<nuxt-link
306-
v-for="org in organizations"
306+
v-for="org in sortedOrgs"
307307
:key="org.id"
308308
v-tooltip="org.name"
309309
class="organization"
@@ -516,6 +516,8 @@ try {
516516
});
517517
}
518518
519+
const sortedOrgs = computed(() => organizations.value.sort((a, b) => a.name.localeCompare(b.name)));
520+
519521
if (!user.value) {
520522
throw createError({
521523
fatal: true,

0 commit comments

Comments
 (0)