diff --git a/frontend/src/routes/edit/member/[id]/+page.svelte b/frontend/src/routes/edit/member/[id]/+page.svelte index 8b8c029..0cb0e03 100644 --- a/frontend/src/routes/edit/member/[id]/+page.svelte +++ b/frontend/src/routes/edit/member/[id]/+page.svelte @@ -21,6 +21,12 @@ ModalBody, ModalFooter, Popover, + TabContent, + TabPane, + Card, + CardBody, + CardHeader, + Alert, } from "sveltestrap"; import { encode } from "base64-arraybuffer"; import { apiFetchClient, fastFetchClient } from "$lib/api/fetch"; @@ -32,6 +38,7 @@ import type { PageData } from "./$types"; import { addToast, delToast } from "$lib/toast"; import { memberNameRegex } from "$lib/api/regex"; + import renderMarkdown from "$lib/api/markdown"; const MAX_AVATAR_BYTES = 1_000_000; @@ -51,6 +58,7 @@ let names: FieldEntry[] = window.structuredClone(data.member.names); let pronouns: Pronoun[] = window.structuredClone(data.member.pronouns); let fields: Field[] = window.structuredClone(data.member.fields); + let unlisted: boolean = data.member.unlisted || false; let memberNameValid = true; $: memberNameValid = memberNameRegex.test(name); @@ -64,10 +72,22 @@ let modified = false; - $: modified = isModified(bio, name, display_name, links, names, pronouns, fields, avatar); + $: modified = isModified( + data.member, + bio, + name, + display_name, + links, + names, + pronouns, + fields, + avatar, + unlisted, + ); $: getAvatar(avatar_files).then((b64) => (avatar = b64)); const isModified = ( + member: Member, bio: string, name: string, display_name: string, @@ -76,15 +96,17 @@ pronouns: Pronoun[], fields: Field[], avatar: string | null, + unlisted: boolean, ) => { - if (name !== data.member.name) return true; - if (bio !== data.member.bio) return true; - if (display_name !== data.member.display_name) return true; - if (!linksEqual(links, data.member.links)) return true; - if (!fieldsEqual(fields, data.member.fields)) return true; - if (!namesEqual(names, data.member.names)) return true; - if (!pronounsEqual(pronouns, data.member.pronouns)) return true; + if (name !== member.name) return true; + if (bio !== member.bio) return true; + if (display_name !== member.display_name) return true; + if (!linksEqual(links, member.links)) return true; + if (!fieldsEqual(fields, member.fields)) return true; + if (!namesEqual(names, member.names)) return true; + if (!pronounsEqual(pronouns, member.pronouns)) return true; if (avatar !== null) return true; + if (unlisted !== member.unlisted) return true; return false; }; @@ -242,6 +264,7 @@ names, pronouns, fields, + unlisted, }); addToast({ header: "Success", body: "Successfully saved changes!" }); @@ -249,7 +272,6 @@ data.member = resp; avatar = null; error = null; - modified = false; } catch (e) { error = e as APIError; } finally { @@ -341,75 +363,66 @@ {/if} -
-
-
-

Avatar

-
-
- {#if avatar === ""} - - {:else if avatar} - New avatar + +
+
+
+
+ {#if avatar === ""} + + {:else if avatar} + New avatar + {:else} + + {/if} +
+
+ - {:else} - - {/if} -
-
- -

- Only PNG, JPEG, GIF, and WebP can be used as - avatars. Avatars cannot be larger than 1 MB, and animated avatars will be made static. -

- (avatar = "")}>Remove avatar +

+ Only PNG, JPEG, GIF, and WebP images can be + used as avatars. Avatars cannot be larger than 1 MB, and animated avatars will be made + static. +

+

+ (avatar = "")}>Remove avatar +

+
-
-
-
+
+

+ + The member name is only used as part of the link to their profile page. +

{#if !memberNameValid}

That member name is not valid.

{/if} -
-
-
-
-
- -