From a7fcf1d3a313f2add76e4e4742833ee4a8bc32dd Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Mon, 9 Nov 2020 19:33:46 +0100 Subject: [PATCH] used mdi icons instead of font awesome --- packages/api/.env | 2 +- packages/web/package.json | 1 + packages/web/src/App.js | 2 ++ packages/web/src/DragAndDropFileTarget.js | 2 +- packages/web/src/TabsPanel.js | 14 ++++++------- packages/web/src/appobj/AppObjects.js | 4 ++-- packages/web/src/appobj/MacroAppObject.js | 1 - .../web/src/appobj/archiveFileAppObject.js | 1 - .../web/src/appobj/archiveFolderAppObject.js | 1 - .../web/src/appobj/connectionAppObject.js | 8 ++++---- .../web/src/datagrid/ColumnHeaderControl.js | 4 ++-- .../web/src/datagrid/DataFilterControl.js | 2 +- packages/web/src/datagrid/DataGridCore.js | 2 +- .../src/freetable/FreeTableColumnEditor.js | 12 ++++++----- .../src/impexp/ImportExportConfigurator.js | 4 ++-- packages/web/src/modals/ErrorMessageModal.js | 2 +- packages/web/src/modals/ModalHeader.js | 2 +- packages/web/src/themes/ThemeHelmet.js | 15 ++++++++++++++ packages/web/src/widgets/DatabaseWidget.js | 2 +- packages/web/src/widgets/DropDownButton.js | 2 +- packages/web/src/widgets/ErrorInfo.js | 6 +++--- packages/web/src/widgets/LoadingInfo.js | 2 +- packages/web/src/widgets/StatusBar.js | 17 +++++++--------- packages/web/src/widgets/WidgetIconPanel.js | 8 ++++---- yarn.lock | 20 +++++++++++++++++++ 25 files changed, 85 insertions(+), 51 deletions(-) create mode 100644 packages/web/src/themes/ThemeHelmet.js diff --git a/packages/api/.env b/packages/api/.env index 26afcf6a..acb9ad17 100644 --- a/packages/api/.env +++ b/packages/api/.env @@ -15,7 +15,7 @@ PORT_postgres=5433 ENGINE_postgres=postgres TOOLBAR=home -ICON_home=fas fa-home +ICON_home=mdi mdi-home TITLE_home=Home PAGE_home=home.html STARTUP_PAGES=home diff --git a/packages/web/package.json b/packages/web/package.json index a55861da..3083362b 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -21,6 +21,7 @@ "react-ace": "^8.0.0", "react-dom": "^16.12.0", "react-dropzone": "^11.2.3", + "react-helmet": "^6.1.0", "react-json-view": "^1.19.1", "react-modal": "^3.11.1", "react-scripts": "3.3.0", diff --git a/packages/web/src/App.js b/packages/web/src/App.js index 2ca0f209..8e9e39fb 100644 --- a/packages/web/src/App.js +++ b/packages/web/src/App.js @@ -14,6 +14,7 @@ import { SocketProvider } from './utility/SocketProvider'; import ConnectionsPinger from './utility/ConnectionsPinger'; import { ModalLayerProvider } from './modals/showModal'; import UploadsProvider from './utility/UploadsProvider'; +import ThemeHelmet from './themes/ThemeHelmet'; function App() { return ( @@ -28,6 +29,7 @@ function App() { + diff --git a/packages/web/src/DragAndDropFileTarget.js b/packages/web/src/DragAndDropFileTarget.js index 2041aa49..810045ad 100644 --- a/packages/web/src/DragAndDropFileTarget.js +++ b/packages/web/src/DragAndDropFileTarget.js @@ -41,7 +41,7 @@ export default function DragAndDropFileTarget({ isDragActive, inputProps }) { - + Drop the files to upload to DbGate Supported file types: csv, MS Excel, json-lines diff --git a/packages/web/src/TabsPanel.js b/packages/web/src/TabsPanel.js index abbc02e1..844a3eee 100644 --- a/packages/web/src/TabsPanel.js +++ b/packages/web/src/TabsPanel.js @@ -78,7 +78,7 @@ const FileNameWrapper = styled.span` margin-left: 5px; `; -const CloseButton = styled.i` +const CloseButton = styled.span` margin-left: 5px; color: gray; &:hover { @@ -117,9 +117,9 @@ function getTabDbKey(tab) { } function getDbIcon(key) { - if (key.startsWith('database://')) return 'fas fa-database'; - if (key.startsWith('archive://')) return 'fas fa-archive'; - return 'fas fa-file'; + if (key.startsWith('database://')) return 'mdi mdi-database'; + if (key.startsWith('archive://')) return 'mdi mdi-archive'; + return 'mdi mdi-file'; } export default function TabsPanel() { @@ -253,7 +253,7 @@ export default function TabsPanel() { selected={tabsByDb[dbKey][0].tabDbKey == currentDbKey} onClick={() => handleSetDb(tabsByDb[dbKey][0].props)} > - {tabsByDb[dbKey][0].tabDbName} + {tabsByDb[dbKey][0].tabDbName} {_.sortBy(tabsByDb[dbKey], 'title').map((tab) => ( @@ -265,10 +265,10 @@ export default function TabsPanel() { onMouseUp={(e) => handleMouseUp(e, tab.tabid)} onContextMenu={(e) => handleContextMenu(e, tab.tabid, tab.props)} > - {tab.busy ? : getIconImage(tab.icon)} + {tab.busy ? : getIconImage(tab.icon)} {tab.title} { e.preventDefault(); closeTab(tab.tabid); diff --git a/packages/web/src/appobj/AppObjects.js b/packages/web/src/appobj/AppObjects.js index d074714f..0554bcfd 100644 --- a/packages/web/src/appobj/AppObjects.js +++ b/packages/web/src/appobj/AppObjects.js @@ -68,11 +68,11 @@ export function AppObjectCore({ {...other} > {prefix} - {isBusy ? : } + {isBusy ? : } {title} {statusIcon && ( - + )} diff --git a/packages/web/src/appobj/MacroAppObject.js b/packages/web/src/appobj/MacroAppObject.js index 7b3e1e39..7ced3ad7 100644 --- a/packages/web/src/appobj/MacroAppObject.js +++ b/packages/web/src/appobj/MacroAppObject.js @@ -4,7 +4,6 @@ import { MacroIcon, StartIcon } from '../icons'; const macroAppObject = () => ({ name, type, title, group }, { setOpenedTabs }) => { const key = name; - // const Icon = (props) => ; const Icon = MacroIcon; const matcher = (filter) => filterName(filter, name, title); const groupTitle = group; diff --git a/packages/web/src/appobj/archiveFileAppObject.js b/packages/web/src/appobj/archiveFileAppObject.js index 4a691834..fb182fb0 100644 --- a/packages/web/src/appobj/archiveFileAppObject.js +++ b/packages/web/src/appobj/archiveFileAppObject.js @@ -60,7 +60,6 @@ function Menu({ data, setOpenedTabs }) { const archiveFileAppObject = () => ({ fileName, folderName }, { setOpenedTabs }) => { const key = fileName; - // const Icon = (props) => ; const Icon = ArchiveTableIcon; const onClick = () => { openArchive(setOpenedTabs, fileName, folderName); diff --git a/packages/web/src/appobj/archiveFolderAppObject.js b/packages/web/src/appobj/archiveFolderAppObject.js index d6621314..b2b51db1 100644 --- a/packages/web/src/appobj/archiveFolderAppObject.js +++ b/packages/web/src/appobj/archiveFolderAppObject.js @@ -19,7 +19,6 @@ function Menu({ data, setOpenedTabs }) { const archiveFolderAppObject = () => ({ name }, { setOpenedTabs, currentArchive }) => { const key = name; - // const Icon = (props) => ; const Icon = LocalDbIcon; const isBold = name == currentArchive; const matcher = (filter) => filterName(filter, name); diff --git a/packages/web/src/appobj/connectionAppObject.js b/packages/web/src/appobj/connectionAppObject.js index 39f9f362..52cc2dc4 100644 --- a/packages/web/src/appobj/connectionAppObject.js +++ b/packages/web/src/appobj/connectionAppObject.js @@ -77,10 +77,10 @@ const connectionAppObject = (flags) => ( let statusIcon = null; let statusTitle = null; if (openedConnections.includes(_id)) { - if (!status) statusIcon = 'fas fa-spinner fa-spin'; - else if (status.name == 'pending') statusIcon = 'fas fa-spinner fa-spin'; - else if (status.name == 'ok') statusIcon = 'fas fa-check-circle green'; - else statusIcon = 'fas fa-times-circle red'; + if (!status) statusIcon = 'mdi mdi-loading mdi-spin'; + else if (status.name == 'pending') statusIcon = 'mdi mdi-loading mdi-spin'; + else if (status.name == 'ok') statusIcon = 'mdi mdi-check-circle color-green'; + else statusIcon = 'mdi mdi-close-circle color-red'; if (status && status.name == 'error') { statusTitle = status.message; } diff --git a/packages/web/src/datagrid/ColumnHeaderControl.js b/packages/web/src/datagrid/ColumnHeaderControl.js index b2c467e7..885b6e7d 100644 --- a/packages/web/src/datagrid/ColumnHeaderControl.js +++ b/packages/web/src/datagrid/ColumnHeaderControl.js @@ -87,12 +87,12 @@ export default function ColumnHeaderControl({ {order == 'ASC' && ( - + )} {order == 'DESC' && ( - + )} diff --git a/packages/web/src/datagrid/DataFilterControl.js b/packages/web/src/datagrid/DataFilterControl.js index 34f1cda1..be7a2b30 100644 --- a/packages/web/src/datagrid/DataFilterControl.js +++ b/packages/web/src/datagrid/DataFilterControl.js @@ -291,7 +291,7 @@ export default function DataFilterControl({ autocomplete="off" /> - + ); diff --git a/packages/web/src/datagrid/DataGridCore.js b/packages/web/src/datagrid/DataGridCore.js index 5ad2c1a8..d40d05f8 100644 --- a/packages/web/src/datagrid/DataGridCore.js +++ b/packages/web/src/datagrid/DataGridCore.js @@ -971,7 +971,7 @@ export default function DataGridCore(props) { > {filterCount > 0 && ( - + )} diff --git a/packages/web/src/freetable/FreeTableColumnEditor.js b/packages/web/src/freetable/FreeTableColumnEditor.js index de02355e..9c4bc3ac 100644 --- a/packages/web/src/freetable/FreeTableColumnEditor.js +++ b/packages/web/src/freetable/FreeTableColumnEditor.js @@ -27,8 +27,10 @@ const Name = styled.div` const Buttons = styled.div` white-space: nowrap; `; -const Icon = styled(FontIcon)` +const Icon = styled.span` // margin-left: 5px; + position: relative; + top: 5px; &:hover { background-color: gray; } @@ -103,10 +105,10 @@ function ColumnManagerRow({ column, onEdit, onRemove, onUp, onDown }) { setIsHover(true)} onMouseLeave={() => setIsHover(false)}> {column.columnName} - - - - + + + + ); diff --git a/packages/web/src/impexp/ImportExportConfigurator.js b/packages/web/src/impexp/ImportExportConfigurator.js index d6ea8402..4f32301f 100644 --- a/packages/web/src/impexp/ImportExportConfigurator.js +++ b/packages/web/src/impexp/ImportExportConfigurator.js @@ -294,7 +294,7 @@ function SourceName({ name }) {
{name}
- +
); @@ -352,7 +352,7 @@ export default function ImportExportConfigurator({ uploadedFile = undefined }) { engine={sourceEngine} /> - + - + {message} diff --git a/packages/web/src/modals/ModalHeader.js b/packages/web/src/modals/ModalHeader.js index 24793830..9130973f 100644 --- a/packages/web/src/modals/ModalHeader.js +++ b/packages/web/src/modals/ModalHeader.js @@ -23,7 +23,7 @@ export default function ModalHeader({ children, modalState }) {
{children}
- +
); diff --git a/packages/web/src/themes/ThemeHelmet.js b/packages/web/src/themes/ThemeHelmet.js new file mode 100644 index 00000000..59dfd9d1 --- /dev/null +++ b/packages/web/src/themes/ThemeHelmet.js @@ -0,0 +1,15 @@ +import React from 'react'; +import { Helmet } from 'react-helmet'; + +export default function ThemeHelmet() { + return ( + + + + ); +} diff --git a/packages/web/src/widgets/DatabaseWidget.js b/packages/web/src/widgets/DatabaseWidget.js index cebef081..61472140 100644 --- a/packages/web/src/widgets/DatabaseWidget.js +++ b/packages/web/src/widgets/DatabaseWidget.js @@ -126,7 +126,7 @@ function SqlObjectListWrapper() { const db = useCurrentDatabase(); if (!db) { - return ; + return ; } const { name, connection } = db; diff --git a/packages/web/src/widgets/DropDownButton.js b/packages/web/src/widgets/DropDownButton.js index 62f7e69d..52c91ac4 100644 --- a/packages/web/src/widgets/DropDownButton.js +++ b/packages/web/src/widgets/DropDownButton.js @@ -12,7 +12,7 @@ export default function DropDownButton({ children }) { return ( - + ); } diff --git a/packages/web/src/widgets/ErrorInfo.js b/packages/web/src/widgets/ErrorInfo.js index 03905eff..b4869f85 100644 --- a/packages/web/src/widgets/ErrorInfo.js +++ b/packages/web/src/widgets/ErrorInfo.js @@ -19,11 +19,11 @@ const ContainerSmall = styled.div` margin-right: 10px; `; -export default function ErrorInfo({ message, icon = 'fas fa-times-circle red', isSmall = false }) { +export default function ErrorInfo({ message, icon = 'mdi mdi-close-circle color-red', isSmall = false }) { if (isSmall) { return ( - + {message} ); @@ -31,7 +31,7 @@ export default function ErrorInfo({ message, icon = 'fas fa-times-circle red', i return ( - + {message} diff --git a/packages/web/src/widgets/LoadingInfo.js b/packages/web/src/widgets/LoadingInfo.js index 2144cfdf..01dfc302 100644 --- a/packages/web/src/widgets/LoadingInfo.js +++ b/packages/web/src/widgets/LoadingInfo.js @@ -33,7 +33,7 @@ export default function LoadingInfo({ message, wrapper = false }) { const core = ( - + {message} diff --git a/packages/web/src/widgets/StatusBar.js b/packages/web/src/widgets/StatusBar.js index 33466a95..c1e63f30 100644 --- a/packages/web/src/widgets/StatusBar.js +++ b/packages/web/src/widgets/StatusBar.js @@ -1,10 +1,8 @@ import React from 'react'; import styled from 'styled-components'; -import { getEngineIcon } from '../icons'; import { useCurrentDatabase } from '../utility/globalState'; import { useDatabaseStatus } from '../utility/metadataLoaders'; -import { FontIcon } from '../icons'; const Container = styled.div` display: flex; @@ -22,23 +20,22 @@ export default function StatusBar() { const { name, connection } = useCurrentDatabase() || {}; const status = useDatabaseStatus(connection ? { conid: connection._id, database: name } : {}); const { displayName, server, user, engine } = connection || {}; - const EngineIcon = getEngineIcon(engine); return ( {name && ( - {name} + {name} )} {(displayName || server) && ( - {displayName || server} + {displayName || server} )} {user && ( - {user} + {user} )} @@ -46,17 +43,17 @@ export default function StatusBar() { {status.name == 'pending' && ( <> - Loading + Loading )} {status.name == 'ok' && ( <> - Connected + Connected )} {status.name == 'error' && ( <> - Error + Error )} @@ -64,7 +61,7 @@ export default function StatusBar() { {!connection && ( <> - Not connected + Not connected )} diff --git a/packages/web/src/widgets/WidgetIconPanel.js b/packages/web/src/widgets/WidgetIconPanel.js index 25cb2e3f..1fdd1560 100644 --- a/packages/web/src/widgets/WidgetIconPanel.js +++ b/packages/web/src/widgets/WidgetIconPanel.js @@ -21,7 +21,7 @@ const IconWrapper = styled.div` export default function WidgetIconPanel() { const widgets = [ { - icon: 'fa-database', + icon: 'mdi mdi-database', name: 'database', title: 'Database connections', }, @@ -30,12 +30,12 @@ export default function WidgetIconPanel() { // name: 'table', // }, { - icon: 'fa-file-alt', + icon: 'mdi mdi-file', name: 'file', title: 'Closed tabs & Saved SQL files', }, { - icon: 'fa-archive', + icon: 'mdi mdi-archive', name: 'archive', title: 'Archive (saved tabular data)', }, @@ -62,7 +62,7 @@ export default function WidgetIconPanel() { onClick={() => setCurrentWidget(name === currentWidget ? null : name)} title={title} > - + ))} diff --git a/yarn.lock b/yarn.lock index f40e8163..e4ba35b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10096,6 +10096,21 @@ react-fast-compare@^2.0.1: resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-2.0.4.tgz#e84b4d455b0fec113e0402c329352715196f81f9" integrity sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw== +react-fast-compare@^3.1.1: + version "3.2.0" + resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb" + integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA== + +react-helmet@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-6.1.0.tgz#a750d5165cb13cf213e44747502652e794468726" + integrity sha512-4uMzEY9nlDlgxr61NL3XbKRy1hEkXmKNXhjbAIOVw5vcFrsdYbH2FEwcNyWvWinl103nXgzYNlns9ca+8kFiWw== + dependencies: + object-assign "^4.1.1" + prop-types "^15.7.2" + react-fast-compare "^3.1.1" + react-side-effect "^2.1.0" + react-input-autosize@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/react-input-autosize/-/react-input-autosize-2.2.2.tgz#fcaa7020568ec206bc04be36f4eb68e647c4d8c2" @@ -10212,6 +10227,11 @@ react-select@^3.1.0: react-input-autosize "^2.2.2" react-transition-group "^4.3.0" +react-side-effect@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-2.1.1.tgz#66c5701c3e7560ab4822a4ee2742dee215d72eb3" + integrity sha512-2FoTQzRNTncBVtnzxFOk2mCpcfxQpenBMbk5kSVBg5UcPqV9fRbgY2zhb7GTWWOlpFmAxhClBDlIq8Rsubz1yQ== + react-textarea-autosize@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-6.1.0.tgz#df91387f8a8f22020b77e3833c09829d706a09a5"