Refactor extension page layout and tab handling
Some checks are pending
Build NapCat Artifacts / Build-Framework (push) Waiting to run
Build NapCat Artifacts / Build-Shell (push) Waiting to run

Improves the layout of the extension page by adjusting container heights and restructuring the header to better support responsive design. Moves the tab navigation to the header and displays only the selected extension page in the main content area, simplifying the rendering logic and improving user experience.
This commit is contained in:
手瓜一十雪 2026-01-30 19:41:27 +08:00
parent 3b7ca1a08f
commit 71f8504849

View File

@ -89,10 +89,11 @@ export default function ExtensionPage () {
return (
<>
<title> - NapCat WebUI</title>
<div className='p-2 md:p-4 relative h-full flex flex-col'>
<div className='p-2 md:p-4 relative h-[calc(100vh-6rem)] md:h-[calc(100vh-4rem)] flex flex-col'>
<PageLoading loading={loading} />
<div className='flex mb-4 items-center gap-4'>
<div className='flex mb-4 items-center justify-between gap-4 flex-wrap'>
<div className='flex items-center gap-4'>
<div className='flex items-center gap-2 text-default-600'>
<MdExtension size={24} />
<span className='text-lg font-medium'></span>
@ -106,17 +107,7 @@ export default function ExtensionPage () {
<IoMdRefresh size={24} />
</Button>
</div>
{extensionPages.length === 0 && !loading
? (
<div className='flex-1 flex flex-col items-center justify-center text-default-400'>
<MdExtension size={64} className='mb-4 opacity-50' />
<p className='text-lg'></p>
<p className='text-sm mt-2'> WebUI </p>
</div>
)
: (
<div className='flex-1 flex flex-col min-h-0'>
{extensionPages.length > 0 && (
<Tabs
aria-label='Extension Pages'
className='max-w-full'
@ -125,7 +116,7 @@ export default function ExtensionPage () {
classNames={{
tabList: 'bg-white/40 dark:bg-black/20 backdrop-blur-md',
cursor: 'bg-white/80 dark:bg-white/10 backdrop-blur-md shadow-sm',
panel: 'flex-1 min-h-0 p-0',
panel: 'hidden',
}}
>
{tabs.map((tab) => (
@ -138,8 +129,20 @@ export default function ExtensionPage () {
<span className='text-xs text-default-400'>({tab.pluginName})</span>
</div>
}
>
<div className='relative w-full h-[calc(100vh-220px)] bg-white/40 dark:bg-black/20 backdrop-blur-md rounded-lg overflow-hidden'>
/>
))}
</Tabs>
)}
</div>
{extensionPages.length === 0 && !loading ? (
<div className='flex-1 flex flex-col items-center justify-center text-default-400'>
<MdExtension size={64} className='mb-4 opacity-50' />
<p className='text-lg'></p>
<p className='text-sm mt-2'> WebUI </p>
</div>
) : (
<div className='flex-1 min-h-0 bg-white/40 dark:bg-black/20 backdrop-blur-md rounded-lg overflow-hidden relative'>
{iframeLoading && (
<div className='absolute inset-0 flex items-center justify-center bg-default-100/50 z-10'>
<Spinner size='lg' />
@ -149,14 +152,10 @@ export default function ExtensionPage () {
src={currentPageUrl}
className='w-full h-full border-0'
onLoad={handleIframeLoad}
title={tab.title}
title='extension-page'
sandbox='allow-scripts allow-same-origin allow-forms allow-popups'
/>
</div>
</Tab>
))}
</Tabs>
</div>
)}
</div>
</>