feat: enhance query view with fullscreen toggle and details management
- Added fullscreen toggle functionality to the QueryView component. - Introduced new icons for maximizing and minimizing the view. - Updated the QueryView component to handle details display with tab management. - Refactored the store to manage details data and active tabs. - Improved the handling of view data in the studio, including filtering unnecessary fields. - Created new routes for ID and console views, integrating them into the routing structure. - Added dynamic basename calculation based on the current URL path. - Enhanced the query module to utilize context keys for better state management. - Updated the UI components for better user experience and accessibility.
This commit is contained in:
45
web/src/routes/console.tsx
Normal file
45
web/src/routes/console.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import { useContextKey } from '@kevisual/context';
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import type Eruda from 'eruda';
|
||||
import { useEffect, useRef } from 'react';
|
||||
export const Route = createFileRoute('/console')({
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
||||
function RouteComponent() {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
useEffect(() => {
|
||||
init();
|
||||
return () => {
|
||||
deinit();
|
||||
}
|
||||
}, [])
|
||||
const deinit = async () => {
|
||||
const eruda: typeof Eruda = await useContextKey('eruda');
|
||||
eruda.destroy();
|
||||
}
|
||||
const init = async () => {
|
||||
console.log('正在初始化控制台...');
|
||||
const eruda: typeof Eruda = await useContextKey('eruda');
|
||||
console.log('eruda', eruda);
|
||||
if (!ref.current) return;
|
||||
eruda.init({
|
||||
container: ref.current!,
|
||||
tool: ['console'],
|
||||
inline: true,
|
||||
});
|
||||
const consoleTool = eruda.get('console');
|
||||
consoleTool.html('<span style="color:red">Red</span>');
|
||||
}
|
||||
|
||||
return <div className='w-full overflow-hidden' style={{
|
||||
height: 'calc(100% - 48px)'
|
||||
}} >
|
||||
<div className='min-w-150 w-[80%] mx-auto h-full py-4'>
|
||||
<div className='relative w-full h-full border'>
|
||||
<div ref={ref}></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
Reference in New Issue
Block a user