Skip to content

Commit 1ff77e7

Browse files
AmirMohammad CheraghaliAmirMohammad Cheraghali
authored andcommitted
fix: Ensure empty state buttons activate target viewport
1 parent 6039579 commit 1ff77e7

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/App.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,13 +1622,19 @@ function App() {
16221622

16231623
<div className="flex items-center justify-center gap-3 pt-4">
16241624
<button
1625-
onClick={() => setIsLibraryOpen(true)}
1625+
onClick={() => {
1626+
setActiveViewIndex(index);
1627+
setIsLibraryOpen(true);
1628+
}}
16261629
className="flex items-center gap-2 px-5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white rounded-xl font-medium transition-all hover:scale-105 active:scale-95 shadow-lg shadow-blue-900/20"
16271630
>
16281631
<BookOpen className="w-4 h-4" />
16291632
Browse Library
16301633
</button>
1631-
<label className="flex items-center gap-2 px-5 py-2.5 bg-neutral-800 hover:bg-neutral-700 text-white rounded-xl font-medium transition-all hover:scale-105 active:scale-95 cursor-pointer border border-white/10 hover:border-white/20">
1634+
<label
1635+
onClick={() => setActiveViewIndex(index)}
1636+
className="flex items-center gap-2 px-5 py-2.5 bg-neutral-800 hover:bg-neutral-700 text-white rounded-xl font-medium transition-all hover:scale-105 active:scale-95 cursor-pointer border border-white/10 hover:border-white/20"
1637+
>
16321638
<Upload className="w-4 h-4" />
16331639
Upload File
16341640
<input
@@ -1637,9 +1643,10 @@ function App() {
16371643
accept=".pdb,.cif,.ent,.mol,.sdf,.mol2,.xyz"
16381644
onChange={(e) => {
16391645
if (e.target.files?.[0]) {
1640-
handleUpload(e.target.files[0]);
1641-
// Also set active index?? Actually handleUpload uses activeController
1642-
if (activeViewIndex !== index) setActiveViewIndex(index);
1646+
// Set this viewport as active
1647+
setActiveViewIndex(index);
1648+
// Use the specific controller for this viewport
1649+
ctrl.handleUpload(e.target.files[0]);
16431650
}
16441651
}}
16451652
/>

0 commit comments

Comments
 (0)