Compare commits
No commits in common. "68ebf1d7a7185e7a6f03105963106e2e0805902d" and "a25088e723a5217a11424fcc7965e9f3380eb570" have entirely different histories.
68ebf1d7a7
...
a25088e723
|
|
@ -1,15 +1,9 @@
|
|||
import type { App } from '../../shared/types'
|
||||
import { apps, selectedApp, selectedTab, setSelectedTab } from '../state'
|
||||
import { apps, selectedTab, setSelectedTab } from '../state'
|
||||
import { Tab, TabBar } from '../styles'
|
||||
import { resetToolIframe } from '../tool-iframes'
|
||||
|
||||
export function Nav({ app, render }: { app: App; render: () => void }) {
|
||||
const handleTabClick = (tab: string) => {
|
||||
// If clicking already-selected tool tab, reset to home
|
||||
if (tab === selectedTab && tab !== 'overview') {
|
||||
resetToolIframe(tab, selectedApp)
|
||||
return
|
||||
}
|
||||
setSelectedTab(tab)
|
||||
render()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function setupMessageListener() {
|
|||
for (const [, cached] of iframes) {
|
||||
if (cached.iframe.contentWindow === event.source) {
|
||||
cached.contentHeight = height
|
||||
cached.iframe.style.height = `${height}px`
|
||||
cached.iframe.style.height = `100vh`
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -85,19 +85,6 @@ function buildCacheKey(toolName: string, params: Record<string, string>): string
|
|||
return parts.join(':')
|
||||
}
|
||||
|
||||
// Reset a tool iframe to its home page
|
||||
export function resetToolIframe(toolName: string, selectedApp: string | null) {
|
||||
const params: Record<string, string> = {}
|
||||
if (selectedApp) params.app = selectedApp
|
||||
const cacheKey = buildCacheKey(toolName, params)
|
||||
const cached = iframes.get(cacheKey)
|
||||
if (cached) {
|
||||
// For code app, include empty file param to clear its localStorage
|
||||
const urlParams = toolName === 'code' ? { ...params, file: '' } : params
|
||||
cached.iframe.src = buildToolUrl(cached.port, urlParams)
|
||||
}
|
||||
}
|
||||
|
||||
// Update which iframe is visible based on selected tab and tool state
|
||||
export function updateToolIframes(
|
||||
selectedTab: string,
|
||||
|
|
@ -135,7 +122,7 @@ export function updateToolIframes(
|
|||
container.style.top = `${rect.top}px`
|
||||
container.style.left = `${rect.left}px`
|
||||
container.style.width = `${rect.width}px`
|
||||
container.style.height = `calc(100vh - ${rect.top}px)`
|
||||
container.style.height = '100vh'
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user