removed commented Avatar stuff

This commit is contained in:
Alex
2024-10-08 07:35:24 +02:00
parent a0e1b32b19
commit 4316eaad79

View File

@@ -82,27 +82,6 @@
onMount(() => { onMount(() => {
console.dir(user); console.dir(user);
console.dir(licence_categories);
// avatars = Object.entries(avatarFiles).map(([path, module]) => {
// if (typeof path !== "string") {
// throw new Error("Unexpected non-string path");
// }
// if (
// typeof module !== "object" ||
// module === null ||
// !("default" in module)
// ) {
// throw new Error("Unexpected module format");
// }
// const src = module.default;
// if (typeof src !== "string") {
// throw new Error("Unexpected default export type");
// }
// return {
// name: path.split("/").pop()?.split(".")[0] ?? "Unknown",
// src: src,
// };
// });
}); });
/** /**
@@ -126,28 +105,9 @@
}; };
/** @type {import('./$types').SubmitFunction} */ /** @type {import('./$types').SubmitFunction} */
// const handleUpload = async () => {
// isUploading = true;
// return async ({ result }) => {
// isUploading = false;
// /** @type {any} */
// const res = result;
// if (result.type === "success" || result.type === "redirect") {
// user.profile_picture = res.data.profile_picture;
// }
// await applyAction(result);
// };
// };
</script> </script>
<div class="hero-container"> <div class="hero-container">
<!-- <div class="hero-logo">
<img
src={user.profile_picture ? user.profile_picture : Avatar}
alt={`${user.first_name} ${user.last_name}`}
width="200"
/>
</div> -->
<div class="user-info"> <div class="user-info">
{#if user.status} {#if user.status}
<h3 class="hero-subtitle subtitle info-row"> <h3 class="hero-subtitle subtitle info-row">
@@ -210,71 +170,6 @@
{#if showModal} {#if showModal}
<Modal on:close={close}> <Modal on:close={close}>
<!-- <div class="avatar-container">
<form
class="avatar-form"
action="?/uploadImage"
method="post"
enctype="multipart/form-data"
use:enhance={handleUpload}
>
<div class="current-avatar">
<ImageInput
avatar={user.profile_picture}
fieldName="profile_picture"
title="Nutzerbild auswählen"
/>
</div>
<div class="avatar-buttons">
{#if !user.profile_picture}
{#if isUploading}
<SmallLoader width={30} message={"Uploading..."} />
{:else}
<button class="button-dark" type="submit">Bild hochladen</button>
{/if}
{:else}
<input
type="hidden"
hidden
name="profile_picture_url"
bind:value={user.profile_picture}
required
/>
{#if isUploading}
<SmallLoader width={30} message={"Lösche..."} />
{:else}
<button
class="button-dark"
formaction="?/deleteImage"
type="submit"
>
Bild löschen
</button>
{/if}
{/if}
</div>
</form>
<div class="avatar-buttons">
<button class="button-dark" on:click={toggleAvatars}>
{showAvatars ? "Abbrechen" : "Profilbild auswählen"}
</button>
</div>
{#if showAvatars}
<div class="avatar-selection">
{#each avatars as avatar}
<button
class="avatar-option"
on:click={() => {
user.profile_picture = avatar.src;
showAvatars = false;
}}
>
<img src={avatar.src} alt={avatar.name} width="80" />
</button>
{/each}
</div>
{/if}
</div> -->
<form <form
class="content" class="content"
action="?/updateUser" action="?/updateUser"