From 11ef4d548a1b2dcce51963dca5789f881d484741 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 29 Mar 2023 12:30:51 +0200 Subject: [PATCH] feat: use member's favourite pronouns in delete member modal --- .../src/routes/edit/member/[id]/+page.svelte | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/routes/edit/member/[id]/+page.svelte b/frontend/src/routes/edit/member/[id]/+page.svelte index 8e18f1f..8dfa55c 100644 --- a/frontend/src/routes/edit/member/[id]/+page.svelte +++ b/frontend/src/routes/edit/member/[id]/+page.svelte @@ -252,6 +252,18 @@ } }; + let deleteModalPronoun = "the member's"; + $: deleteModalPronoun = updateModalPronoun(pronouns); + + const updateModalPronoun = (pronouns: Pronoun[]) => { + const filtered = pronouns.filter((entry) => entry.status === WordStatus.Favourite); + if (filtered.length < 1) return "the member's"; + + const split = filtered[0].pronouns.split("/"); + if (split.length !== 5) return "the member's"; + return split[2]; + }; + let deleteOpen = false; const toggleDeleteOpen = () => (deleteOpen = !deleteOpen); let deleteName = ""; @@ -285,7 +297,9 @@

- If you want to delete this member, type their name ({data.member.name}) below: + If you want to delete this member, type {deleteModalPronoun} name ({data.member.name}) below: