This commit is contained in:
pradeepkumar
2026-01-24 23:10:02 +05:30
parent b940e77a67
commit 39af9bc59d
8 changed files with 496 additions and 103 deletions

View File

@@ -8,9 +8,10 @@ interface PhotoUploadModalProps {
onClose: () => void;
onUpload: (file: File) => Promise<void>;
currentPhoto?: string | null;
currentPhotoUrl?: string | null; // Presigned URL for display
}
export function PhotoUploadModal({ isOpen, onClose, onUpload, currentPhoto }: PhotoUploadModalProps) {
export function PhotoUploadModal({ isOpen, onClose, onUpload, currentPhoto, currentPhotoUrl }: PhotoUploadModalProps) {
const [selectedFile, setSelectedFile] = useState<File | null>(null);
const [previewUrl, setPreviewUrl] = useState<string | null>(null);
const [isDragging, setIsDragging] = useState(false);
@@ -170,20 +171,14 @@ export function PhotoUploadModal({ isOpen, onClose, onUpload, currentPhoto }: Ph
}`}
>
{/* Current Photo Preview */}
{currentPhoto && (
{(currentPhotoUrl || currentPhoto) && (
<div className="flex justify-center mb-4">
<div className="relative w-[100px] h-[100px] rounded-[10px] overflow-hidden opacity-50">
<Image
src={
currentPhoto.startsWith('http')
? currentPhoto
: currentPhoto.startsWith('/uploads')
? `${process.env.NEXT_PUBLIC_API_URL?.replace('/api/v1', '')}${currentPhoto}`
: currentPhoto
}
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src={currentPhotoUrl || currentPhoto || ''}
alt="Current photo"
fill
className="object-cover"
className="w-full h-full object-cover"
/>
</div>
</div>