From 261f5c41848f5ef813a8dbe236307e2a71c070ad Mon Sep 17 00:00:00 2001 From: Manohar Gupta Date: Sat, 23 May 2026 18:13:08 +0530 Subject: [PATCH] Fix file preview and button interaction --- packages/web/components/ProfileViewer.tsx | 139 +++++++++++----------- 1 file changed, 72 insertions(+), 67 deletions(-) diff --git a/packages/web/components/ProfileViewer.tsx b/packages/web/components/ProfileViewer.tsx index 8eb01ef..8abacc2 100644 --- a/packages/web/components/ProfileViewer.tsx +++ b/packages/web/components/ProfileViewer.tsx @@ -367,10 +367,66 @@ export function ProfileViewer() { {/* Content */}
- {/* Bundled profiles section */} + {/* File preview section - ALWAYS SHOWS when file is selected */} + {selectedFile ? ( +
+
+
+ {selectedFile.name.includes('Solar') ? '☀️' : '💨'} +
+

{selectedFile.name}

+

{selectedFile.data.length} rows of data

+
+
+
+ + Download CSV + + +
+
+
+ + + + + + + + + + + + + {selectedFile.data.map((row: string[], i: number) => ( + + + + + + + + + ))} + +
HourDateMonthDayHour of Day% Generation
{row[0]}{row[1]}{row[2]}{row[3]}{row[4]}{row[5]}
+
+
+ ) : ( +
+ {/* Bundled profiles section - shown when no file selected */}
-

Bundled Reference Files

-
+

📂 Click on any file below to view its contents:

+
{[ { name: "Solar - Gujarat", path: "/api/profiles/solar/GJ", type: "solar", id: "solar_gj" }, { name: "Solar - Karnataka", path: "/api/profiles/solar/KA", type: "solar", id: "solar_ka" }, @@ -382,76 +438,24 @@ export function ProfileViewer() { ))}
- {/* File preview section */} - {selectedFile && ( -
-
-
- {selectedFile.name} - ({selectedFile.data.length} rows) -
-
- - Download CSV - - -
-
-
- - - - - - - - - - - - - {selectedFile.data.map((row: string[], i: number) => ( - - - - - - - - - ))} - -
HourDateMonthDayHour of Day% Generation
{row[0]}{row[1]}{row[2]}{row[3]}{row[4]}{row[5]}
-
-
- )} - - {activeTab === "solar" && ( + {/* Charts section - hidden when file is selected */} + {!selectedFile && activeTab === "solar" && (

@@ -568,7 +572,7 @@ export function ProfileViewer() {

)} - {activeTab === "compare" && ( + {!selectedFile && activeTab === "compare" && (

@@ -619,10 +623,11 @@ export function ProfileViewer() { )}

)} +
)} ); -} \ No newline at end of file +}