Files
TREK/client/src/pages/PluginPage.tsx
T
Maurice 768fd6f439 fix(mobile): a plugin's page in the phone shell sits below the status bar and above the dock
The page took 100vh with no top inset inside the touch shell, so the plugin's header ran under the status bar and the frame reached past the screen and under the dock. It now takes the visible height (100dvh) less the dock, after the safe area and the rail, and the plugin's own document scrolls. TestFlight feedback, 5.1.3 (Trip Importer).
2026-11-11 20:41:24 +00:00

38 lines
1.5 KiB
TypeScript

import React from 'react'
import { useParams } from 'react-router'
import PageShell from '../components/Layout/PageShell'
import HelpAnchor from '../components/Help/HelpAnchor'
import PluginFrame from '../components/Plugins/PluginFrame'
import { usePluginStore } from '../store/pluginStore'
import { useTranslation } from '../i18n'
/**
* Full-page host for a `page` plugin (#plugins, M3). Thin by design (no state /
* effects — the page-pattern rule): it resolves the plugin from the store and
* renders its sandboxed iframe; PluginFrame owns the bridge.
*/
export default function PluginPage(): React.ReactElement {
const { pluginId = '' } = useParams()
const { t } = useTranslation()
const plugin = usePluginStore((s) => s.getById(pluginId))
const loaded = usePluginStore((s) => s.loaded)
if (loaded && (!plugin || plugin.type !== 'page')) {
return (
<PageShell background="var(--bg-secondary)">
<div className="w-full px-6 py-16 text-center text-sm text-content-faint">{t('plugins.notFound')}</div>
</PageShell>
)
}
return (
<PageShell background="var(--bg-secondary)" navOffset="var(--nav-h, 56px)">
<HelpAnchor id="settings-plugins" />
{/* The phone shell sets --plugin-page-h and its own insets (mobile.css). */}
<div data-plugin-page style={{ height: 'var(--plugin-page-h, calc(100vh - var(--nav-h, 56px)))' }}>
<PluginFrame pluginId={pluginId} title={plugin?.name} fill surface="plugin-page" className="w-full h-full" />
</div>
</PageShell>
)
}