mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-04 06:31:13 +00:00
Refactor extension page layout and tab handling
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:
parent
3b7ca1a08f
commit
71f8504849
@ -89,10 +89,11 @@ export default function ExtensionPage () {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<title>扩展页面 - NapCat WebUI</title>
|
<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} />
|
<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'>
|
<div className='flex items-center gap-2 text-default-600'>
|
||||||
<MdExtension size={24} />
|
<MdExtension size={24} />
|
||||||
<span className='text-lg font-medium'>插件扩展页面</span>
|
<span className='text-lg font-medium'>插件扩展页面</span>
|
||||||
@ -106,17 +107,7 @@ export default function ExtensionPage () {
|
|||||||
<IoMdRefresh size={24} />
|
<IoMdRefresh size={24} />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
{extensionPages.length > 0 && (
|
||||||
{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'>
|
|
||||||
<Tabs
|
<Tabs
|
||||||
aria-label='Extension Pages'
|
aria-label='Extension Pages'
|
||||||
className='max-w-full'
|
className='max-w-full'
|
||||||
@ -125,7 +116,7 @@ export default function ExtensionPage () {
|
|||||||
classNames={{
|
classNames={{
|
||||||
tabList: 'bg-white/40 dark:bg-black/20 backdrop-blur-md',
|
tabList: 'bg-white/40 dark:bg-black/20 backdrop-blur-md',
|
||||||
cursor: 'bg-white/80 dark:bg-white/10 backdrop-blur-md shadow-sm',
|
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) => (
|
{tabs.map((tab) => (
|
||||||
@ -138,8 +129,20 @@ export default function ExtensionPage () {
|
|||||||
<span className='text-xs text-default-400'>({tab.pluginName})</span>
|
<span className='text-xs text-default-400'>({tab.pluginName})</span>
|
||||||
</div>
|
</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 && (
|
{iframeLoading && (
|
||||||
<div className='absolute inset-0 flex items-center justify-center bg-default-100/50 z-10'>
|
<div className='absolute inset-0 flex items-center justify-center bg-default-100/50 z-10'>
|
||||||
<Spinner size='lg' />
|
<Spinner size='lg' />
|
||||||
@ -149,14 +152,10 @@ export default function ExtensionPage () {
|
|||||||
src={currentPageUrl}
|
src={currentPageUrl}
|
||||||
className='w-full h-full border-0'
|
className='w-full h-full border-0'
|
||||||
onLoad={handleIframeLoad}
|
onLoad={handleIframeLoad}
|
||||||
title={tab.title}
|
title='extension-page'
|
||||||
sandbox='allow-scripts allow-same-origin allow-forms allow-popups'
|
sandbox='allow-scripts allow-same-origin allow-forms allow-popups'
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Tab>
|
|
||||||
))}
|
|
||||||
</Tabs>
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user