s3 fix
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user