Skip to content

Commit

Permalink
🎨 chore: 重构代码结构
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmclin2 committed Apr 20, 2024
1 parent d8f97e5 commit f204bc3
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 25 deletions.
22 changes: 1 addition & 21 deletions src/app/home/Docker/ToolBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import Record from '@/features/ChatInput/Actions/Record';
import Voice from '@/features/ChatInput/Actions/Voice';
import { useConfigStore } from '@/store/config';
import { useSessionStore } from '@/store/session';
import { ActionIcon } from '@lobehub/ui';
import { Segmented, Space } from 'antd';
import { Space } from 'antd';
import { History } from 'lucide-react';

const ToolBar = () => {
const [openPanel] = useConfigStore((s) => [s.openPanel]);

const { viewerMode, setViewerMode } = useSessionStore((s) => ({
setViewerMode: s.setViewerMode,
viewerMode: s.viewerMode,
}));

return (
<Space size={4}>
<ActionIcon
Expand All @@ -25,20 +19,6 @@ const ToolBar = () => {
/>
<Record />
<Voice />
<Segmented
onChange={(value) => {
if (value === 'true') {
setViewerMode(true);
} else {
setViewerMode(false);
}
}}
options={[
{ label: '3D', value: 'true' },
{ label: '立绘', value: 'false' },
]}
value={viewerMode ? 'true' : 'false'}
/>
</Space>
);
};
Expand Down
6 changes: 2 additions & 4 deletions src/app/home/page.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
'use client';

import Background from '@/app/home/Background';
import Dialog from '@/app/home/Dialog';
import Docker from '@/app/home/Docker';
import QuickSwitch from '@/app/home/QuickSwitch';
import VirtualIdol from '@/app/home/VirtualIdol';
import Background from '@/components/Background';

const Desktop = () => {
return (
<div style={{ display: 'flex', flexDirection: 'column', position: 'relative', width: '100%' }}>
<div style={{ height: 'calc(100vh - 64px - 64px)' }}>
<VirtualIdol />
<Background />
</div>
<Docker />
<QuickSwitch />
<Dialog />
<Background />
</div>
);
};
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions src/features/ChatInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { agentListSelectors, useAgentStore } from '@/store/agent';
import { useConfigStore } from '@/store/config';
import { sessionSelectors, useSessionStore } from '@/store/session';

import ViewerMode from '../ViewerMode';

const useStyles = createStyles(({ css, token }) => ({
content: css`
display: flex;
Expand Down Expand Up @@ -62,6 +64,7 @@ const Header = () => {
编辑
</Button>,
<Voice key={'voice'} />,
<ViewerMode key={'viewer'} />,
]}
agent={currentAgent}
/>
Expand Down
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions src/features/ViewerMode/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Segmented } from 'antd';

import { useSessionStore } from '@/store/session';

const ViewerMode = () => {
const { viewerMode, setViewerMode } = useSessionStore((s) => ({
setViewerMode: s.setViewerMode,
viewerMode: s.viewerMode,
}));

return (
<Segmented
onChange={(value) => {
if (value === 'true') {
setViewerMode(true);
} else {
setViewerMode(false);
}
}}
options={[
{ label: '3D', value: 'true' },
{ label: '立绘', value: 'false' },
]}
value={viewerMode ? 'true' : 'false'}
/>
);
};

export default ViewerMode;

0 comments on commit f204bc3

Please sign in to comment.