From 7ec96087dae575343d0770a7d63b8b6cd9f1a6f0 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 28 Sep 2024 20:46:21 -0700 Subject: [PATCH 1/3] create alphabetical sorting function for realms dropdown --- src/routes/signup.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/signup.tsx b/src/routes/signup.tsx index a1c375227..a1ee6aa8d 100644 --- a/src/routes/signup.tsx +++ b/src/routes/signup.tsx @@ -49,6 +49,8 @@ const SignUpForm = () => { const realms = usePromise(getRealms) || [] const emitError = useErrorEmitter() + realms.sort((a, b) => a.name.localeCompare(b.name)) + const onSubmit = (e: Event) => { e.preventDefault() if (realmId === undefined) return From cab3da41eb5504c52207ae4efc9b81cfaa291d5d Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 14 Dec 2024 15:36:19 -0800 Subject: [PATCH 2/3] made get-realms sort the realms, removed sorting from signup --- src/api/realm/get-realms.ts | 2 +- src/routes/signup.tsx | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/api/realm/get-realms.ts b/src/api/realm/get-realms.ts index 0f8cbb1b1..70ca7d2bc 100644 --- a/src/api/realm/get-realms.ts +++ b/src/api/realm/get-realms.ts @@ -2,4 +2,4 @@ import { request } from '../base' import { Realm } from '.' // Public realms will be returned. If logged-in, the user's realm will also be returned. -export const getRealms = () => request('GET', 'realms') +export const getRealms = () => request('GET', 'realms').then(realms => realms.sort((a, b) => a.name.localeCompare(b.name))) diff --git a/src/routes/signup.tsx b/src/routes/signup.tsx index a1ee6aa8d..a1c375227 100644 --- a/src/routes/signup.tsx +++ b/src/routes/signup.tsx @@ -49,8 +49,6 @@ const SignUpForm = () => { const realms = usePromise(getRealms) || [] const emitError = useErrorEmitter() - realms.sort((a, b) => a.name.localeCompare(b.name)) - const onSubmit = (e: Event) => { e.preventDefault() if (realmId === undefined) return From f996552b676f38365b550e68706f98dd1ef3c78b Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 14 Dec 2024 15:37:35 -0800 Subject: [PATCH 3/3] lint --- src/api/realm/get-realms.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/realm/get-realms.ts b/src/api/realm/get-realms.ts index 70ca7d2bc..36d24a4d0 100644 --- a/src/api/realm/get-realms.ts +++ b/src/api/realm/get-realms.ts @@ -2,4 +2,7 @@ import { request } from '../base' import { Realm } from '.' // Public realms will be returned. If logged-in, the user's realm will also be returned. -export const getRealms = () => request('GET', 'realms').then(realms => realms.sort((a, b) => a.name.localeCompare(b.name))) +export const getRealms = () => + request('GET', 'realms').then((realms) => + realms.sort((a, b) => a.name.localeCompare(b.name)), + )