used mdi icons instead of font awesome

This commit is contained in:
Jan Prochazka 2020-11-09 19:33:46 +01:00
parent 4bf797c27d
commit a7fcf1d3a3
25 changed files with 85 additions and 51 deletions

View File

@ -15,7 +15,7 @@ PORT_postgres=5433
ENGINE_postgres=postgres ENGINE_postgres=postgres
TOOLBAR=home TOOLBAR=home
ICON_home=fas fa-home ICON_home=mdi mdi-home
TITLE_home=Home TITLE_home=Home
PAGE_home=home.html PAGE_home=home.html
STARTUP_PAGES=home STARTUP_PAGES=home

View File

@ -21,6 +21,7 @@
"react-ace": "^8.0.0", "react-ace": "^8.0.0",
"react-dom": "^16.12.0", "react-dom": "^16.12.0",
"react-dropzone": "^11.2.3", "react-dropzone": "^11.2.3",
"react-helmet": "^6.1.0",
"react-json-view": "^1.19.1", "react-json-view": "^1.19.1",
"react-modal": "^3.11.1", "react-modal": "^3.11.1",
"react-scripts": "3.3.0", "react-scripts": "3.3.0",

View File

@ -14,6 +14,7 @@ import { SocketProvider } from './utility/SocketProvider';
import ConnectionsPinger from './utility/ConnectionsPinger'; import ConnectionsPinger from './utility/ConnectionsPinger';
import { ModalLayerProvider } from './modals/showModal'; import { ModalLayerProvider } from './modals/showModal';
import UploadsProvider from './utility/UploadsProvider'; import UploadsProvider from './utility/UploadsProvider';
import ThemeHelmet from './themes/ThemeHelmet';
function App() { function App() {
return ( return (
@ -28,6 +29,7 @@ function App() {
<ModalLayerProvider> <ModalLayerProvider>
<CurrentArchiveProvider> <CurrentArchiveProvider>
<UploadsProvider> <UploadsProvider>
<ThemeHelmet />
<Screen /> <Screen />
</UploadsProvider> </UploadsProvider>
</CurrentArchiveProvider> </CurrentArchiveProvider>

View File

@ -41,7 +41,7 @@ export default function DragAndDropFileTarget({ isDragActive, inputProps }) {
<TargetStyled> <TargetStyled>
<InfoBox> <InfoBox>
<IconWrapper> <IconWrapper>
<i className="fas fa-cloud-upload-alt" /> <span className="mdi mdi-cloud-upload" />
</IconWrapper> </IconWrapper>
<TitleWrapper>Drop the files to upload to DbGate</TitleWrapper> <TitleWrapper>Drop the files to upload to DbGate</TitleWrapper>
<InfoWrapper>Supported file types: csv, MS Excel, json-lines</InfoWrapper> <InfoWrapper>Supported file types: csv, MS Excel, json-lines</InfoWrapper>

View File

@ -78,7 +78,7 @@ const FileNameWrapper = styled.span`
margin-left: 5px; margin-left: 5px;
`; `;
const CloseButton = styled.i` const CloseButton = styled.span`
margin-left: 5px; margin-left: 5px;
color: gray; color: gray;
&:hover { &:hover {
@ -117,9 +117,9 @@ function getTabDbKey(tab) {
} }
function getDbIcon(key) { function getDbIcon(key) {
if (key.startsWith('database://')) return 'fas fa-database'; if (key.startsWith('database://')) return 'mdi mdi-database';
if (key.startsWith('archive://')) return 'fas fa-archive'; if (key.startsWith('archive://')) return 'mdi mdi-archive';
return 'fas fa-file'; return 'mdi mdi-file';
} }
export default function TabsPanel() { export default function TabsPanel() {
@ -253,7 +253,7 @@ export default function TabsPanel() {
selected={tabsByDb[dbKey][0].tabDbKey == currentDbKey} selected={tabsByDb[dbKey][0].tabDbKey == currentDbKey}
onClick={() => handleSetDb(tabsByDb[dbKey][0].props)} onClick={() => handleSetDb(tabsByDb[dbKey][0].props)}
> >
<i className={getDbIcon(dbKey)} /> {tabsByDb[dbKey][0].tabDbName} <span className={getDbIcon(dbKey)} /> {tabsByDb[dbKey][0].tabDbName}
</DbNameWrapper> </DbNameWrapper>
<DbGroupHandler> <DbGroupHandler>
{_.sortBy(tabsByDb[dbKey], 'title').map((tab) => ( {_.sortBy(tabsByDb[dbKey], 'title').map((tab) => (
@ -265,10 +265,10 @@ export default function TabsPanel() {
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)}
> >
{tab.busy ? <i className="fas fa-spinner fa-spin"></i> : getIconImage(tab.icon)} {tab.busy ? <i className="mdi mdi-loading mdi-spin"></i> : getIconImage(tab.icon)}
<FileNameWrapper>{tab.title}</FileNameWrapper> <FileNameWrapper>{tab.title}</FileNameWrapper>
<CloseButton <CloseButton
className="fas fa-times tabCloseButton" className="mdi mdi-close tabCloseButton"
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
closeTab(tab.tabid); closeTab(tab.tabid);

View File

@ -68,11 +68,11 @@ export function AppObjectCore({
{...other} {...other}
> >
{prefix} {prefix}
<IconWrap>{isBusy ? <i className="fas fa-spinner fa-spin"></i> : <Icon />}</IconWrap> <IconWrap>{isBusy ? <span className="mdi mdi-loading mdi-spin"></span> : <Icon />}</IconWrap>
{title} {title}
{statusIcon && ( {statusIcon && (
<StatusIconWrap> <StatusIconWrap>
<FontIcon icon={statusIcon} title={statusTitle} /> <span className={statusIcon} title={statusTitle} />
</StatusIconWrap> </StatusIconWrap>
)} )}
</Component> </Component>

View File

@ -4,7 +4,6 @@ import { MacroIcon, StartIcon } from '../icons';
const macroAppObject = () => ({ name, type, title, group }, { setOpenedTabs }) => { const macroAppObject = () => ({ name, type, title, group }, { setOpenedTabs }) => {
const key = name; const key = name;
// const Icon = (props) => <i className="fas fa-archive" />;
const Icon = MacroIcon; const Icon = MacroIcon;
const matcher = (filter) => filterName(filter, name, title); const matcher = (filter) => filterName(filter, name, title);
const groupTitle = group; const groupTitle = group;

View File

@ -60,7 +60,6 @@ function Menu({ data, setOpenedTabs }) {
const archiveFileAppObject = () => ({ fileName, folderName }, { setOpenedTabs }) => { const archiveFileAppObject = () => ({ fileName, folderName }, { setOpenedTabs }) => {
const key = fileName; const key = fileName;
// const Icon = (props) => <i className="fas fa-archive" />;
const Icon = ArchiveTableIcon; const Icon = ArchiveTableIcon;
const onClick = () => { const onClick = () => {
openArchive(setOpenedTabs, fileName, folderName); openArchive(setOpenedTabs, fileName, folderName);

View File

@ -19,7 +19,6 @@ function Menu({ data, setOpenedTabs }) {
const archiveFolderAppObject = () => ({ name }, { setOpenedTabs, currentArchive }) => { const archiveFolderAppObject = () => ({ name }, { setOpenedTabs, currentArchive }) => {
const key = name; const key = name;
// const Icon = (props) => <i className="fas fa-archive" />;
const Icon = LocalDbIcon; const Icon = LocalDbIcon;
const isBold = name == currentArchive; const isBold = name == currentArchive;
const matcher = (filter) => filterName(filter, name); const matcher = (filter) => filterName(filter, name);

View File

@ -77,10 +77,10 @@ const connectionAppObject = (flags) => (
let statusIcon = null; let statusIcon = null;
let statusTitle = null; let statusTitle = null;
if (openedConnections.includes(_id)) { if (openedConnections.includes(_id)) {
if (!status) statusIcon = 'fas fa-spinner fa-spin'; if (!status) statusIcon = 'mdi mdi-loading mdi-spin';
else if (status.name == 'pending') statusIcon = 'fas fa-spinner fa-spin'; else if (status.name == 'pending') statusIcon = 'mdi mdi-loading mdi-spin';
else if (status.name == 'ok') statusIcon = 'fas fa-check-circle green'; else if (status.name == 'ok') statusIcon = 'mdi mdi-check-circle color-green';
else statusIcon = 'fas fa-times-circle red'; else statusIcon = 'mdi mdi-close-circle color-red';
if (status && status.name == 'error') { if (status && status.name == 'error') {
statusTitle = status.message; statusTitle = status.message;
} }

View File

@ -87,12 +87,12 @@ export default function ColumnHeaderControl({
<ColumnLabel {...column} /> <ColumnLabel {...column} />
{order == 'ASC' && ( {order == 'ASC' && (
<IconWrapper> <IconWrapper>
<FontIcon icon="fas fa-sort-alpha-down green" /> <span className="mdi mdi-sort-alphabetical-ascending color-green" />
</IconWrapper> </IconWrapper>
)} )}
{order == 'DESC' && ( {order == 'DESC' && (
<IconWrapper> <IconWrapper>
<FontIcon icon="fas fa-sort-alpha-down-alt green" /> <span className="mdi mdi-sort-alphabetical-descending color-green" />
</IconWrapper> </IconWrapper>
)} )}
</LabelDiv> </LabelDiv>

View File

@ -291,7 +291,7 @@ export default function DataFilterControl({
autocomplete="off" autocomplete="off"
/> />
<InlineButton buttonRef={buttonRef} onClick={handleShowMenu} square> <InlineButton buttonRef={buttonRef} onClick={handleShowMenu} square>
<i className="fas fa-filter" /> <span className="mdi mdi-filter" />
</InlineButton> </InlineButton>
</FilterDiv> </FilterDiv>
); );

View File

@ -971,7 +971,7 @@ export default function DataGridCore(props) {
> >
{filterCount > 0 && ( {filterCount > 0 && (
<InlineButton onClick={handleClearFilters} square> <InlineButton onClick={handleClearFilters} square>
<i className="fas fa-times" /> <span className="mdi mdi-filter-off" />
</InlineButton> </InlineButton>
)} )}
</TableHeaderCell> </TableHeaderCell>

View File

@ -27,8 +27,10 @@ const Name = styled.div`
const Buttons = styled.div` const Buttons = styled.div`
white-space: nowrap; white-space: nowrap;
`; `;
const Icon = styled(FontIcon)` const Icon = styled.span`
// margin-left: 5px; // margin-left: 5px;
position: relative;
top: 5px;
&:hover { &:hover {
background-color: gray; background-color: gray;
} }
@ -103,10 +105,10 @@ function ColumnManagerRow({ column, onEdit, onRemove, onUp, onDown }) {
<Row onMouseEnter={() => setIsHover(true)} onMouseLeave={() => setIsHover(false)}> <Row onMouseEnter={() => setIsHover(true)} onMouseLeave={() => setIsHover(false)}>
<Name>{column.columnName}</Name> <Name>{column.columnName}</Name>
<Buttons> <Buttons>
<Icon icon="fas fa-edit" onClick={onEdit} /> <Icon className="mdi mdi-pencil" onClick={onEdit} />
<Icon icon="fas fa-trash" onClick={onRemove} /> <Icon className="mdi mdi-delete" onClick={onRemove} />
<Icon icon="fas fa-arrow-up" onClick={onUp} /> <Icon className="mdi mdi-arrow-up" onClick={onUp} />
<Icon icon="fas fa-arrow-down" onClick={onDown} /> <Icon className="mdi mdi-arrow-down" onClick={onDown} />
</Buttons> </Buttons>
</Row> </Row>
); );

View File

@ -294,7 +294,7 @@ function SourceName({ name }) {
<SourceNameWrapper> <SourceNameWrapper>
<div>{name}</div> <div>{name}</div>
<TrashWrapper onClick={handleDelete}> <TrashWrapper onClick={handleDelete}>
<i className="fas fa-trash" /> <span className="mdi mdi-delete" />
</TrashWrapper> </TrashWrapper>
</SourceNameWrapper> </SourceNameWrapper>
); );
@ -352,7 +352,7 @@ export default function ImportExportConfigurator({ uploadedFile = undefined }) {
engine={sourceEngine} engine={sourceEngine}
/> />
<ArrowWrapper> <ArrowWrapper>
<i className="fas fa-arrow-right" /> <span className="mdi mdi-arrow-right" />
</ArrowWrapper> </ArrowWrapper>
<SourceTargetConfig <SourceTargetConfig
direction="target" direction="target"

View File

@ -25,7 +25,7 @@ export default function ErrorMessageModal({ modalState, title = 'Error', message
<ModalContent> <ModalContent>
<Wrapper> <Wrapper>
<IconWrapper> <IconWrapper>
<FontIcon icon="fas fa-times-circle red" /> <span className="mdi mdi-close-circle color-red" />
</IconWrapper> </IconWrapper>
{message} {message}
</Wrapper> </Wrapper>

View File

@ -23,7 +23,7 @@ export default function ModalHeader({ children, modalState }) {
<Wrapper> <Wrapper>
<div>{children}</div> <div>{children}</div>
<CloseWrapper onClick={modalState.close}> <CloseWrapper onClick={modalState.close}>
<i className="fas fa-times" /> <span className="mdi mdi-close" />
</CloseWrapper> </CloseWrapper>
</Wrapper> </Wrapper>
); );

View File

@ -0,0 +1,15 @@
import React from 'react';
import { Helmet } from 'react-helmet';
export default function ThemeHelmet() {
return (
<Helmet>
<style>{`
.color-red { color: red; }
.color-green { color: green; }
.color-on-statusbar-green { color: lime; }
.color-blue { color: blue; }
`}</style>
</Helmet>
);
}

View File

@ -126,7 +126,7 @@ function SqlObjectListWrapper() {
const db = useCurrentDatabase(); const db = useCurrentDatabase();
if (!db) { if (!db) {
return <ErrorInfo message="Database not selected" icon="fas fa-exclamation-circle blue" />; return <ErrorInfo message="Database not selected" icon="mdi mdi-alert-circle color-blue" />;
} }
const { name, connection } = db; const { name, connection } = db;

View File

@ -12,7 +12,7 @@ export default function DropDownButton({ children }) {
return ( return (
<InlineButton buttonRef={buttonRef} onClick={handleShowMenu} square> <InlineButton buttonRef={buttonRef} onClick={handleShowMenu} square>
<i className="fas fa-chevron-down" /> <span className="mdi mdi-chevron-down" />
</InlineButton> </InlineButton>
); );
} }

View File

@ -19,11 +19,11 @@ const ContainerSmall = styled.div`
margin-right: 10px; 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) { if (isSmall) {
return ( return (
<ContainerSmall> <ContainerSmall>
<FontIcon icon={icon} /> <span className={icon} />
{message} {message}
</ContainerSmall> </ContainerSmall>
); );
@ -31,7 +31,7 @@ export default function ErrorInfo({ message, icon = 'fas fa-times-circle red', i
return ( return (
<Container> <Container>
<Icon> <Icon>
<FontIcon icon={icon} /> <span className={icon} />
</Icon> </Icon>
{message} {message}
</Container> </Container>

View File

@ -33,7 +33,7 @@ export default function LoadingInfo({ message, wrapper = false }) {
const core = ( const core = (
<Container> <Container>
<Spinner> <Spinner>
<i className="fas fa-spinner fa-spin" /> <span className="mdi mdi-loading mdi-spin" />
</Spinner> </Spinner>
{message} {message}
</Container> </Container>

View File

@ -1,10 +1,8 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { getEngineIcon } from '../icons';
import { useCurrentDatabase } from '../utility/globalState'; import { useCurrentDatabase } from '../utility/globalState';
import { useDatabaseStatus } from '../utility/metadataLoaders'; import { useDatabaseStatus } from '../utility/metadataLoaders';
import { FontIcon } from '../icons';
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
@ -22,23 +20,22 @@ export default function StatusBar() {
const { name, connection } = useCurrentDatabase() || {}; const { name, connection } = useCurrentDatabase() || {};
const status = useDatabaseStatus(connection ? { conid: connection._id, database: name } : {}); const status = useDatabaseStatus(connection ? { conid: connection._id, database: name } : {});
const { displayName, server, user, engine } = connection || {}; const { displayName, server, user, engine } = connection || {};
const EngineIcon = getEngineIcon(engine);
return ( return (
<Container> <Container>
{name && ( {name && (
<Item> <Item>
<i className="fas fa-database" /> {name} <i className="mdi mdi-database" /> {name}
</Item> </Item>
)} )}
{(displayName || server) && ( {(displayName || server) && (
<Item> <Item>
<EngineIcon size={12} /> {displayName || server} <span className='mdi mdi-server'/> {displayName || server}
</Item> </Item>
)} )}
{user && ( {user && (
<Item> <Item>
<i className="fas fa-user" /> {user} <span className="mdi mdi-account" /> {user}
</Item> </Item>
)} )}
@ -46,17 +43,17 @@ export default function StatusBar() {
<Item> <Item>
{status.name == 'pending' && ( {status.name == 'pending' && (
<> <>
<FontIcon icon="fas fa-spinner fa-spin" /> Loading <span className="mdi mdi-loading mdi-spin" /> Loading
</> </>
)} )}
{status.name == 'ok' && ( {status.name == 'ok' && (
<> <>
<FontIcon icon="fas fa-check-circle lime" /> Connected <span className="mdi mdi-check-circle color-on-statusbar-green" /> Connected
</> </>
)} )}
{status.name == 'error' && ( {status.name == 'error' && (
<> <>
<FontIcon icon="fas fa-times-circle red" /> Error <span className="mdi mdi-close-circle color-red" /> Error
</> </>
)} )}
</Item> </Item>
@ -64,7 +61,7 @@ export default function StatusBar() {
{!connection && ( {!connection && (
<Item> <Item>
<> <>
<FontIcon icon="fas fa-plug gray" /> Not connected <span className="mdi mdi-lan-disconnect" /> Not connected
</> </>
</Item> </Item>
)} )}

View File

@ -21,7 +21,7 @@ const IconWrapper = styled.div`
export default function WidgetIconPanel() { export default function WidgetIconPanel() {
const widgets = [ const widgets = [
{ {
icon: 'fa-database', icon: 'mdi mdi-database',
name: 'database', name: 'database',
title: 'Database connections', title: 'Database connections',
}, },
@ -30,12 +30,12 @@ export default function WidgetIconPanel() {
// name: 'table', // name: 'table',
// }, // },
{ {
icon: 'fa-file-alt', icon: 'mdi mdi-file',
name: 'file', name: 'file',
title: 'Closed tabs & Saved SQL files', title: 'Closed tabs & Saved SQL files',
}, },
{ {
icon: 'fa-archive', icon: 'mdi mdi-archive',
name: 'archive', name: 'archive',
title: 'Archive (saved tabular data)', title: 'Archive (saved tabular data)',
}, },
@ -62,7 +62,7 @@ export default function WidgetIconPanel() {
onClick={() => setCurrentWidget(name === currentWidget ? null : name)} onClick={() => setCurrentWidget(name === currentWidget ? null : name)}
title={title} title={title}
> >
<i className={`fas ${icon}`} /> <span className={icon} />
</IconWrapper> </IconWrapper>
))} ))}
</> </>

View File

@ -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" resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-2.0.4.tgz#e84b4d455b0fec113e0402c329352715196f81f9"
integrity sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw== 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: react-input-autosize@^2.2.2:
version "2.2.2" version "2.2.2"
resolved "https://registry.yarnpkg.com/react-input-autosize/-/react-input-autosize-2.2.2.tgz#fcaa7020568ec206bc04be36f4eb68e647c4d8c2" 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-input-autosize "^2.2.2"
react-transition-group "^4.3.0" 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: react-textarea-autosize@^6.1.0:
version "6.1.0" version "6.1.0"
resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-6.1.0.tgz#df91387f8a8f22020b77e3833c09829d706a09a5" resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-6.1.0.tgz#df91387f8a8f22020b77e3833c09829d706a09a5"