mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-08-02 21:50:43 +08:00
fix:electron build
This commit is contained in:
@ -96,7 +96,7 @@
|
||||
"asar": false,
|
||||
"files": [
|
||||
"dist/**/*",
|
||||
"src/main/preload.js",
|
||||
"src/main",
|
||||
"src/main/main.js",
|
||||
"versions/**/*",
|
||||
"package.json",
|
||||
|
@ -1,8 +1,9 @@
|
||||
import React, { memo } from 'react';
|
||||
import styles from './index.less';
|
||||
import classnames from 'classnames';
|
||||
import CustomLayout from '@/components/CustomLayout';
|
||||
import Iconfont from '@/components/Iconfont';
|
||||
import { useCommonStore } from '@/store/common';
|
||||
|
||||
// import Iconfont from '@/components/Iconfont';
|
||||
|
||||
interface IProps {
|
||||
className?: string;
|
||||
@ -11,6 +12,12 @@ interface IProps {
|
||||
export default memo<IProps>((props) => {
|
||||
const { className } = props;
|
||||
|
||||
const { appTitleBarRightComponent } = useCommonStore((state) => {
|
||||
return {
|
||||
appTitleBarRightComponent: state.appTitleBarRightComponent,
|
||||
};
|
||||
});
|
||||
|
||||
const handleDoubleClick = () => {
|
||||
window.electronApi?.setMaximize();
|
||||
};
|
||||
@ -19,9 +26,7 @@ export default memo<IProps>((props) => {
|
||||
<div className={classnames(styles.appTitleBar, className)} onDoubleClick={handleDoubleClick}>
|
||||
<div />
|
||||
<div className={styles.appName}>Chat2DB Community</div>
|
||||
<div>
|
||||
<CustomLayout />
|
||||
</div>
|
||||
<div>{appTitleBarRightComponent}</div>
|
||||
{/* <div className={styles.windowsCloseBar}>
|
||||
<div>
|
||||
<Iconfont code="icon-minimize" />
|
||||
|
@ -3,10 +3,12 @@ import classnames from 'classnames';
|
||||
|
||||
import { useWorkspaceStore } from '@/pages/main/workspace/store';
|
||||
import { setPanelLeftWidth } from '@/pages/main/workspace/store/config';
|
||||
import { setAppTitleBarRightComponent } from '@/store/common/appTitleBarConfig';
|
||||
|
||||
import DraggableContainer from '@/components/DraggableContainer';
|
||||
import WorkspaceLeft from './components/WorkspaceLeft';
|
||||
import WorkspaceRight from './components/WorkspaceRight';
|
||||
import CustomLayout from '@/components/CustomLayout';
|
||||
|
||||
import useMonacoTheme from '@/components/MonacoEditor/useMonacoTheme';
|
||||
import shortcutKeyCreateConsole from './functions/shortcutKeyCreateConsole';
|
||||
@ -24,8 +26,15 @@ const workspacePage = memo(() => {
|
||||
|
||||
// 编辑器的主题
|
||||
useMonacoTheme();
|
||||
// 快捷键
|
||||
|
||||
useEffect(() => {
|
||||
setAppTitleBarRightComponent(<CustomLayout />);
|
||||
return () => {
|
||||
setAppTitleBarRightComponent(null);
|
||||
};
|
||||
}, []);
|
||||
|
||||
// 快捷键
|
||||
useEffect(() => {
|
||||
shortcutKeyCreateConsole();
|
||||
}, []);
|
||||
|
15
chat2db-client/src/store/common/appTitleBarConfig.ts
Normal file
15
chat2db-client/src/store/common/appTitleBarConfig.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
import { useCommonStore } from './index';
|
||||
export interface IAppTitleBarConfig {
|
||||
appTitleBarRightComponent: React.ReactNode | null;
|
||||
}
|
||||
|
||||
export const initAppTitleBarConfig = {
|
||||
appTitleBarRightComponent: null,
|
||||
};
|
||||
|
||||
export const setAppTitleBarRightComponent: (appTitleBarRightComponent: React.ReactNode | null) => void = (
|
||||
appTitleBarRightComponent,
|
||||
) => {
|
||||
return useCommonStore.setState({ appTitleBarRightComponent });
|
||||
};
|
@ -5,14 +5,16 @@ import { StoreApi } from 'zustand';
|
||||
|
||||
import { initCopyFocusedContent, ICopyFocusedContent } from './copyFocusedContent';
|
||||
import { initComponentsContent, IComponentsContent } from './components';
|
||||
import { initAppTitleBarConfig, IAppTitleBarConfig } from './appTitleBarConfig';
|
||||
|
||||
export type IStore = ICopyFocusedContent & IComponentsContent;
|
||||
export type IStore = ICopyFocusedContent & IComponentsContent & IAppTitleBarConfig;
|
||||
|
||||
export const useCommonStore: UseBoundStoreWithEqualityFn<StoreApi<IStore>> = createWithEqualityFn(
|
||||
devtools(
|
||||
() => ({
|
||||
...initCopyFocusedContent,
|
||||
...initComponentsContent,
|
||||
...initAppTitleBarConfig
|
||||
}),
|
||||
),
|
||||
shallow
|
||||
|
Reference in New Issue
Block a user