From 2c23670158024b1f2f3e7be37d41081860071e15 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Sat, 11 Apr 2026 08:09:12 +0000 Subject: [PATCH] deleted upload page --- .../[propertyId]/upload/page.tsx | 134 ------------------ 1 file changed, 134 deletions(-) delete mode 100644 src/app/portfolio/[slug]/building-passport/[propertyId]/upload/page.tsx diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/upload/page.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/upload/page.tsx deleted file mode 100644 index dbb9ef2..0000000 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/upload/page.tsx +++ /dev/null @@ -1,134 +0,0 @@ -"use client"; - -import React, { useState, useEffect } from "react"; -import { useParams } from "next/navigation"; - -interface FileRecord { - id: number; - s3JsonUrl: string; - portfolioId: string; - propertyId: string; - presignedUrl?: string; - createdAt?: string; -} - -const UploadPage: React.FC = () => { - const [isUploading, setIsUploading] = useState(false); - const [files, setFiles] = useState([]); - const params = useParams(); - - const portfolioId = params?.slug as string; - const propertyId = params?.propertyId as string; - - const fetchFiles = async () => { - const res = await fetch( - `/api/upload/retrofit-data?portfolioId=${portfolioId}&propertyId=${propertyId}` - ); - if (res.ok) { - const data = await res.json(); - setFiles(data.files); - } - }; - - useEffect(() => { - if (portfolioId && propertyId) { - fetchFiles(); - } - }, [portfolioId, propertyId]); - - const handleFileChange = async (e: React.ChangeEvent) => { - const files = e.target.files; - if (!files || files.length === 0) return; - - const formData = new FormData(); - formData.append("portfolioId", portfolioId); - formData.append("propertyId", propertyId); - Array.from(files).forEach((file) => formData.append("files", file)); - - try { - setIsUploading(true); - const res = await fetch("/api/upload/retrofit-data", { - method: "POST", - body: formData, - }); - if (!res.ok) throw new Error("Upload failed"); - await fetchFiles(); - alert("✅ Files uploaded successfully!"); - } catch (err) { - console.error(err); - alert("❌ Upload failed"); - } finally { - setIsUploading(false); - } - }; - - return ( -
-

Upload Retrofit Data Files

- -
-

- Portfolio ID: {portfolioId} -

-

- Property ID: {propertyId} -

-
- - - - - -
-

Uploaded Files

- {files.length === 0 ? ( -

No files uploaded yet.

- ) : ( - - - - - - - - - {files.map((file) => ( - - - - - ))} - -
File URLAction
- {file.s3JsonUrl} - - -
- )} -
-
- ); -}; - -export default UploadPage;