Skip to content

Commit 17446f9

Browse files
AmirMohammad CheraghaliAmirMohammad Cheraghali
authored andcommitted
fix: Ensure ProteinViewer remains mounted in Studio Mode
1 parent ce14cc7 commit 17446f9

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/App.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,7 @@ function App() {
297297
/* eslint-disable react-hooks/exhaustive-deps */
298298
const handlePlaybackStateChange = useCallback((state: any) => {
299299
// The recorded state is "multiViewState" { viewMode, viewports: [] }
300-
if (!state || !state.viewports || !state.viewports[0]) {
301-
console.warn("Playback: Invalid state or missing viewports", state);
302-
return;
303-
}
304-
305-
console.log("Playback: Applying State", state.viewports[0].pdbId);
300+
if (!state || !state.viewports || !state.viewports[0]) return;
306301

307302
const vpState = state.viewports[0];
308303
const ctrl = controllers[0];
@@ -343,7 +338,6 @@ function App() {
343338
}, [controllers, viewMode]);
344339

345340
const handlePlaybackCameraChange = useCallback((orientation: any) => {
346-
// console.log("Playback: Camera Update", orientation);
347341
if (viewerRefs[0].current) viewerRefs[0].current.setOrientation(orientation);
348342
}, []);
349343

@@ -2494,7 +2488,11 @@ function App() {
24942488
onRemoveOverlay={controllers[activeViewIndex].removeOverlay}
24952489
onToggleOverlay={controllers[activeViewIndex].toggleOverlay}
24962490
/>
2491+
</>
2492+
)}
24972493

2494+
{!showLanding && (
2495+
<>
24982496
{/* BACKGROUND (Dark Mode) */}
24992497
{!isLightMode && !customBackgroundColor && activeViewIndex === 0 && viewMode === 'single' && (
25002498
<div className="absolute inset-0 bg-gradient-to-br from-gray-900 via-black to-gray-950 -z-10" />
@@ -2507,7 +2505,7 @@ function App() {
25072505

25082506
{/* Logic to determine if we are looking at a Chemical */}
25092507
{(() => {
2510-
if (isEmbedMode) return null; // Hide Sidebar in Embed Mode
2508+
if (isEmbedMode || isStudioMode) return null; // Hide Sidebar in Embed OR Studio Mode
25112509

25122510
const isChemical = dataSource === 'pubchem' ||
25132511
(file && /\.(sdf|mol|cif)$/i.test(file.name));
@@ -2954,6 +2952,8 @@ function App() {
29542952

29552953
{/* End Main Content Flex Container */}
29562954

2955+
{/* End Main Content Flex Container */}
2956+
29572957
</>
29582958
)}
29592959

src/components/StudioLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export const StudioLayout: React.FC<StudioLayoutProps> = ({ recorder, onExit, ex
140140
</div>
141141

142142
{/* VISUAL AREA (The hole) */}
143-
<div className="flex-1 relative border-4 border-red-500 bg-transparent">
143+
<div className="flex-1 relative">
144144
{/* Floating Transport Controls */}
145145
<div className="absolute bottom-6 left-1/2 -translate-x-1/2 bg-neutral-900/80 backdrop-blur-md rounded-full px-4 py-2 flex items-center gap-4 text-white pointer-events-auto border border-white/10 shadow-2xl z-50">
146146
<span className="text-xs font-mono ml-2">{formatTime(playbackTime)}</span>

0 commit comments

Comments
 (0)