frontend: changed thumbnail to profile picture

This commit is contained in:
Alex
2024-09-29 21:22:23 +02:00
parent dbf7aca078
commit db84918cb1
3 changed files with 18 additions and 13 deletions

View File

@@ -46,8 +46,8 @@
<div class="header-nav-item"> <div class="header-nav-item">
<a href="/auth/about/{$page.data.user.id}"> <a href="/auth/about/{$page.data.user.id}">
<img <img
src={$page.data.user.thumbnail src={$page.data.user.profile_picture
? $page.data.user.thumbnail ? $page.data.user.profile_picture
: Avatar} : Avatar}
alt={`${$page.data.user.first_name} ${$page.data.user.last_name}`} alt={`${$page.data.user.first_name} ${$page.data.user.last_name}`}
/> />

View File

@@ -99,7 +99,7 @@ export const actions = {
return { return {
success: true, success: true,
thumbnail: response["s3_url"], profile_picture: response[""],
}; };
}, },
/** /**
@@ -132,7 +132,7 @@ export const actions = {
return { return {
success: true, success: true,
thumbnail: "", profile_picture: "",
}; };
}, },
}; };

View File

@@ -108,7 +108,7 @@
/** @type {any} */ /** @type {any} */
const res = result; const res = result;
if (result.type === "success" || result.type === "redirect") { if (result.type === "success" || result.type === "redirect") {
user.thumbnail = res.data.thumbnail; user.profile_picture = res.data.profile_picture;
} }
await applyAction(result); await applyAction(result);
}; };
@@ -118,7 +118,7 @@
<div class="hero-container"> <div class="hero-container">
<div class="hero-logo"> <div class="hero-logo">
<img <img
src={user.thumbnail ? user.thumbnail : Avatar} src={user.profile_picture ? user.profile_picture : Avatar}
alt={`${user.first_name} ${user.last_name}`} alt={`${user.first_name} ${user.last_name}`}
width="200" width="200"
/> />
@@ -195,13 +195,13 @@
> >
<div class="current-avatar"> <div class="current-avatar">
<ImageInput <ImageInput
avatar={user.thumbnail} avatar={user.profile_picture}
fieldName="thumbnail" fieldName="profile_picture"
title="Nutzerbild auswählen" title="Nutzerbild auswählen"
/> />
</div> </div>
<div class="avatar-buttons"> <div class="avatar-buttons">
{#if !user.thumbnail} {#if !user.profile_picture}
{#if isUploading} {#if isUploading}
<SmallLoader width={30} message={"Uploading..."} /> <SmallLoader width={30} message={"Uploading..."} />
{:else} {:else}
@@ -211,8 +211,8 @@
<input <input
type="hidden" type="hidden"
hidden hidden
name="thumbnail_url" name="profile_picture_url"
value={user.thumbnail} bind:value={user.profile_picture}
required required
/> />
{#if isUploading} {#if isUploading}
@@ -240,7 +240,7 @@
<button <button
class="avatar-option" class="avatar-option"
on:click={() => { on:click={() => {
user.thumbnail = avatar.src; user.profile_picture = avatar.src;
showAvatars = false; showAvatars = false;
}} }}
> >
@@ -279,7 +279,12 @@
{/each} {/each}
{/if} {/if}
<input type="hidden" hidden name="thumbnail" value={user.thumbnail} /> <input
type="hidden"
hidden
name="profile_picture"
bind:value={user.profile_picture}
/>
<div class="button-container"> <div class="button-container">
{#each TABS as tab} {#each TABS as tab}