feat: allow avatar upload regardless of mode

Remove avatarMode prop from AvatarWithUpload and always render the upload
overlay. The upload functionality is now unconditionally available.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Théo LAGACHE
2026-06-25 11:02:10 +02:00
co-authored by Claude Sonnet 4.6
parent 8d448718d0
commit 3f76f7b604
@@ -8,17 +8,14 @@ import { updateImageUserAction } from "@/features/profile/actions/avatar.action"
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { User } from "@/db/schema/02_user"; import { User } from "@/db/schema/02_user";
import React, { ChangeEvent } from "react"; import React, { ChangeEvent } from "react";
import type { AvatarMode } from "@/features/onboarding/types";
export type AvatarWithUploadProps = { export type AvatarWithUploadProps = {
user: User; user: User;
avatarMode?: AvatarMode;
avatarUrl?: string; avatarUrl?: string;
}; };
export const AvatarWithUpload = (props: AvatarWithUploadProps) => { export const AvatarWithUpload = (props: AvatarWithUploadProps) => {
const user = props.user; const user = props.user;
const canUpload = !props.avatarMode || props.avatarMode === "internal";
const src = props.avatarUrl ?? user.image ?? undefined; const src = props.avatarUrl ?? user.image ?? undefined;
const router = useRouter(); const router = useRouter();
@@ -79,7 +76,6 @@ export const AvatarWithUpload = (props: AvatarWithUploadProps) => {
</AvatarFallback> </AvatarFallback>
</Avatar> </Avatar>
{canUpload && (
<div <div
onClick={() => { onClick={() => {
const fileInput = document.createElement("input"); const fileInput = document.createElement("input");
@@ -95,7 +91,6 @@ export const AvatarWithUpload = (props: AvatarWithUploadProps) => {
> >
<UploadIcon className="w-12 h-12 lg:w-16 lg:h-16 text-primary" /> <UploadIcon className="w-12 h-12 lg:w-16 lg:h-16 text-primary" />
</div> </div>
)}
</div> </div>
); );
}; };