feat: change to center and clean code

This commit is contained in:
2025-02-16 02:09:14 +08:00
parent 73de223d56
commit 1363b87f36
97 changed files with 882 additions and 6775 deletions

View File

@@ -21,7 +21,6 @@ import {
import clsx from 'clsx';
import { isObjectNull } from '@/utils/is-null';
import { CardBlank } from '@/components/card/CardBlank';
import { useAiStore } from '@/pages/ai-chat';
import { update } from 'lodash-es';
const FormModal = () => {
const [form] = Form.useForm();
@@ -205,15 +204,7 @@ export const ContainerList = () => {
};
}),
);
const aiStore = useAiStore(
useShallow((state) => {
return {
open: state.open,
setOpen: state.setOpen,
setKey: state.setKey,
};
}),
);
const [codeEdit, setCodeEdit] = useState(false);
const [code, setCode] = useState('');
useEffect(() => {
@@ -230,9 +221,6 @@ export const ContainerList = () => {
<Tooltip title='add'>
<Button onClick={onAdd} icon={<PlusOutlined />}></Button>
</Tooltip>
<Tooltip title='To Panel'>
<Button onClick={() => navicate('/panel')} icon={<DashboardOutlined />}></Button>
</Tooltip>
</div>
<div className='flex flex-grow overflow-hidden h-full'>
<div className='flex-grow overflow-auto scrollbar bg-gray-100'>
@@ -355,14 +343,6 @@ export const ContainerList = () => {
}}
icon={<LinkOutlined />}></Button>
</Tooltip>
<Tooltip title='ai编程'>
<Button
onClick={(e) => {
aiStore.setKey(location.pathname);
aiStore.setOpen(true);
}}
icon={<MessageOutlined />}></Button>
</Tooltip>
</div>
</div>
<div className='h-[94%] p-2 rounded-2 shadow-sm'>

View File

@@ -1,4 +1,4 @@
import { Container, RenderData } from '@kevisual/container';
import { Container, RenderData, ContainerOne } from '@kevisual/container';
import { useEffect, useRef, useState } from 'react';
import { replace, useParams } from 'react-router';
import { query, ws, useStore } from '@/modules';
@@ -55,7 +55,6 @@ export const Preview = () => {
const id = params.id;
const ref = useRef<HTMLDivElement>(null);
const containerRef = useRef<Container | null>(null);
const [data, setData] = useState<any>({});
useEffect(() => {
if (!id) return;
@@ -107,16 +106,15 @@ export const Preview = () => {
});
console.log('update---data', data, container.data);
container.destroy(id!);
container.renderId(id!);
container.render(id!);
return;
}
console.log('data', containerRef.current);
const container = new Container({
root: ref.current!,
data: data as any,
showChild: false,
});
container.renderId(id!);
container.render(id!);
containerRef.current = container;
};
return <div className='mx-auto border bg-gray-200 h-full w-full' ref={ref}></div>;
@@ -176,16 +174,15 @@ export const PreviewWrapper = () => {
});
console.log('update---data', data, container.data);
container.destroy(id!);
container.renderId(id!);
container.render(id!);
return;
}
console.log('data', containerRef.current);
const container = new Container({
root: ref.current!,
data: data as any,
showChild: false,
});
container.renderId(id!);
container.render(id!);
containerRef.current = container;
};
return (