mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 22:16:01 +00:00
theme basic
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
|||||||
OpenedConnectionsProvider,
|
OpenedConnectionsProvider,
|
||||||
LeftPanelWidthProvider,
|
LeftPanelWidthProvider,
|
||||||
CurrentArchiveProvider,
|
CurrentArchiveProvider,
|
||||||
|
CurrentThemeProvider,
|
||||||
} from './utility/globalState';
|
} from './utility/globalState';
|
||||||
import { SocketProvider } from './utility/SocketProvider';
|
import { SocketProvider } from './utility/SocketProvider';
|
||||||
import ConnectionsPinger from './utility/ConnectionsPinger';
|
import ConnectionsPinger from './utility/ConnectionsPinger';
|
||||||
@@ -28,10 +29,12 @@ function App() {
|
|||||||
<ConnectionsPinger>
|
<ConnectionsPinger>
|
||||||
<ModalLayerProvider>
|
<ModalLayerProvider>
|
||||||
<CurrentArchiveProvider>
|
<CurrentArchiveProvider>
|
||||||
<UploadsProvider>
|
<CurrentThemeProvider>
|
||||||
<ThemeHelmet />
|
<UploadsProvider>
|
||||||
<Screen />
|
<ThemeHelmet />
|
||||||
</UploadsProvider>
|
<Screen />
|
||||||
|
</UploadsProvider>
|
||||||
|
</CurrentThemeProvider>
|
||||||
</CurrentArchiveProvider>
|
</CurrentArchiveProvider>
|
||||||
</ModalLayerProvider>
|
</ModalLayerProvider>
|
||||||
</ConnectionsPinger>
|
</ConnectionsPinger>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import theme from './theme';
|
import dimensions from './theme/dimensions';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import TabsPanel from './TabsPanel';
|
import TabsPanel from './TabsPanel';
|
||||||
import TabContent from './TabContent';
|
import TabContent from './TabContent';
|
||||||
@@ -14,14 +14,15 @@ import { useSplitterDrag, HorizontalSplitHandle } from './widgets/Splitter';
|
|||||||
import { ModalLayer } from './modals/showModal';
|
import { ModalLayer } from './modals/showModal';
|
||||||
import DragAndDropFileTarget from './DragAndDropFileTarget';
|
import DragAndDropFileTarget from './DragAndDropFileTarget';
|
||||||
import { useUploadsZone } from './utility/UploadsProvider';
|
import { useUploadsZone } from './utility/UploadsProvider';
|
||||||
|
import useTheme from './theme/useTheme';
|
||||||
|
|
||||||
const BodyDiv = styled.div`
|
const BodyDiv = styled.div`
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: ${theme.tabsPanel.height + theme.toolBar.height}px;
|
top: ${dimensions.tabsPanel.height + dimensions.toolBar.height}px;
|
||||||
left: ${(props) => props.contentLeft}px;
|
left: ${(props) => props.contentLeft}px;
|
||||||
bottom: ${theme.statusBar.height}px;
|
bottom: ${dimensions.statusBar.height}px;
|
||||||
right: 0;
|
right: 0;
|
||||||
background-color: ${theme.mainArea.background};
|
background-color: ${(props) => props.theme.mainAreaBackground};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ToolBarDiv = styled.div`
|
const ToolBarDiv = styled.div`
|
||||||
@@ -29,36 +30,36 @@ const ToolBarDiv = styled.div`
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
background-color: ${theme.toolBar.background};
|
background-color: ${(props) => props.theme.toolBarBackground};
|
||||||
height: ${theme.toolBar.height}px;
|
height: ${dimensions.toolBar.height}px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const IconBar = styled.div`
|
const IconBar = styled.div`
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: ${theme.toolBar.height}px;
|
top: ${dimensions.toolBar.height}px;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: ${theme.statusBar.height}px;
|
bottom: ${dimensions.statusBar.height}px;
|
||||||
width: ${theme.widgetMenu.iconSize}px;
|
width: ${dimensions.widgetMenu.iconSize}px;
|
||||||
background-color: ${theme.widgetMenu.background};
|
background-color: ${(props) => props.theme.widgetBackground};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const LeftPanel = styled.div`
|
const LeftPanel = styled.div`
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: ${theme.toolBar.height}px;
|
top: ${dimensions.toolBar.height}px;
|
||||||
left: ${theme.widgetMenu.iconSize}px;
|
left: ${dimensions.widgetMenu.iconSize}px;
|
||||||
bottom: ${theme.statusBar.height}px;
|
bottom: ${dimensions.statusBar.height}px;
|
||||||
background-color: ${theme.leftPanel.background};
|
background-color: ${(props) => props.theme.leftPanelBackground};
|
||||||
display: flex;
|
display: flex;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TabsPanelContainer = styled.div`
|
const TabsPanelContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: ${theme.toolBar.height}px;
|
top: ${dimensions.toolBar.height}px;
|
||||||
left: ${(props) => props.contentLeft}px;
|
left: ${(props) => props.contentLeft}px;
|
||||||
height: ${theme.tabsPanel.height}px;
|
height: ${dimensions.tabsPanel.height}px;
|
||||||
right: 0;
|
right: 0;
|
||||||
background-color: ${theme.tabsPanel.background};
|
background-color: ${(props) => props.theme.tabsPanelBackground};
|
||||||
border-top: 1px solid #ccc;
|
border-top: 1px solid #ccc;
|
||||||
|
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
@@ -85,26 +86,27 @@ const TabsPanelContainer = styled.div`
|
|||||||
|
|
||||||
const StausBarContainer = styled.div`
|
const StausBarContainer = styled.div`
|
||||||
position: fixed;
|
position: fixed;
|
||||||
height: ${theme.statusBar.height}px;
|
height: ${dimensions.statusBar.height}px;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: ${theme.statusBar.background};
|
background-color: ${(props) => props.theme.statusBarBackground};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ScreenHorizontalSplitHandle = styled(HorizontalSplitHandle)`
|
const ScreenHorizontalSplitHandle = styled(HorizontalSplitHandle)`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: ${theme.toolBar.height}px;
|
top: ${dimensions.toolBar.height}px;
|
||||||
bottom: ${theme.statusBar.height}px;
|
bottom: ${dimensions.statusBar.height}px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default function Screen() {
|
export default function Screen() {
|
||||||
|
const theme = useTheme();
|
||||||
const currentWidget = useCurrentWidget();
|
const currentWidget = useCurrentWidget();
|
||||||
const leftPanelWidth = useLeftPanelWidth();
|
const leftPanelWidth = useLeftPanelWidth();
|
||||||
const setLeftPanelWidth = useSetLeftPanelWidth();
|
const setLeftPanelWidth = useSetLeftPanelWidth();
|
||||||
const contentLeft = currentWidget
|
const contentLeft = currentWidget
|
||||||
? theme.widgetMenu.iconSize + leftPanelWidth + theme.splitter.thickness
|
? dimensions.widgetMenu.iconSize + leftPanelWidth + dimensions.splitter.thickness
|
||||||
: theme.widgetMenu.iconSize;
|
: dimensions.widgetMenu.iconSize;
|
||||||
const toolbarPortalRef = React.useRef();
|
const toolbarPortalRef = React.useRef();
|
||||||
const onSplitDown = useSplitterDrag('clientX', (diff) => setLeftPanelWidth((v) => v + diff));
|
const onSplitDown = useSplitterDrag('clientX', (diff) => setLeftPanelWidth((v) => v + diff));
|
||||||
|
|
||||||
@@ -112,30 +114,30 @@ export default function Screen() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div {...getRootProps()}>
|
<div {...getRootProps()}>
|
||||||
<ToolBarDiv>
|
<ToolBarDiv theme={theme}>
|
||||||
<ToolBar toolbarPortalRef={toolbarPortalRef} />
|
<ToolBar toolbarPortalRef={toolbarPortalRef} />
|
||||||
</ToolBarDiv>
|
</ToolBarDiv>
|
||||||
<IconBar>
|
<IconBar theme={theme}>
|
||||||
<WidgetIconPanel />
|
<WidgetIconPanel />
|
||||||
</IconBar>
|
</IconBar>
|
||||||
{!!currentWidget && (
|
{!!currentWidget && (
|
||||||
<LeftPanel>
|
<LeftPanel theme={theme}>
|
||||||
<WidgetContainer />
|
<WidgetContainer />
|
||||||
</LeftPanel>
|
</LeftPanel>
|
||||||
)}
|
)}
|
||||||
{!!currentWidget && (
|
{!!currentWidget && (
|
||||||
<ScreenHorizontalSplitHandle
|
<ScreenHorizontalSplitHandle
|
||||||
onMouseDown={onSplitDown}
|
onMouseDown={onSplitDown}
|
||||||
style={{ left: leftPanelWidth + theme.widgetMenu.iconSize }}
|
style={{ left: leftPanelWidth + dimensions.widgetMenu.iconSize }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<TabsPanelContainer contentLeft={contentLeft}>
|
<TabsPanelContainer contentLeft={contentLeft} theme={theme}>
|
||||||
<TabsPanel></TabsPanel>
|
<TabsPanel></TabsPanel>
|
||||||
</TabsPanelContainer>
|
</TabsPanelContainer>
|
||||||
<BodyDiv contentLeft={contentLeft}>
|
<BodyDiv contentLeft={contentLeft} theme={theme}>
|
||||||
<TabContent toolbarPortalRef={toolbarPortalRef} />
|
<TabContent toolbarPortalRef={toolbarPortalRef} />
|
||||||
</BodyDiv>
|
</BodyDiv>
|
||||||
<StausBarContainer>
|
<StausBarContainer theme={theme}>
|
||||||
<StatusBar />
|
<StatusBar />
|
||||||
</StausBarContainer>
|
</StausBarContainer>
|
||||||
<ModalLayer />
|
<ModalLayer />
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import theme from './theme';
|
|
||||||
import { DropDownMenuItem, DropDownMenuDivider } from './modals/DropDownMenu';
|
import { DropDownMenuItem, DropDownMenuDivider } from './modals/DropDownMenu';
|
||||||
|
|
||||||
import { useOpenedTabs, useSetOpenedTabs, useCurrentDatabase, useSetCurrentDatabase } from './utility/globalState';
|
import { useOpenedTabs, useSetOpenedTabs, useCurrentDatabase, useSetCurrentDatabase } from './utility/globalState';
|
||||||
import { showMenu } from './modals/DropDownMenu';
|
import { showMenu } from './modals/DropDownMenu';
|
||||||
import { getConnectionInfo } from './utility/metadataLoaders';
|
import { getConnectionInfo } from './utility/metadataLoaders';
|
||||||
import { FontIcon } from './icons';
|
import { FontIcon } from './icons';
|
||||||
|
import useTheme from './theme/useTheme';
|
||||||
|
|
||||||
// const files = [
|
// const files = [
|
||||||
// { name: 'app.js' },
|
// { name: 'app.js' },
|
||||||
@@ -47,7 +47,7 @@ const DbNameWrapper = styled.div`
|
|||||||
}
|
}
|
||||||
background-color: ${(props) =>
|
background-color: ${(props) =>
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
props.selected ? theme.mainArea.background : 'inherit'};
|
props.selected ? props.theme.mainAreaBackground : 'inherit'};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// const DbNameWrapperInner = styled.div`
|
// const DbNameWrapperInner = styled.div`
|
||||||
@@ -67,11 +67,11 @@ const FileTabItem = styled.div`
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
&:hover {
|
&:hover {
|
||||||
color: ${theme.tabsPanel.hoverFont};
|
color: ${(props) => props.theme.tabsPanelHoverFont};
|
||||||
}
|
}
|
||||||
background-color: ${(props) =>
|
background-color: ${(props) =>
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
props.selected ? theme.mainArea.background : 'inherit'};
|
props.selected ? props.theme.mainAreaBackground : 'inherit'};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const FileNameWrapper = styled.span`
|
const FileNameWrapper = styled.span`
|
||||||
@@ -82,7 +82,7 @@ const CloseButton = styled(FontIcon)`
|
|||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
color: gray;
|
color: gray;
|
||||||
&:hover {
|
&:hover {
|
||||||
color: ${theme.tabsPanel.hoverFont};
|
color: ${(props) => props.theme.tabsPanelHoverFont};
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -124,6 +124,7 @@ function getDbIcon(key) {
|
|||||||
|
|
||||||
export default function TabsPanel() {
|
export default function TabsPanel() {
|
||||||
// const formatDbKey = (conid, database) => `${database}-${conid}`;
|
// const formatDbKey = (conid, database) => `${database}-${conid}`;
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
const tabs = useOpenedTabs();
|
const tabs = useOpenedTabs();
|
||||||
const setOpenedTabs = useSetOpenedTabs();
|
const setOpenedTabs = useSetOpenedTabs();
|
||||||
@@ -252,6 +253,7 @@ export default function TabsPanel() {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
selected={tabsByDb[dbKey][0].tabDbKey == currentDbKey}
|
selected={tabsByDb[dbKey][0].tabDbKey == currentDbKey}
|
||||||
onClick={() => handleSetDb(tabsByDb[dbKey][0].props)}
|
onClick={() => handleSetDb(tabsByDb[dbKey][0].props)}
|
||||||
|
theme={theme}
|
||||||
>
|
>
|
||||||
<FontIcon icon={getDbIcon(dbKey)} /> {tabsByDb[dbKey][0].tabDbName}
|
<FontIcon icon={getDbIcon(dbKey)} /> {tabsByDb[dbKey][0].tabDbName}
|
||||||
</DbNameWrapper>
|
</DbNameWrapper>
|
||||||
@@ -261,6 +263,7 @@ export default function TabsPanel() {
|
|||||||
{...tab}
|
{...tab}
|
||||||
title={tab.tooltip}
|
title={tab.tooltip}
|
||||||
key={tab.tabid}
|
key={tab.tabid}
|
||||||
|
theme={theme}
|
||||||
onClick={(e) => handleTabClick(e, tab.tabid)}
|
onClick={(e) => handleTabClick(e, tab.tabid)}
|
||||||
onMouseUp={(e) => handleMouseUp(e, tab.tabid)}
|
onMouseUp={(e) => handleMouseUp(e, tab.tabid)}
|
||||||
onContextMenu={(e) => handleContextMenu(e, tab.tabid, tab.props)}
|
onContextMenu={(e) => handleContextMenu(e, tab.tabid, tab.props)}
|
||||||
@@ -270,6 +273,7 @@ export default function TabsPanel() {
|
|||||||
<CloseButton
|
<CloseButton
|
||||||
icon="icon close"
|
icon="icon close"
|
||||||
className="tabCloseButton"
|
className="tabCloseButton"
|
||||||
|
theme={theme}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
closeTab(tab.tabid);
|
closeTab(tab.tabid);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import theme from '../theme';
|
|
||||||
import keycodes from '../utility/keycodes';
|
import keycodes from '../utility/keycodes';
|
||||||
|
|
||||||
const StyledInput = styled.input`
|
const StyledInput = styled.input`
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import theme from '../theme';
|
|
||||||
|
|
||||||
export const ManagerInnerContainer = styled.div`
|
export const ManagerInnerContainer = styled.div`
|
||||||
flex: 1 1;
|
flex: 1 1;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ToolbarButton from '../widgets/ToolbarButton';
|
import ToolbarButton from '../widgets/ToolbarButton';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import theme from '../theme';
|
import dimensions from '../theme/dimensions';
|
||||||
import { FontIcon } from '../icons';
|
import { FontIcon } from '../icons';
|
||||||
|
|
||||||
const Container = styled.div`
|
const Container = styled.div`
|
||||||
@@ -9,8 +9,8 @@ const Container = styled.div`
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: #ddeeee;
|
background: #ddeeee;
|
||||||
height: ${theme.toolBar.height}px;
|
height: ${dimensions.toolBar.height}px;
|
||||||
min-height: ${theme.toolBar.height}px;
|
min-height: ${dimensions.toolBar.height}px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-top: 1px solid #ccc;
|
border-top: 1px solid #ccc;
|
||||||
border-bottom: 1px solid #ccc;
|
border-bottom: 1px solid #ccc;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import ToolbarButton from '../widgets/ToolbarButton';
|
import ToolbarButton from '../widgets/ToolbarButton';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { TabPage, TabControl } from '../widgets/TabControl';
|
import { TabPage, TabControl } from '../widgets/TabControl';
|
||||||
import theme from '../theme';
|
import dimensions from '../theme/dimensions';
|
||||||
import JavaScriptEditor from '../sqleditor/JavaScriptEditor';
|
import JavaScriptEditor from '../sqleditor/JavaScriptEditor';
|
||||||
import MacroParameters from './MacroParameters';
|
import MacroParameters from './MacroParameters';
|
||||||
import { WidgetTitle } from '../widgets/WidgetStyles';
|
import { WidgetTitle } from '../widgets/WidgetStyles';
|
||||||
@@ -15,8 +15,8 @@ const Container = styled.div`
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: #ddeeee;
|
background: #ddeeee;
|
||||||
height: ${theme.toolBar.height}px;
|
height: ${dimensions.toolBar.height}px;
|
||||||
min-height: ${theme.toolBar.height}px;
|
min-height: ${dimensions.toolBar.height}px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-top: 1px solid #ccc;
|
border-top: 1px solid #ccc;
|
||||||
border-bottom: 1px solid #ccc;
|
border-bottom: 1px solid #ccc;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ const iconNames = {
|
|||||||
'icon format-code': 'mdi mdi-code-tags-check',
|
'icon format-code': 'mdi mdi-code-tags-check',
|
||||||
'icon show-wizard': 'mdi mdi-comment-edit',
|
'icon show-wizard': 'mdi mdi-comment-edit',
|
||||||
'icon disconnected': 'mdi mdi-lan-disconnect',
|
'icon disconnected': 'mdi mdi-lan-disconnect',
|
||||||
|
'icon theme': 'mdi mdi-brightness-6',
|
||||||
|
|
||||||
'icon run': 'mdi mdi-play',
|
'icon run': 'mdi mdi-play',
|
||||||
'icon chevron-down': 'mdi mdi-chevron-down',
|
'icon chevron-down': 'mdi mdi-chevron-down',
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import useFetch from '../utility/useFetch';
|
|
||||||
import styled from 'styled-components';
|
|
||||||
import theme from '../theme';
|
|
||||||
import DataGrid from '../datagrid/DataGrid';
|
import DataGrid from '../datagrid/DataGrid';
|
||||||
import { ViewGridDisplay, createGridCache, createChangeSet } from '@dbgate/datalib';
|
import { ViewGridDisplay, createGridCache, createChangeSet } from '@dbgate/datalib';
|
||||||
import { useConnectionInfo, useViewInfo } from '../utility/metadataLoaders';
|
import { useConnectionInfo, useViewInfo } from '../utility/metadataLoaders';
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
export default {
|
|
||||||
widgetMenu: {
|
|
||||||
iconSize: 60,
|
|
||||||
background: '#222',
|
|
||||||
iconFontSize: '23pt',
|
|
||||||
iconFontColor: '#eee',
|
|
||||||
backgroundHover: '#555',
|
|
||||||
backgroundSelected: '#4CAF50',
|
|
||||||
},
|
|
||||||
leftPanel: {
|
|
||||||
// width: 300,
|
|
||||||
background: '#ccc',
|
|
||||||
},
|
|
||||||
tabsPanel: {
|
|
||||||
height: 53,
|
|
||||||
background: '#ddd',
|
|
||||||
hoverFont: '#338',
|
|
||||||
},
|
|
||||||
statusBar: {
|
|
||||||
height: 20,
|
|
||||||
background: '#00c',
|
|
||||||
},
|
|
||||||
toolBar: {
|
|
||||||
height: 30,
|
|
||||||
background: '#eee',
|
|
||||||
},
|
|
||||||
mainArea: {
|
|
||||||
background: '#eee',
|
|
||||||
},
|
|
||||||
splitter: {
|
|
||||||
thickness: 3,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
33
packages/web/src/theme/_theme.bak.js
Normal file
33
packages/web/src/theme/_theme.bak.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
// export default {
|
||||||
|
// widgetMenu: {
|
||||||
|
// iconSize: 60,
|
||||||
|
// background: '#222',
|
||||||
|
// iconFontSize: '23pt',
|
||||||
|
// iconFontColor: '#eee',
|
||||||
|
// backgroundHover: '#555',
|
||||||
|
// backgroundSelected: '#4CAF50',
|
||||||
|
// },
|
||||||
|
// leftPanel: {
|
||||||
|
// // width: 300,
|
||||||
|
// background: '#ccc',
|
||||||
|
// },
|
||||||
|
// tabsPanel: {
|
||||||
|
// height: 53,
|
||||||
|
// background: '#ddd',
|
||||||
|
// hoverFont: '#338',
|
||||||
|
// },
|
||||||
|
// statusBar: {
|
||||||
|
// height: 20,
|
||||||
|
// background: '#00c',
|
||||||
|
// },
|
||||||
|
// toolBar: {
|
||||||
|
// height: 30,
|
||||||
|
// background: '#eee',
|
||||||
|
// },
|
||||||
|
// mainArea: {
|
||||||
|
// background: '#eee',
|
||||||
|
// },
|
||||||
|
// splitter: {
|
||||||
|
// thickness: 3,
|
||||||
|
// },
|
||||||
|
// };
|
||||||
20
packages/web/src/theme/dark.js
Normal file
20
packages/web/src/theme/dark.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
export default {
|
||||||
|
background: '#000',
|
||||||
|
iconFontColor: '#eee',
|
||||||
|
backgroundHover: '#555',
|
||||||
|
backgroundSelected: '#4CAF50',
|
||||||
|
|
||||||
|
leftPanelBackground: '#ccc',
|
||||||
|
|
||||||
|
widgetBackground: '#222',
|
||||||
|
widgetIconFontColor: '#eee',
|
||||||
|
widgetBackgroundHover: '#555',
|
||||||
|
widgetBackgroundSelected: '#4CAF50',
|
||||||
|
|
||||||
|
tabsPanelBackground: '#ccc',
|
||||||
|
tabsPanelHoverFont: '#338',
|
||||||
|
|
||||||
|
statusBarBackground: '#00c',
|
||||||
|
toolBarBackground: '#eee',
|
||||||
|
mainAreaBackground: '#333',
|
||||||
|
};
|
||||||
18
packages/web/src/theme/dimensions.js
Normal file
18
packages/web/src/theme/dimensions.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
export default {
|
||||||
|
widgetMenu: {
|
||||||
|
iconSize: 60,
|
||||||
|
iconFontSize: '23pt',
|
||||||
|
},
|
||||||
|
tabsPanel: {
|
||||||
|
height: 53,
|
||||||
|
},
|
||||||
|
statusBar: {
|
||||||
|
height: 20,
|
||||||
|
},
|
||||||
|
toolBar: {
|
||||||
|
height: 30,
|
||||||
|
},
|
||||||
|
splitter: {
|
||||||
|
thickness: 3,
|
||||||
|
},
|
||||||
|
};
|
||||||
20
packages/web/src/theme/light.js
Normal file
20
packages/web/src/theme/light.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
export default {
|
||||||
|
background: '#222',
|
||||||
|
iconFontColor: '#eee',
|
||||||
|
backgroundHover: '#555',
|
||||||
|
backgroundSelected: '#4CAF50',
|
||||||
|
|
||||||
|
leftPanelBackground: '#ccc',
|
||||||
|
|
||||||
|
widgetBackground: '#222',
|
||||||
|
widgetIconFontColor: '#eee',
|
||||||
|
widgetBackgroundHover: '#555',
|
||||||
|
widgetBackgroundSelected: '#4CAF50',
|
||||||
|
|
||||||
|
tabsPanelBackground: '#ccc',
|
||||||
|
tabsPanelHoverFont: '#338',
|
||||||
|
|
||||||
|
statusBarBackground: '#00c',
|
||||||
|
toolBarBackground: '#eee',
|
||||||
|
mainAreaBackground: '#eee',
|
||||||
|
};
|
||||||
10
packages/web/src/theme/useTheme.js
Normal file
10
packages/web/src/theme/useTheme.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { useCurrentTheme } from '../utility/globalState';
|
||||||
|
import light from './light';
|
||||||
|
import dark from './dark';
|
||||||
|
|
||||||
|
const themes = { light, dark };
|
||||||
|
|
||||||
|
export default function useTheme() {
|
||||||
|
const currentTheme = useCurrentTheme();
|
||||||
|
return themes[currentTheme];
|
||||||
|
}
|
||||||
@@ -119,3 +119,7 @@ export { LeftPanelWidthProvider, useLeftPanelWidth, useSetLeftPanelWidth };
|
|||||||
const [CurrentArchiveProvider, useCurrentArchive, useSetCurrentArchive] = createGlobalState('default');
|
const [CurrentArchiveProvider, useCurrentArchive, useSetCurrentArchive] = createGlobalState('default');
|
||||||
|
|
||||||
export { CurrentArchiveProvider, useCurrentArchive, useSetCurrentArchive };
|
export { CurrentArchiveProvider, useCurrentArchive, useSetCurrentArchive };
|
||||||
|
|
||||||
|
const [CurrentThemeProvider, useCurrentTheme, useSetCurrentTheme] = createGlobalState('light');
|
||||||
|
|
||||||
|
export { CurrentThemeProvider, useCurrentTheme, useSetCurrentTheme };
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import theme from '../theme';
|
import dimensions from '../theme/dimensions';
|
||||||
|
|
||||||
const ButtonInput = styled.input`
|
const ButtonInput = styled.input`
|
||||||
// height: ${theme.toolBar.height - 5}px;
|
// height: ${dimensions.toolBar.height - 5}px;
|
||||||
border: 1px solid #2e6da4;
|
border: 1px solid #2e6da4;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import theme from '../theme';
|
|
||||||
|
|
||||||
const ButtonDiv = styled.div`
|
const ButtonDiv = styled.div`
|
||||||
//box-shadow: 3px 4px 0px 0px #899599;
|
//box-shadow: 3px 4px 0px 0px #899599;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import _ from 'lodash';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import useDimensions from '../utility/useDimensions';
|
import useDimensions from '../utility/useDimensions';
|
||||||
import theme from '../theme';
|
import dimensions from '../theme/dimensions';
|
||||||
|
|
||||||
const SplitterMainBase = styled.div`
|
const SplitterMainBase = styled.div`
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -28,7 +28,7 @@ const HorizontalMainContainer = styled(SplitterMainBase)`
|
|||||||
|
|
||||||
export const VerticalSplitHandle = styled.div`
|
export const VerticalSplitHandle = styled.div`
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
height: ${theme.splitter.thickness}px;
|
height: ${dimensions.splitter.thickness}px;
|
||||||
cursor: row-resize;
|
cursor: row-resize;
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #AAA;
|
background-color: #AAA;
|
||||||
@@ -37,7 +37,7 @@ export const VerticalSplitHandle = styled.div`
|
|||||||
|
|
||||||
export const HorizontalSplitHandle = styled.div`
|
export const HorizontalSplitHandle = styled.div`
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
width: ${theme.splitter.thickness}px;
|
width: ${dimensions.splitter.thickness}px;
|
||||||
cursor: col-resize;
|
cursor: col-resize;
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #AAA;
|
background-color: #AAA;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import theme from '../theme';
|
import useTheme from '../theme/useTheme';
|
||||||
|
import dimensions from '../theme/dimensions';
|
||||||
|
|
||||||
const TabItem = styled.div`
|
const TabItem = styled.div`
|
||||||
border-right: 1px solid white;
|
border-right: 1px solid white;
|
||||||
@@ -11,11 +12,11 @@ const TabItem = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
&:hover {
|
&:hover {
|
||||||
color: ${theme.tabsPanel.hoverFont};
|
color: ${(props) => props.theme.tabsPanelHoverFont};
|
||||||
}
|
}
|
||||||
background-color: ${(props) =>
|
background-color: ${(props) =>
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
props.selected ? theme.mainArea.background : 'inherit'};
|
props.selected ? props.theme.mainAreaBackground : 'inherit'};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TabNameWrapper = styled.span`
|
const TabNameWrapper = styled.span`
|
||||||
@@ -41,9 +42,9 @@ const TabContainer = styled.div`
|
|||||||
|
|
||||||
const TabsContainer = styled.div`
|
const TabsContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
height: ${theme.tabsPanel.height}px;
|
height: ${dimensions.tabsPanel.height}px;
|
||||||
right: 0;
|
right: 0;
|
||||||
background-color: ${theme.tabsPanel.background};
|
background-color: ${(props) => props.theme.tabsPanelBackground};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TabContentContainer = styled.div`
|
const TabContentContainer = styled.div`
|
||||||
@@ -72,6 +73,8 @@ export function TabControl({ children, activePageIndex = undefined }) {
|
|||||||
if (activePageIndex != null) setValue(activePageIndex);
|
if (activePageIndex != null) setValue(activePageIndex);
|
||||||
}, [activePageIndex]);
|
}, [activePageIndex]);
|
||||||
|
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
// // cleanup closed tabs
|
// // cleanup closed tabs
|
||||||
// if (_.difference(_.keys(mountedTabs), _.map(childrenArray, 'props.key')).length > 0) {
|
// if (_.difference(_.keys(mountedTabs), _.map(childrenArray, 'props.key')).length > 0) {
|
||||||
// setMountedTabs(_.pickBy(mountedTabs, (v, k) => childrenArray.find((x) => x.props.key == k)));
|
// setMountedTabs(_.pickBy(mountedTabs, (v, k) => childrenArray.find((x) => x.props.key == k)));
|
||||||
@@ -79,12 +82,12 @@ export function TabControl({ children, activePageIndex = undefined }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<MainContainer>
|
<MainContainer>
|
||||||
<TabsContainer>
|
<TabsContainer theme={theme}>
|
||||||
{childrenArray
|
{childrenArray
|
||||||
.filter((x) => x.props)
|
.filter((x) => x.props)
|
||||||
.map((tab, index) => (
|
.map((tab, index) => (
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
<TabItem key={index} onClick={() => setValue(index)} selected={value == index}>
|
<TabItem key={index} onClick={() => setValue(index)} selected={value == index} theme={theme}>
|
||||||
<TabNameWrapper>{tab.props.label}</TabNameWrapper>
|
<TabNameWrapper>{tab.props.label}</TabNameWrapper>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import styled from 'styled-components';
|
|||||||
import ToolbarButton from './ToolbarButton';
|
import ToolbarButton from './ToolbarButton';
|
||||||
import useNewQuery from '../query/useNewQuery';
|
import useNewQuery from '../query/useNewQuery';
|
||||||
import { useConfig } from '../utility/metadataLoaders';
|
import { useConfig } from '../utility/metadataLoaders';
|
||||||
import { useSetOpenedTabs, useOpenedTabs } from '../utility/globalState';
|
import { useSetOpenedTabs, useOpenedTabs, useCurrentTheme, useSetCurrentTheme } from '../utility/globalState';
|
||||||
import { openNewTab } from '../utility/common';
|
import { openNewTab } from '../utility/common';
|
||||||
import useNewFreeTable from '../freetable/useNewFreeTable';
|
import useNewFreeTable from '../freetable/useNewFreeTable';
|
||||||
import ImportExportModal from '../modals/ImportExportModal';
|
import ImportExportModal from '../modals/ImportExportModal';
|
||||||
@@ -25,6 +25,8 @@ export default function ToolBar({ toolbarPortalRef }) {
|
|||||||
const setOpenedTabs = useSetOpenedTabs();
|
const setOpenedTabs = useSetOpenedTabs();
|
||||||
const openedTabs = useOpenedTabs();
|
const openedTabs = useOpenedTabs();
|
||||||
const showModal = useShowModal();
|
const showModal = useShowModal();
|
||||||
|
const currentTheme = useCurrentTheme();
|
||||||
|
const setCurrentTheme = useSetCurrentTheme();
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
window['dbgate_createNewConnection'] = modalState.open;
|
window['dbgate_createNewConnection'] = modalState.open;
|
||||||
@@ -47,6 +49,11 @@ export default function ToolBar({ toolbarPortalRef }) {
|
|||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const switchTheme = () => {
|
||||||
|
if (currentTheme == 'light') setCurrentTheme('dark');
|
||||||
|
else setCurrentTheme('light');
|
||||||
|
};
|
||||||
|
|
||||||
function openTabFromButton(button) {
|
function openTabFromButton(button) {
|
||||||
if (openedTabs.find((x) => x.tabComponent == 'InfoPageTab' && x.props && x.props.page == button.page)) {
|
if (openedTabs.find((x) => x.tabComponent == 'InfoPageTab' && x.props && x.props.page == button.page)) {
|
||||||
setOpenedTabs((tabs) =>
|
setOpenedTabs((tabs) =>
|
||||||
@@ -100,6 +107,9 @@ export default function ToolBar({ toolbarPortalRef }) {
|
|||||||
<ToolbarButton onClick={showImport} icon="icon import">
|
<ToolbarButton onClick={showImport} icon="icon import">
|
||||||
Import data
|
Import data
|
||||||
</ToolbarButton>
|
</ToolbarButton>
|
||||||
|
<ToolbarButton onClick={switchTheme} icon="icon theme">
|
||||||
|
Switch theme
|
||||||
|
</ToolbarButton>
|
||||||
|
|
||||||
<ToolbarContainer ref={toolbarPortalRef}></ToolbarContainer>
|
<ToolbarContainer ref={toolbarPortalRef}></ToolbarContainer>
|
||||||
</ToolbarContainer>
|
</ToolbarContainer>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { FontIcon } from '../icons';
|
import { FontIcon } from '../icons';
|
||||||
import theme from '../theme';
|
import dimensions from '../theme/dimensions';
|
||||||
|
|
||||||
const ButtonDiv = styled.div`
|
const ButtonDiv = styled.div`
|
||||||
padding: 5px 15px;
|
padding: 5px 15px;
|
||||||
@@ -10,7 +10,7 @@ const ButtonDiv = styled.div`
|
|||||||
color: black;
|
color: black;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-right: 1px solid #ccc;
|
border-right: 1px solid #ccc;
|
||||||
height: ${theme.toolBar.height}px;
|
height: ${dimensions.toolBar.height}px;
|
||||||
|
|
||||||
${(props) =>
|
${(props) =>
|
||||||
!props.disabled &&
|
!props.disabled &&
|
||||||
|
|||||||
@@ -1,25 +1,27 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import theme from '../theme';
|
import dimensions from '../theme/dimensions';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { useCurrentWidget, useSetCurrentWidget } from '../utility/globalState';
|
import { useCurrentWidget, useSetCurrentWidget } from '../utility/globalState';
|
||||||
import { FontIcon } from '../icons';
|
import { FontIcon } from '../icons';
|
||||||
|
import useTheme from '../theme/useTheme';
|
||||||
|
|
||||||
const IconWrapper = styled.div`
|
const IconWrapper = styled.div`
|
||||||
color: ${theme.widgetMenu.iconFontColor};
|
color: ${(props) => props.theme.widgetIconFontColor};
|
||||||
font-size: ${theme.widgetMenu.iconFontSize};
|
font-size: ${dimensions.widgetMenu.iconFontSize};
|
||||||
height: ${theme.widgetMenu.iconSize}px;
|
height: ${dimensions.widgetMenu.iconSize}px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background-color: ${(props) =>
|
background-color: ${(props) =>
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
props.isSelected ? theme.widgetMenu.backgroundSelected : 'inherit'};
|
props.isSelected ? props.theme.widgetBackgroundSelected : 'inherit'};
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: ${theme.widgetMenu.backgroundHover};
|
background-color: ${(props) => props.theme.widgetBackgroundHover};
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default function WidgetIconPanel() {
|
export default function WidgetIconPanel() {
|
||||||
|
const theme = useTheme();
|
||||||
const widgets = [
|
const widgets = [
|
||||||
{
|
{
|
||||||
icon: 'icon database',
|
icon: 'icon database',
|
||||||
@@ -62,6 +64,7 @@ export default function WidgetIconPanel() {
|
|||||||
isSelected={name === currentWidget}
|
isSelected={name === currentWidget}
|
||||||
onClick={() => setCurrentWidget(name === currentWidget ? null : name)}
|
onClick={() => setCurrentWidget(name === currentWidget ? null : name)}
|
||||||
title={title}
|
title={title}
|
||||||
|
theme={theme}
|
||||||
>
|
>
|
||||||
<FontIcon icon={icon} />
|
<FontIcon icon={icon} />
|
||||||
</IconWrapper>
|
</IconWrapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user