diff --git a/frontend/src/lib/components/IconButton.svelte b/frontend/src/lib/components/IconButton.svelte index 580e63d..16473c5 100644 --- a/frontend/src/lib/components/IconButton.svelte +++ b/frontend/src/lib/components/IconButton.svelte @@ -6,6 +6,7 @@ export let tooltip: string; export let active: boolean = false; export let disabled: boolean = false; + export let type: string | undefined = undefined; export let click: ((e: MouseEvent) => void) | undefined = undefined; export let href: string | undefined = undefined; @@ -14,6 +15,6 @@ {tooltip} - diff --git a/frontend/src/routes/edit/EditableField.svelte b/frontend/src/routes/edit/EditableField.svelte index afa5fcc..446fe71 100644 --- a/frontend/src/routes/edit/EditableField.svelte +++ b/frontend/src/routes/edit/EditableField.svelte @@ -10,7 +10,9 @@ let newEntry: string = ""; - const addEntry = () => { + const addEntry = (event: Event) => { + event.preventDefault(); + field.entries = [...field.entries, { value: newEntry, status: WordStatus.Okay }]; newEntry = ""; }; @@ -61,8 +63,8 @@ /> {/each} -
+
- addEntry()} /> -
+ + diff --git a/frontend/src/routes/edit/member/[id]/+page.svelte b/frontend/src/routes/edit/member/[id]/+page.svelte index c8e701f..8b8c029 100644 --- a/frontend/src/routes/edit/member/[id]/+page.svelte +++ b/frontend/src/routes/edit/member/[id]/+page.svelte @@ -20,6 +20,7 @@ Modal, ModalBody, ModalFooter, + Popover, } from "sveltestrap"; import { encode } from "base64-arraybuffer"; import { apiFetchClient, fastFetchClient } from "$lib/api/fetch"; @@ -59,7 +60,6 @@ let newName = ""; let newPronouns = ""; - let newPronounsDisplay = ""; let newLink = ""; let modified = false; @@ -169,21 +169,38 @@ fields[newIndex] = temp; }; - const addName = () => { + const addName = (event: Event) => { + event.preventDefault(); + names = [...names, { value: newName, status: WordStatus.Okay }]; newName = ""; }; - const addPronouns = () => { - pronouns = [ - ...pronouns, - { pronouns: newPronouns, display_text: newPronounsDisplay || null, status: WordStatus.Okay }, - ]; + const addPronouns = (event: Event) => { + event.preventDefault(); + + if (newPronouns in data.pronouns) { + const fullSet = data.pronouns[newPronouns]; + pronouns = [ + ...pronouns, + { + pronouns: fullSet.pronouns.join("/"), + display_text: fullSet.display || null, + status: WordStatus.Okay, + }, + ]; + } else { + pronouns = [ + ...pronouns, + { pronouns: newPronouns, display_text: null, status: WordStatus.Okay }, + ]; + } newPronouns = ""; - newPronounsDisplay = ""; }; - const addLink = () => { + const addLink = (event: Event) => { + event.preventDefault(); + links = [...links, newLink]; newLink = ""; }; @@ -375,9 +392,10 @@
- -