File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9696 "asar" : false ,
9797 "files" : [
9898 " dist/**/*" ,
99- " src/main/preload.js " ,
99+ " src/main" ,
100100 " src/main/main.js" ,
101101 " versions/**/*" ,
102102 " package.json" ,
Original file line number Diff line number Diff line change 11import React , { memo } from 'react' ;
22import styles from './index.less' ;
33import classnames from 'classnames' ;
4- import CustomLayout from '@/components/CustomLayout' ;
5- import Iconfont from '@/components/Iconfont' ;
4+ import { useCommonStore } from '@/store/common' ;
5+
6+ // import Iconfont from '@/components/Iconfont';
67
78interface IProps {
89 className ?: string ;
@@ -11,6 +12,12 @@ interface IProps {
1112export default memo < IProps > ( ( props ) => {
1213 const { className } = props ;
1314
15+ const { appTitleBarRightComponent } = useCommonStore ( ( state ) => {
16+ return {
17+ appTitleBarRightComponent : state . appTitleBarRightComponent ,
18+ } ;
19+ } ) ;
20+
1421 const handleDoubleClick = ( ) => {
1522 window . electronApi ?. setMaximize ( ) ;
1623 } ;
@@ -19,9 +26,7 @@ export default memo<IProps>((props) => {
1926 < div className = { classnames ( styles . appTitleBar , className ) } onDoubleClick = { handleDoubleClick } >
2027 < div />
2128 < div className = { styles . appName } > Chat2DB Community</ div >
22- < div >
23- < CustomLayout />
24- </ div >
29+ < div > { appTitleBarRightComponent } </ div >
2530 { /* <div className={styles.windowsCloseBar}>
2631 <div>
2732 <Iconfont code="icon-minimize" />
Original file line number Diff line number Diff line change @@ -3,10 +3,12 @@ import classnames from 'classnames';
33
44import { useWorkspaceStore } from '@/pages/main/workspace/store' ;
55import { setPanelLeftWidth } from '@/pages/main/workspace/store/config' ;
6+ import { setAppTitleBarRightComponent } from '@/store/common/appTitleBarConfig' ;
67
78import DraggableContainer from '@/components/DraggableContainer' ;
89import WorkspaceLeft from './components/WorkspaceLeft' ;
910import WorkspaceRight from './components/WorkspaceRight' ;
11+ import CustomLayout from '@/components/CustomLayout' ;
1012
1113import useMonacoTheme from '@/components/MonacoEditor/useMonacoTheme' ;
1214import shortcutKeyCreateConsole from './functions/shortcutKeyCreateConsole' ;
@@ -24,8 +26,15 @@ const workspacePage = memo(() => {
2426
2527 // 编辑器的主题
2628 useMonacoTheme ( ) ;
27- // 快捷键
2829
30+ useEffect ( ( ) => {
31+ setAppTitleBarRightComponent ( < CustomLayout /> ) ;
32+ return ( ) => {
33+ setAppTitleBarRightComponent ( null ) ;
34+ } ;
35+ } , [ ] ) ;
36+
37+ // 快捷键
2938 useEffect ( ( ) => {
3039 shortcutKeyCreateConsole ( ) ;
3140 } , [ ] ) ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { useCommonStore } from './index' ;
3+ export interface IAppTitleBarConfig {
4+ appTitleBarRightComponent : React . ReactNode | null ;
5+ }
6+
7+ export const initAppTitleBarConfig = {
8+ appTitleBarRightComponent : null ,
9+ } ;
10+
11+ export const setAppTitleBarRightComponent : ( appTitleBarRightComponent : React . ReactNode | null ) => void = (
12+ appTitleBarRightComponent ,
13+ ) => {
14+ return useCommonStore . setState ( { appTitleBarRightComponent } ) ;
15+ } ;
Original file line number Diff line number Diff line change @@ -5,14 +5,16 @@ import { StoreApi } from 'zustand';
55
66import { initCopyFocusedContent , ICopyFocusedContent } from './copyFocusedContent' ;
77import { initComponentsContent , IComponentsContent } from './components' ;
8+ import { initAppTitleBarConfig , IAppTitleBarConfig } from './appTitleBarConfig' ;
89
9- export type IStore = ICopyFocusedContent & IComponentsContent ;
10+ export type IStore = ICopyFocusedContent & IComponentsContent & IAppTitleBarConfig ;
1011
1112export const useCommonStore : UseBoundStoreWithEqualityFn < StoreApi < IStore > > = createWithEqualityFn (
1213 devtools (
1314 ( ) => ( {
1415 ...initCopyFocusedContent ,
1516 ...initComponentsContent ,
17+ ...initAppTitleBarConfig
1618 } ) ,
1719 ) ,
1820 shallow
You can’t perform that action at this time.
0 commit comments