mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
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:
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>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user