fix: adjust layout styles for better responsiveness

This commit is contained in:
codytseng
2025-08-30 23:04:55 +08:00
parent cbac9c5464
commit a125e37f8e
2 changed files with 13 additions and 6 deletions

View File

@@ -342,14 +342,14 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) {
> >
<CurrentRelaysProvider> <CurrentRelaysProvider>
<NotificationProvider> <NotificationProvider>
<div className="flex h-screen overflow-hidden bg-surface-background"> <div className="flex h-[var(--vh)] overflow-hidden bg-surface-background">
<Sidebar /> <Sidebar />
<div className="grid grid-cols-2 gap-2 w-full pr-2"> <div className="grid grid-cols-2 gap-2 w-full pr-2 py-2">
<div className="flex rounded-lg my-2 max-h-screen shadow-md bg-background overflow-hidden"> <div className="rounded-lg shadow-lg bg-background overflow-hidden">
{primaryPages.map(({ name, element, props }) => ( {primaryPages.map(({ name, element, props }) => (
<div <div
key={name} key={name}
className="w-full" className="flex flex-col h-full w-full"
style={{ style={{
display: currentPrimaryPage === name ? 'block' : 'none' display: currentPrimaryPage === name ? 'block' : 'none'
}} }}
@@ -358,11 +358,11 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) {
</div> </div>
))} ))}
</div> </div>
<div className="flex rounded-lg my-2 max-h-screen shadow-md bg-background overflow-hidden"> <div className="rounded-lg shadow-lg bg-background overflow-hidden">
{secondaryStack.map((item, index) => ( {secondaryStack.map((item, index) => (
<div <div
key={item.index} key={item.index}
className="w-full" className="flex flex-col h-full w-full"
style={{ display: index === secondaryStack.length - 1 ? 'block' : 'none' }} style={{ display: index === secondaryStack.length - 1 ? 'block' : 'none' }}
> >
{item.component} {item.component}

View File

@@ -8,6 +8,13 @@ import { createRoot } from 'react-dom/client'
import App from './App.tsx' import App from './App.tsx'
import { ErrorBoundary } from './components/ErrorBoundary.tsx' import { ErrorBoundary } from './components/ErrorBoundary.tsx'
const setVh = () => {
document.documentElement.style.setProperty('--vh', `${window.innerHeight}px`)
}
window.addEventListener('resize', setVh)
window.addEventListener('orientationchange', setVh)
setVh()
createRoot(document.getElementById('root')!).render( createRoot(document.getElementById('root')!).render(
<StrictMode> <StrictMode>
<ErrorBoundary> <ErrorBoundary>