mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-05 13:15:18 +02:00
chore: Update UserAvatar component to display user's first initial if no icon is provided
This commit is contained in:
parent
157d9fe99c
commit
bf51dcb4e3
2 changed files with 6 additions and 10 deletions
|
@ -3,14 +3,6 @@
|
|||
import { goto } from "$app/navigation";
|
||||
export let user: any;
|
||||
|
||||
let icon: string = "";
|
||||
|
||||
if (user.icon != null && user.icon != "") {
|
||||
icon = user.icon;
|
||||
} else {
|
||||
icon = user.username.charAt(0);
|
||||
}
|
||||
|
||||
async function navToSettings() {
|
||||
goto("/settings");
|
||||
}
|
||||
|
@ -22,7 +14,11 @@
|
|||
<div class="dropdown dropdown-bottom dropdown-end" tabindex="0" role="button">
|
||||
<div class="avatar placeholder">
|
||||
<div class="bg-neutral text-neutral-content rounded-full w-10 ml-4">
|
||||
<img src={user.icon} alt="" />
|
||||
{#if user.icon}
|
||||
<img src={user.icon} alt="" />
|
||||
{:else}
|
||||
<span class="text-2xl -mt-1">{user.first_name[0]}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
|
|
|
@ -8,7 +8,7 @@ export async function POST(event: RequestEvent): Promise<Response> {
|
|||
try {
|
||||
const contentType = event.request.headers.get("content-type") ?? "";
|
||||
const fileExtension = contentType.split("/").pop();
|
||||
const fileName = `${generateId(50)}.${fileExtension}`;
|
||||
const fileName = `${generateId(75)}.${fileExtension}`;
|
||||
const bucket = event.request.headers.get("bucket") as string;
|
||||
|
||||
if (!fileExtension || !fileName) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue