del: Avatar image
This commit is contained in:
@@ -23,12 +23,12 @@
|
||||
/** @type {App.Locals['licence_categories']} */
|
||||
$: licence_categories = $page.data.licence_categories;
|
||||
|
||||
/** @typedef {{name: string, src: string}} Avatar */
|
||||
const avatarFiles = import.meta.glob("$lib/img/Avatar-*.jpeg", {
|
||||
eager: true,
|
||||
});
|
||||
/** @type{Avatar[]} */
|
||||
let avatars = [];
|
||||
// /** @typedef {{name: string, src: string}} Avatar */
|
||||
// const avatarFiles = import.meta.glob("$lib/img/Avatar-*.jpeg", {
|
||||
// eager: true,
|
||||
// });
|
||||
// /** @type{Avatar[]} */
|
||||
// let avatars = [];
|
||||
|
||||
const TABS = ["profile", "licence", "membership", "bankaccount"];
|
||||
let activeTab = TABS[0];
|
||||
@@ -67,13 +67,13 @@
|
||||
let showModal = false,
|
||||
isUploading = false,
|
||||
isUpdating = false,
|
||||
showAvatars = false,
|
||||
// showAvatars = false,
|
||||
password = "",
|
||||
password2 = "";
|
||||
|
||||
const open = () => (showModal = true);
|
||||
const close = () => (showModal = false);
|
||||
const toggleAvatars = () => (showAvatars = !showAvatars);
|
||||
// const toggleAvatars = () => (showAvatars = !showAvatars);
|
||||
|
||||
$: selectedSubscriptionModel =
|
||||
subscriptions.find(
|
||||
@@ -83,26 +83,26 @@
|
||||
onMount(() => {
|
||||
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,
|
||||
};
|
||||
});
|
||||
// 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 +126,28 @@
|
||||
};
|
||||
|
||||
/** @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);
|
||||
};
|
||||
};
|
||||
// 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>
|
||||
|
||||
<div class="hero-container">
|
||||
<div class="hero-logo">
|
||||
<!-- <div class="hero-logo">
|
||||
<img
|
||||
src={user.profile_picture ? user.profile_picture : Avatar}
|
||||
alt={`${user.first_name} ${user.last_name}`}
|
||||
width="200"
|
||||
/>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="user-info">
|
||||
{#if user.status}
|
||||
<h3 class="hero-subtitle subtitle info-row">
|
||||
@@ -210,7 +210,7 @@
|
||||
|
||||
{#if showModal}
|
||||
<Modal on:close={close}>
|
||||
<div class="avatar-container">
|
||||
<!-- <div class="avatar-container">
|
||||
<form
|
||||
class="avatar-form"
|
||||
action="?/uploadImage"
|
||||
@@ -274,7 +274,7 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div> -->
|
||||
<form
|
||||
class="content"
|
||||
action="?/updateUser"
|
||||
@@ -751,7 +751,7 @@
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.avatar-container {
|
||||
/* .avatar-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
@@ -811,7 +811,7 @@
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: 50%;
|
||||
}
|
||||
} */
|
||||
.button-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
Reference in New Issue
Block a user