feat: use member's favourite pronouns in delete member modal

This commit is contained in:
Sam 2023-03-29 12:30:51 +02:00
parent 7764f0f80c
commit 11ef4d548a
No known key found for this signature in database
GPG Key ID: B4EF20DDE721CAA1
1 changed files with 15 additions and 1 deletions

View File

@ -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 @@
<Modal header="Delete member" isOpen={deleteOpen} toggle={toggleDeleteOpen}>
<ModalBody>
<p>
If you want to delete this member, type their name (<code>{data.member.name}</code>) below:
If you want to delete this member, type {deleteModalPronoun} name (<code
>{data.member.name}</code
>) below:
</p>
<p>
<input type="text" class="form-control" bind:value={deleteName} />