diff --git a/package.json b/package.json
index 9fcaa19..7f51358 100644
--- a/package.json
+++ b/package.json
@@ -29,6 +29,7 @@
"react-scripts": "3.4.3",
"rxjs": "^6.6.3",
"socket.io-client": "^2.3.1",
+ "styled-components": "^5.2.1",
"xterm": "^4.9.0",
"xterm-addon-fit": "^0.4.0"
},
@@ -43,6 +44,7 @@
"@types/react-dom": "^16.9.8",
"@types/react-router-dom": "^5.1.5",
"@types/socket.io-client": "^1.4.34",
+ "@types/styled-components": "^5.1.7",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"cross-env": "^7.0.2",
diff --git a/src/App.tsx b/src/App.tsx
index 28e4e3c..a32ad26 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,6 +1,7 @@
import CssBaseline from "@material-ui/core/CssBaseline";
import { Theme, withStyles } from "@material-ui/core/styles";
-import { ThemeProvider } from "@material-ui/styles";
+import { ThemeProvider } from "styled-components";
+import { ThemeProvider as MaterialThemeProvider } from "@material-ui/styles";
import React, { ReactElement, useEffect } from "react";
import {
BrowserRouter as Router,
@@ -8,9 +9,9 @@ import {
Route,
Switch,
} from "react-router-dom";
-import ConnectionFailed from "./common/ConnectionFailed";
-import NotFound from "./common/NotFound";
-import Dashboard from "./dashboard/Dashboard";
+import ConnectionFailed from "./common/connectionFailed";
+import NotFound from "./common/notFound";
+import Dashboard from "./dashboard";
import { Path } from "./router/Path";
import { darkTheme } from "./themes";
import { useElectronStore } from "./stores/electronStore";
@@ -86,26 +87,28 @@ function App(): ReactElement {
return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
);
}
diff --git a/src/common/CenterEllipsis.tsx b/src/common/CenterEllipsis.tsx
deleted file mode 100644
index 0293c14..0000000
--- a/src/common/CenterEllipsis.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { createStyles, makeStyles } from "@material-ui/core";
-import React, { ReactElement } from "react";
-
-type PropsType = {
- text: string;
-};
-
-const useStyles = makeStyles(() =>
- createStyles({
- left: {
- flex: "0 1 auto",
- overflow: "hidden",
- textOverflow: "ellipsis",
- whiteSpace: "pre",
- },
- right: {
- flex: "1 0 auto",
- overflow: "hidden",
- whiteSpace: "pre",
- maxWidth: "40px",
- },
- })
-);
-
-function CenterEllipsis(props: PropsType): ReactElement {
- const { text } = props;
- const splitIndex =
- text.length > 4 ? text.length - 4 : Math.round(text.length * 0.75);
- const classes = useStyles();
-
- const shrinkableText = text.slice(0, splitIndex);
- const endText = text.slice(splitIndex);
-
- return (
- <>
- {shrinkableText}
- {endText}
- >
- );
-}
-
-export default CenterEllipsis;
diff --git a/src/common/Loader.tsx b/src/common/Loader.tsx
deleted file mode 100644
index ca6be5e..0000000
--- a/src/common/Loader.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import {
- CircularProgress,
- createStyles,
- Grid,
- makeStyles,
-} from "@material-ui/core";
-import React, { ReactElement } from "react";
-
-const useStyles = makeStyles(() =>
- createStyles({
- loaderContainer: {
- height: "100px",
- justifyContent: "center",
- alignItems: "center",
- },
- })
-);
-
-const Loader = (): ReactElement => {
- const classes = useStyles();
-
- return (
-
-
-
- );
-};
-
-export default Loader;
diff --git a/src/common/NotFound.tsx b/src/common/NotFound.tsx
deleted file mode 100644
index b97ffcb..0000000
--- a/src/common/NotFound.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { createStyles, Grid, makeStyles, Theme } from "@material-ui/core";
-import React, { ReactElement } from "react";
-import notFoundImg from "../assets/404.png";
-
-const useStyles = makeStyles((theme: Theme) =>
- createStyles({
- container: {
- height: "100vh",
- padding: theme.spacing(3),
- },
- })
-);
-const NotFound = (): ReactElement => {
- const classes = useStyles();
-
- return (
-
-
-
- );
-};
-
-export default NotFound;
diff --git a/src/common/PageCircularProgress.tsx b/src/common/PageCircularProgress.tsx
deleted file mode 100644
index 84d8112..0000000
--- a/src/common/PageCircularProgress.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import {
- Box,
- CircularProgress,
- createStyles,
- makeStyles,
-} from "@material-ui/core";
-import React, { ReactElement } from "react";
-
-const useStyles = makeStyles(() =>
- createStyles({
- container: {
- height: "100vh",
- width: "100%",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- },
- })
-);
-const PageCircularProgress = (): ReactElement => {
- const classes = useStyles();
- return (
-
-
-
- );
-};
-
-export default PageCircularProgress;
diff --git a/src/common/Table.tsx b/src/common/Table.tsx
index 2332368..1021c12 100644
--- a/src/common/Table.tsx
+++ b/src/common/Table.tsx
@@ -10,7 +10,7 @@ import {
import FileCopyOutlinedIcon from "@material-ui/icons/FileCopyOutlined";
import React, { ReactElement } from "react";
import { copyToClipboard } from "./appUtil";
-import CenterEllipsis from "./CenterEllipsis";
+import CenterEllipsis from "./centerEllipsis";
export type TableRow = {
[key: string]: string | number | boolean | Date | ReactElement | undefined;
diff --git a/src/common/ButtonWithLoading.tsx b/src/common/buttonWithLoading/index.tsx
similarity index 63%
rename from src/common/ButtonWithLoading.tsx
rename to src/common/buttonWithLoading/index.tsx
index 8822bf9..b5e3690 100644
--- a/src/common/ButtonWithLoading.tsx
+++ b/src/common/buttonWithLoading/index.tsx
@@ -1,11 +1,12 @@
-import {
- Button,
- CircularProgress,
- createStyles,
- makeStyles,
-} from "@material-ui/core";
+import { Button } from "@material-ui/core";
import React, { ReactElement } from "react";
+//styles
+import {
+ ButtonWrapper,
+ ButtonProgress
+} from "./styles";
+
type ButtonWithLoadingProps = {
onClick: () => void;
text: string;
@@ -17,23 +18,7 @@ type ButtonWithLoadingProps = {
color?: "primary" | "secondary";
};
-const useStyles = makeStyles(() =>
- createStyles({
- buttonWrapper: {
- position: "relative",
- },
- buttonProgress: {
- position: "absolute",
- top: "50%",
- left: "50%",
- marginTop: -12,
- marginLeft: -12,
- },
- })
-);
-
const ButtonWithLoading = (props: ButtonWithLoadingProps): ReactElement => {
- const classes = useStyles();
const {
onClick,
text,
@@ -46,7 +31,7 @@ const ButtonWithLoading = (props: ButtonWithLoadingProps): ReactElement => {
} = props;
return (
-
+
{loading && (
-
+
)}
-
+
);
};
diff --git a/src/common/buttonWithLoading/styles.ts b/src/common/buttonWithLoading/styles.ts
new file mode 100644
index 0000000..3b0438c
--- /dev/null
+++ b/src/common/buttonWithLoading/styles.ts
@@ -0,0 +1,20 @@
+import styled from "styled-components";
+import { CircularProgress } from "@material-ui/core";
+
+//types
+type ButtonProgressType = {
+ size: number;
+}
+
+//styled
+export const ButtonWrapper = styled.div`
+ position: relative;
+`;
+
+export const ButtonProgress = styled(CircularProgress)`
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ margin-top: -12px;
+ margin-left: -12px;
+`;
\ No newline at end of file
diff --git a/src/common/centerEllipsis/index.tsx b/src/common/centerEllipsis/index.tsx
new file mode 100644
index 0000000..3d9ae09
--- /dev/null
+++ b/src/common/centerEllipsis/index.tsx
@@ -0,0 +1,29 @@
+import React, { ReactElement } from "react";
+
+//styles
+import {
+ Left,
+ Right
+} from "./styles";
+
+type PropsType = {
+ text: string;
+};
+
+function CenterEllipsis(props: PropsType): ReactElement {
+ const { text } = props;
+ const splitIndex =
+ text.length > 4 ? text.length - 4 : Math.round(text.length * 0.75);
+
+ const shrinkableText = text.slice(0, splitIndex);
+ const endText = text.slice(splitIndex);
+
+ return (
+ <>
+ {shrinkableText}
+ {endText}
+ >
+ );
+}
+
+export default CenterEllipsis;
diff --git a/src/common/centerEllipsis/styles.ts b/src/common/centerEllipsis/styles.ts
new file mode 100644
index 0000000..a0bcce9
--- /dev/null
+++ b/src/common/centerEllipsis/styles.ts
@@ -0,0 +1,15 @@
+import styled from "styled-components";
+
+export const Left = styled.span`
+ flex: 0 1 auto;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: pre;
+`;
+
+export const Right = styled.span`
+ flex: 1 0 auto;
+ overflow: hidden;
+ white-space: pre;
+ max-width: 40px;
+`;
\ No newline at end of file
diff --git a/src/common/ConnectionFailed.tsx b/src/common/connectionFailed/index.tsx
similarity index 55%
rename from src/common/ConnectionFailed.tsx
rename to src/common/connectionFailed/index.tsx
index fd392c5..ab343e1 100644
--- a/src/common/ConnectionFailed.tsx
+++ b/src/common/connectionFailed/index.tsx
@@ -1,31 +1,20 @@
import {
Button,
- createStyles,
- Grid,
- makeStyles,
- Theme,
- Typography,
+ Typography
} from "@material-ui/core";
import React, { ReactElement, useEffect } from "react";
import { useHistory } from "react-router-dom";
-import { Path } from "../router/Path";
-import { isElectron, sendMessageToParent } from "./appUtil";
+import { Path } from "../../router/Path";
+import { isElectron, sendMessageToParent } from "../appUtil";
-const useStyles = makeStyles((theme: Theme) =>
- createStyles({
- container: {
- height: "100vh",
- padding: theme.spacing(3),
- },
- row: {
- padding: theme.spacing(3),
- },
- })
-);
+//styles
+import {
+ Container,
+ Row
+} from "./styles";
const ConnectionFailed = (): ReactElement => {
const history = useHistory();
- const classes = useStyles();
useEffect(() => {
if (isElectron()) {
@@ -34,25 +23,24 @@ const ConnectionFailed = (): ReactElement => {
}, []);
return (
-
-
+
Failed to get data
-
-
+
+
-
-
+
+
);
};
diff --git a/src/common/connectionFailed/styles.ts b/src/common/connectionFailed/styles.ts
new file mode 100644
index 0000000..48beb5b
--- /dev/null
+++ b/src/common/connectionFailed/styles.ts
@@ -0,0 +1,21 @@
+import styled from "styled-components";
+import { Grid } from "@material-ui/core";
+
+//types
+type ContainerType = {
+ item: boolean;
+ container: boolean;
+ direction: string;
+ alignItems: string;
+ justify: string;
+}
+
+//styled
+export const Container = styled(Grid)`
+ height: 100vh;
+ padding: ${p => p.theme.spacing(3)}px;
+`;
+
+export const Row = styled(Grid)`
+ padding: ${p => p.theme.spacing(3)}px;
+`;
\ No newline at end of file
diff --git a/src/common/loader/index.tsx b/src/common/loader/index.tsx
new file mode 100644
index 0000000..cb1978a
--- /dev/null
+++ b/src/common/loader/index.tsx
@@ -0,0 +1,16 @@
+import { CircularProgress } from "@material-ui/core";
+import React, { ReactElement } from "react";
+
+//styles
+import { LoaderContainer } from "./styles";
+
+const Loader = (): ReactElement => {
+
+ return (
+
+
+
+ );
+};
+
+export default Loader;
diff --git a/src/common/loader/styles.ts b/src/common/loader/styles.ts
new file mode 100644
index 0000000..5b9a9b1
--- /dev/null
+++ b/src/common/loader/styles.ts
@@ -0,0 +1,14 @@
+import styled from "styled-components";
+import { Grid } from "@material-ui/core";
+
+//types
+type LoaderContainerType = {
+ container: boolean;
+}
+
+//styled
+export const LoaderContainer = styled(Grid)`
+ height: 100px;
+ justify-content: center;
+ align-items: center;
+`;
\ No newline at end of file
diff --git a/src/common/notFound/index.tsx b/src/common/notFound/index.tsx
new file mode 100644
index 0000000..64ab825
--- /dev/null
+++ b/src/common/notFound/index.tsx
@@ -0,0 +1,21 @@
+import React, { ReactElement } from "react";
+import notFoundImg from "../../assets/404.png";
+
+//styles
+import { Container } from "./styles";
+
+const NotFound = (): ReactElement => {
+ return (
+
+
+
+ );
+};
+
+export default NotFound;
diff --git a/src/common/notFound/styles.ts b/src/common/notFound/styles.ts
new file mode 100644
index 0000000..b80f421
--- /dev/null
+++ b/src/common/notFound/styles.ts
@@ -0,0 +1,17 @@
+import styled from "styled-components";
+import { Grid } from "@material-ui/core";
+
+//types
+type ContainerType = {
+ item: boolean;
+ container: boolean;
+ direction: string;
+ alignItems: string;
+ justify: string;
+}
+
+//styled
+export const Container = styled(Grid)`
+ height: 100vh;
+ padding: ${p => p.theme.spacing(3)}px;
+`;
\ No newline at end of file
diff --git a/src/common/pageCircularProgress/index.tsx b/src/common/pageCircularProgress/index.tsx
new file mode 100644
index 0000000..9394e1d
--- /dev/null
+++ b/src/common/pageCircularProgress/index.tsx
@@ -0,0 +1,15 @@
+import { CircularProgress } from "@material-ui/core";
+import React, { ReactElement } from "react";
+
+//styles
+import { Container } from "./styles";
+
+const PageCircularProgress = (): ReactElement => {
+ return (
+
+
+
+ );
+};
+
+export default PageCircularProgress;
diff --git a/src/common/pageCircularProgress/styles.ts b/src/common/pageCircularProgress/styles.ts
new file mode 100644
index 0000000..128619b
--- /dev/null
+++ b/src/common/pageCircularProgress/styles.ts
@@ -0,0 +1,10 @@
+import styled from "styled-components";
+import { Box } from "@material-ui/core";
+
+export const Container = styled(Box)`
+ height: 100vh;
+ width: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+`;
\ No newline at end of file
diff --git a/src/common/QrCode.tsx b/src/common/qrCode/index.tsx
similarity index 62%
rename from src/common/QrCode.tsx
rename to src/common/qrCode/index.tsx
index 4fa2be6..2388a6c 100644
--- a/src/common/QrCode.tsx
+++ b/src/common/qrCode/index.tsx
@@ -1,43 +1,25 @@
import {
- createStyles,
Grid,
IconButton,
- makeStyles,
- Paper,
- Theme,
- Typography,
+ Typography
} from "@material-ui/core";
import CloseIcon from "@material-ui/icons/Close";
import QRCode from "qrcode.react";
import React, { ReactElement } from "react";
+//styles
+import { Container } from "./styles";
+
type QrCodeProps = {
value: string;
handleClose: () => void;
size?: number;
};
-const useStyles = makeStyles((theme: Theme) =>
- createStyles({
- container: {
- display: "flex",
- flexDirection: "column",
- width: "100%",
- height: "100%",
- backgroundColor: theme.palette.background.default,
- padding: theme.spacing(2),
- },
- content: {
- height: "100%",
- },
- })
-);
-
const QrCode = (props: QrCodeProps): ReactElement => {
- const classes = useStyles();
const { value, handleClose, size } = props;
return (
-
+
@@ -48,7 +30,7 @@ const QrCode = (props: QrCodeProps): ReactElement => {
-
+
);
};
diff --git a/src/common/qrCode/styles.ts b/src/common/qrCode/styles.ts
new file mode 100644
index 0000000..5266ca9
--- /dev/null
+++ b/src/common/qrCode/styles.ts
@@ -0,0 +1,11 @@
+import styled from "styled-components";
+import { Paper } from "@material-ui/core";
+
+export const Container = styled(Paper)`
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ height: 100%;
+ background-color: ${p => p.theme.palette.background.default};
+ padding: ${p => p.theme.spacing(2)}px;
+`;
\ No newline at end of file
diff --git a/src/common/sorting/SortingOptions.tsx b/src/common/sorting/sortingOptions/index.tsx
similarity index 65%
rename from src/common/sorting/SortingOptions.tsx
rename to src/common/sorting/sortingOptions/index.tsx
index 14b0b7c..8a0b95c 100644
--- a/src/common/sorting/SortingOptions.tsx
+++ b/src/common/sorting/sortingOptions/index.tsx
@@ -1,23 +1,27 @@
import {
- Button,
ClickAwayListener,
- createStyles,
Fade,
Grid,
IconButton,
- makeStyles,
- Paper,
Popper,
- Theme,
Tooltip,
- Typography,
+ Typography
} from "@material-ui/core";
-import ArrowDownwardIcon from "@material-ui/icons/ArrowDownward";
-import ArrowUpwardIcon from "@material-ui/icons/ArrowUpward";
import CloseIcon from "@material-ui/icons/Close";
import SortIcon from "@material-ui/icons/Sort";
import React, { ReactElement, useState } from "react";
-import { SortingOrder } from "./SortingUtil";
+import { SortingOrder } from "../SortingUtil";
+
+//styles
+import {
+ SortIconContainer,
+ SortOptionsMenu,
+ SortOptionButton,
+ SortOptionActiveGrid,
+ SortDirIconContainer,
+ StyledArrowDownwardIcon,
+ StyledArrowUpwardIcon
+} from "./styles";
export type SortingOptionsProps = {
sortOpts: SortOption[];
@@ -33,35 +37,7 @@ export type SortOption = {
sortingOrder?: SortingOrder;
};
-const useStyles = makeStyles((theme: Theme) =>
- createStyles({
- sortIconContainer: {
- paddingTop: theme.spacing(2),
- },
- sortOptionsMenu: {
- backgroundColor: theme.palette.background.default,
- },
- sortOption: {
- padding: `${theme.spacing(1)}px ${theme.spacing(3)}px`,
- textTransform: "none",
- borderRadius: 0,
- color: theme.palette.text.secondary,
- },
- sortOptionActive: {
- fontWeight: theme.typography.fontWeightBold,
- color: theme.palette.text.primary,
- },
- sortDirIconContainer: {
- width: "15px",
- },
- sortDirIcon: {
- fontSize: theme.typography.body2.fontSize,
- },
- })
-);
-
function SortingOptions(props: SortingOptionsProps): ReactElement {
- const classes = useStyles();
const { sortOpts, orderBy, sortingOrder, onOptionSelected } = props;
const [sortOptsOpen, setSortOptsOpen] = useState(false);
const [sortOptsAnchorEl, setSortOptsAnchorEl] = useState(
@@ -87,18 +63,17 @@ function SortingOptions(props: SortingOptionsProps): ReactElement {
return null;
}
return sortingOrder === "desc" ? (
-
+
) : (
-
+
);
};
return (
-
@@ -115,10 +90,10 @@ function SortingOptions
(props: SortingOptionsProps): ReactElement {
>
{({ TransitionProps }) => (
-
+
{sortOpts.map((opt) => (
-
+
+
))}
-
+
)}
-
+
);
}
diff --git a/src/common/sorting/sortingOptions/styles.ts b/src/common/sorting/sortingOptions/styles.ts
new file mode 100644
index 0000000..fa22a89
--- /dev/null
+++ b/src/common/sorting/sortingOptions/styles.ts
@@ -0,0 +1,78 @@
+import styled from "styled-components";
+import {
+ Button,
+ Grid,
+ Paper,
+ Typography
+} from "@material-ui/core";
+import ArrowDownwardIcon from "@material-ui/icons/ArrowDownward";
+import ArrowUpwardIcon from "@material-ui/icons/ArrowUpward";
+
+//types
+type SortIconContainerType = {
+ item: boolean;
+ container: boolean;
+ justify: string;
+}
+
+type SortOptionButtonType = {
+ fullWidth: boolean;
+ disableRipple: boolean;
+ size: string;
+ onClick: () => void;
+ key: string;
+}
+
+type SortOptionActiveGridType = {
+ item: boolean;
+ container: boolean;
+ alignItems: string;
+ spacing: number;
+ wrap: string;
+ sortOptionActive: boolean;
+}
+
+type SortDirIconContainerType = {
+ component: string;
+}
+
+//styled
+export const SortIconContainer = styled(Grid)`
+ padding-top: ${p => p.theme.spacing(2)}px;
+`;
+
+export const SortOptionsMenu = styled(Paper)`
+ background-color: ${p => p.theme.palette.background.default};
+`;
+
+export const SortOptionButton = styled(Button)`
+ padding: ${p => `${p.theme.spacing(1)}px ${p.theme.spacing(3)}px`};
+ text-transform: none;
+ border-radius: 0px;
+ color: ${p => p.theme.palette.text.secondary};
+`;
+
+export const SortOptionActiveGrid = styled(Grid)`
+ ${p => p.sortOptionActive && `
+ font-weight: ${p.theme.typography.fontWeightBold};
+ color: ${p.theme.palette.text.primary};
+ `}
+`;
+
+export const SortDirIconContainer = styled(Typography)`
+ width: 15px;
+`;
+
+export const StyledArrowDownwardIcon = styled(ArrowDownwardIcon)`
+ ${p => getArrowIconStyles(p)}
+`;
+
+export const StyledArrowUpwardIcon = styled(ArrowUpwardIcon)`
+ ${p => getArrowIconStyles(p)}
+`;
+
+const getArrowIconStyles = (p: any) => {
+ return `
+ font-size: ${p.theme.typography.body2.fontSize};
+ `;
+}
\ No newline at end of file
diff --git a/src/dashboard/console/Console.tsx b/src/dashboard/console/index.tsx
similarity index 78%
rename from src/dashboard/console/Console.tsx
rename to src/dashboard/console/index.tsx
index 5fb2c48..6d6004d 100644
--- a/src/dashboard/console/Console.tsx
+++ b/src/dashboard/console/index.tsx
@@ -6,19 +6,16 @@ import "xterm/css/xterm.css";
import api from "../../api";
import { combineLatest, fromEvent, Observable, Subscription } from "rxjs";
import { mergeMap, shareReplay, switchMap, take } from "rxjs/operators";
-import {
- createStyles,
- Theme,
- Typography,
- withStyles,
- WithStyles,
-} from "@material-ui/core";
-
-type PropsType = RouteComponentProps<{ param1: string }> &
- WithStyles & {
- previousTerminal?: Terminal;
- setTerminal: (terminal: Terminal) => void;
- };
+
+//styles
+import {
+ Wrapper,
+ Title,
+ Code,
+ TerminalContainer
+} from "./styles";
+
+type PropsType = RouteComponentProps<{ param1: string }>
type StateType = {
connected: boolean;
@@ -27,29 +24,6 @@ type StateType = {
error?: string;
};
-const styles = (theme: Theme) => {
- return createStyles({
- wrapper: {
- flex: 1,
- },
- title: {
- marginBottom: theme.spacing(2),
- },
- code: {
- backgroundColor: theme.palette.background.paper,
- padding: `0px ${theme.spacing(1)}px`,
- borderRadius: 5,
- letterSpacing: 2,
- fontFamily: "monospace",
- },
- terminalContainer: {
- height: "90%",
- width: "100%",
- overflowY: "auto",
- },
- });
-};
-
const consoleCreated$ = (api.sio.io$.pipe(
mergeMap((io) => fromEvent(io, "created")),
shareReplay({ refCount: true, bufferSize: 1 })
@@ -208,21 +182,19 @@ class Console extends Component {
}
render(): ReactElement {
- const { classes } = this.props;
-
return (
-
-
- Type {help} to show a list of
+
+
+ Type {help} to show a list of
available commands
-
+
{this.state.error && (
Error: {JSON.stringify(this.state.error)}
)}
-
-
+
+
);
}
}
-export default withRouter(withStyles(styles, { withTheme: true })(Console));
+export default withRouter(Console);
diff --git a/src/dashboard/console/styles.ts b/src/dashboard/console/styles.ts
new file mode 100644
index 0000000..d45888b
--- /dev/null
+++ b/src/dashboard/console/styles.ts
@@ -0,0 +1,31 @@
+import styled from "styled-components";
+import { Typography } from "@material-ui/core";
+
+// types
+type TitleType = {
+ component: string;
+ variant: string;
+}
+
+//styled
+export const Wrapper = styled.div`
+ flex: 1;
+`;
+
+export const Title = styled(Typography)`
+ margin-bottom: ${p => p.theme.spacing(2)}px;
+`;
+
+export const Code = styled.span`
+ background-color: ${p => p.theme.palette.background.paper};
+ padding: ${p => `0px ${p.theme.spacing(1)}px`};
+ border-radius: 5px;
+ letter-spacing: 2px;
+ font-family: monospace;
+`;
+
+export const TerminalContainer = styled.div`
+ height: 90%;
+ width: 100%;
+ overflowY: auto;
+`;
\ No newline at end of file
diff --git a/src/dashboard/Dashboard.tsx b/src/dashboard/index.tsx
similarity index 78%
rename from src/dashboard/Dashboard.tsx
rename to src/dashboard/index.tsx
index 30c6897..5d69567 100644
--- a/src/dashboard/Dashboard.tsx
+++ b/src/dashboard/index.tsx
@@ -1,8 +1,4 @@
-import { Button, Grid, Tooltip, Typography } from "@material-ui/core";
-import Box from "@material-ui/core/Box";
-import Drawer from "@material-ui/core/Drawer";
-import List from "@material-ui/core/List";
-import { createStyles, makeStyles, Theme } from "@material-ui/core/styles";
+import { Box, Grid, Tooltip } from "@material-ui/core";
import AccountBalanceWalletOutlinedIcon from "@material-ui/icons/AccountBalanceWalletOutlined";
import CachedIcon from "@material-ui/icons/Cached";
import HistoryIcon from "@material-ui/icons/History";
@@ -21,50 +17,30 @@ import { interval } from "rxjs";
import { filter, map, mergeMap, takeUntil } from "rxjs/operators";
import api from "../api";
import { isElectron, sendMessageToParent } from "../common/appUtil";
-import NotFound from "../common/NotFound";
+import NotFound from "../common/notFound";
import { SetupStatusResponse } from "../models/SetupStatusResponse";
import { Status } from "../models/Status";
import { Path } from "../router/Path";
-import Console from "./console/Console";
-import MenuItem, { MenuItemProps } from "./menu/MenuItem";
-import Overview from "./overview/Overview";
+import Console from "./console";
+import MenuItem, { MenuItemProps } from "./menu/menuItem";
+import Overview from "./overview";
// import SetupWarning from "./SetupWarning";
import Trade from "./trade/Trade";
-import Tradehistory from "./tradehistory/Tradehistory";
-import Wallets from "./wallet/Wallets";
+import Tradehistory from "./tradehistory";
+import Wallets from "./wallet/wallets";
/* import SettingsIcon from "@material-ui/icons/Settings";
import Settings from "../settings/Settings"; */
-export const drawerWidth = 200;
-
-const useStyles = makeStyles((theme: Theme) =>
- createStyles({
- drawerPaper: {
- width: drawerWidth,
- justifyContent: "space-between",
- },
- menuContainer: {
- width: "100%",
- },
- header: {
- padding: "16px",
- },
- drawerButton: {
- margin: theme.spacing(2),
- },
- content: {
- marginLeft: drawerWidth,
- backgroundColor: theme.palette.background.default,
- padding: theme.spacing(3),
- height: "100vh",
- display: "flex",
- flexDirection: "column",
- },
- })
-);
+//styles
+import {
+ DrawerPaper,
+ MenuContainer,
+ Header,
+ DrawerButton,
+ Content
+} from "./styles";
const Dashboard = (): ReactElement => {
- const classes = useStyles();
const history = useHistory();
const { path } = useRouteMatch();
const [syncInProgress, setSyncInProgress] = useState(false);
@@ -155,23 +131,19 @@ const Dashboard = (): ReactElement => {
return (
-
-
XUD UI
-
-
+
+
{menuItems.map((item) => (
+
{/*
@@ -198,21 +170,20 @@ const Dashboard = (): ReactElement => {
{isElectron() && (
- }
variant="outlined"
- className={classes.drawerButton}
onClick={disconnect}
>
Disconnect
-
+
)}
-
-
+
+
{/*
{}
*/}
@@ -232,7 +203,7 @@ const Dashboard = (): ReactElement => {
-
+
);
};
diff --git a/src/dashboard/menu/MenuItem.tsx b/src/dashboard/menu/menuItem/index.tsx
similarity index 79%
rename from src/dashboard/menu/MenuItem.tsx
rename to src/dashboard/menu/menuItem/index.tsx
index 97acccb..1f010cb 100644
--- a/src/dashboard/menu/MenuItem.tsx
+++ b/src/dashboard/menu/menuItem/index.tsx
@@ -1,15 +1,14 @@
import {
ListItemIcon,
- Tooltip,
- Theme,
- createStyles,
- makeStyles,
+ Tooltip
} from "@material-ui/core";
-import ListItem from "@material-ui/core/ListItem";
import ListItemText from "@material-ui/core/ListItemText";
import React, { ComponentClass, ElementType, ReactElement } from "react";
import { NavLink, useLocation, useRouteMatch } from "react-router-dom";
-import { Path } from "../../router/Path";
+import { Path } from "../../../router/Path";
+
+//styles
+import { ListItem } from "./styles";
export type MenuItemProps = {
path: Path;
@@ -21,18 +20,9 @@ export type MenuItemProps = {
tooltipTextRows?: string[];
};
-const useStyles = makeStyles((theme: Theme) =>
- createStyles({
- disabled: {
- color: theme.palette.text.disabled,
- },
- })
-);
-
function MenuItem(props: MenuItemProps): ReactElement {
const { url } = useRouteMatch();
const { pathname } = useLocation();
- const classes = useStyles();
const navigateTo = `${url}${props.path}`;
const isCurrentLocation = (): boolean => {
@@ -49,7 +39,7 @@ function MenuItem(props: MenuItemProps): ReactElement {
}
>
`
+ ${p => p.isDisabled && `
+ color: ${p.theme.palette.text.disabled};
+ `}
+`;
\ No newline at end of file
diff --git a/src/dashboard/overview/Overview.tsx b/src/dashboard/overview/index.tsx
similarity index 95%
rename from src/dashboard/overview/Overview.tsx
rename to src/dashboard/overview/index.tsx
index 0b7e593..23cca90 100644
--- a/src/dashboard/overview/Overview.tsx
+++ b/src/dashboard/overview/index.tsx
@@ -3,10 +3,10 @@ import Grid from "@material-ui/core/Grid";
import React, { ReactElement } from "react";
import { RouteComponentProps, withRouter } from "react-router-dom";
import api from "../../api";
-import PageCircularProgress from "../../common/PageCircularProgress";
+import PageCircularProgress from "../../common/pageCircularProgress";
import { Status } from "../../models/Status";
import DashboardContent, { DashboardContentState } from "../DashboardContent";
-import OverviewItem from "./OverviewItem";
+import OverviewItem from "./overviewItem";
type PropsType = RouteComponentProps<{ param1: string }> &
WithStyles;
diff --git a/src/dashboard/overview/OverviewItem.tsx b/src/dashboard/overview/overviewItem/index.tsx
similarity index 68%
rename from src/dashboard/overview/OverviewItem.tsx
rename to src/dashboard/overview/overviewItem/index.tsx
index eef15db..41f1115 100644
--- a/src/dashboard/overview/OverviewItem.tsx
+++ b/src/dashboard/overview/overviewItem/index.tsx
@@ -1,28 +1,32 @@
import {
Button,
- createStyles,
Divider,
Icon,
IconButton,
- makeStyles,
- Snackbar,
- SnackbarContent,
- Theme,
Tooltip,
} from "@material-ui/core";
import Card from "@material-ui/core/Card";
-import CardContent from "@material-ui/core/CardContent";
import Grid from "@material-ui/core/Grid";
import Typography from "@material-ui/core/Typography";
import CloseIcon from "@material-ui/icons/Close";
import GetAppOutlinedIcon from "@material-ui/icons/GetAppOutlined";
import React, { ReactElement, useState } from "react";
-import api from "../../api";
-import { formatDateTimeForFilename } from "../../common/dateUtil";
-import { isServiceReady } from "../../common/serviceUtil";
-import { SERVICES_WITH_ADDITIONAL_INFO } from "../../constants";
-import { Status } from "../../models/Status";
-import ServiceDetails from "./ServiceDetails";
+import api from "../../../api";
+import { formatDateTimeForFilename } from "../../../common/dateUtil";
+import { isServiceReady } from "../../../common/serviceUtil";
+import { SERVICES_WITH_ADDITIONAL_INFO } from "../../../constants";
+import { Status } from "../../../models/Status";
+import ServiceDetails from "../serviceDetails";
+
+//styles
+import {
+ StyledGrid,
+ CardContent,
+ CardCellGrid,
+ StatusDot,
+ Snackbar,
+ SnackbarContent
+} from "./styles";
export type OverviewItemProps = {
status: Status;
@@ -30,45 +34,6 @@ export type OverviewItemProps = {
xudNotReady?: boolean;
};
-const useStyles = makeStyles((theme: Theme) =>
- createStyles({
- cardHeader: {
- padding: theme.spacing(3),
- },
- cardContent: {
- padding: 0,
- "&:last-child": {
- paddingBottom: 0,
- },
- },
- cardCell: {
- padding: theme.spacing(4),
- textAlign: "center",
- },
- statusDot: {
- height: 10,
- width: 10,
- borderRadius: "50%",
- display: "inline-block",
- marginRight: 10,
- },
- active: {
- backgroundColor: theme.palette.success.light,
- },
- inactive: {
- backgroundColor: theme.palette.error.light,
- },
- snackbar: {
- bottom: theme.spacing(3) * 2,
- right: theme.spacing(3) * 2,
- },
- snackbarMessage: {
- backgroundColor: theme.palette.error.main,
- color: theme.palette.error.contrastText,
- },
- })
-);
-
const downloadLogs = (serviceName: string, handleError: () => void): void => {
api.logs$(serviceName).subscribe({
next: (resp: string) => {
@@ -89,11 +54,6 @@ const OverviewItem = (props: OverviewItemProps): ReactElement => {
const { status, xudLocked, xudNotReady } = props;
const [detailsOpen, setDetailsOpen] = useState(false);
const [errorMsgOpen, setErrorMsgOpen] = useState(false);
- const classes = useStyles();
-
- const statusDotClass = `${classes.statusDot} ${
- isServiceReady(status) ? classes.active : classes.inactive
- }`;
const isDetailsIconVisible = (status: Status): boolean => {
return (
@@ -113,12 +73,11 @@ const OverviewItem = (props: OverviewItemProps): ReactElement => {
return (
-
{isDetailsIconVisible(status) && (
@@ -136,7 +95,7 @@ const OverviewItem = (props: OverviewItemProps): ReactElement => {
justify="center"
wrap="nowrap"
>
-
+
{props.status.service}
@@ -156,17 +115,17 @@ const OverviewItem = (props: OverviewItemProps): ReactElement => {
)}
-
+
-
+
-
+
Status
-
+
-
+
{props.status.status}
-
+
@@ -179,14 +138,12 @@ const OverviewItem = (props: OverviewItemProps): ReactElement => {
)}
setErrorMsgOpen(false)}
anchorOrigin={{ vertical: "bottom", horizontal: "right" }}
>
setErrorMsgOpen(false)}>
diff --git a/src/dashboard/overview/overviewItem/styles.ts b/src/dashboard/overview/overviewItem/styles.ts
new file mode 100644
index 0000000..a818109
--- /dev/null
+++ b/src/dashboard/overview/overviewItem/styles.ts
@@ -0,0 +1,72 @@
+import styled from "styled-components";
+import {
+ Grid,
+ CardContent as $CardContent,
+ Snackbar as $Snackbar,
+ SnackbarContent as $SnackbarContent,
+} from "@material-ui/core";
+
+//type
+type StyledGridType = {
+ container: boolean;
+ justify: string;
+ alignItems: string;
+ wrap: string;
+};
+
+type CardCellGridType = {
+ item: boolean;
+ xs: number
+};
+
+type StatusDotType = {
+ isServiceReady: boolean;
+}
+
+type SnackbarType = {
+ open: boolean;
+ autoHideDuration: number;
+ onClose: () => void;
+ anchorOrigin: object;
+}
+
+type SnackbarContentType = {
+ message: string;
+ action: any;
+}
+
+//styled
+export const StyledGrid = styled(Grid)`
+ padding: ${p => p.theme.spacing(3)}px;
+`;
+
+export const CardContent = styled($CardContent)`
+ padding: 0px;
+ &:last-child {
+ padding-bottom: 0px;
+ }
+`;
+
+export const CardCellGrid = styled(Grid)`
+ padding: ${p => p.theme.spacing(4)}px;
+ text-align: center;
+`;
+
+export const StatusDot = styled.span`
+ height: 10px;
+ width: 10px;
+ border-radius: 50%;
+ display: inline-block;
+ margin-right: 10px;
+ background-color: ${p => p.isServiceReady ? p.theme.palette.success.light : p.theme.palette.error.light};
+`;
+
+export const Snackbar = styled($Snackbar)`
+ bottom: ${p => p.theme.spacing(3) * 2}px;
+ right: ${p => p.theme.spacing(3) * 2}px;
+`;
+
+export const SnackbarContent = styled($SnackbarContent)`
+ background-color: ${p => p.theme.palette.error.main};
+ color: ${p => p.theme.palette.error.contrastText};
+`;
\ No newline at end of file
diff --git a/src/dashboard/overview/ServiceDetails.tsx b/src/dashboard/overview/serviceDetails/index.tsx
similarity index 65%
rename from src/dashboard/overview/ServiceDetails.tsx
rename to src/dashboard/overview/serviceDetails/index.tsx
index 56f0429..3f5db4f 100644
--- a/src/dashboard/overview/ServiceDetails.tsx
+++ b/src/dashboard/overview/serviceDetails/index.tsx
@@ -1,50 +1,32 @@
import {
- createStyles,
- Dialog,
DialogTitle,
Divider,
- Grid,
- makeStyles,
- Theme,
+ Grid
} from "@material-ui/core";
import IconButton from "@material-ui/core/IconButton";
import Typography from "@material-ui/core/Typography";
import CloseIcon from "@material-ui/icons/Close";
import React, { ReactElement } from "react";
-import { Status } from "../../models/Status";
-import { drawerWidth } from "../Dashboard";
-import ServiceDetailsContent from "./ServiceDetailsContent";
+import { Status } from "../../../models/Status";
+import ServiceDetailsContent from "../serviceDetailsContent";
+
+//styles
+import {
+ Dialog
+} from "./styles";
export type ServiceDetailsProps = {
status: Status;
handleClose: () => void;
};
-const useStyles = makeStyles((theme: Theme) =>
- createStyles({
- dialog: {
- position: "absolute",
- left: drawerWidth,
- top: 0,
- margin: theme.spacing(3),
- width: "100%",
- maxWidth: `calc(100% - ${drawerWidth + theme.spacing(3) * 2}px)`,
- backgroundColor: theme.palette.background.default,
- },
- })
-);
-
const ServiceDetails = (props: ServiceDetailsProps): ReactElement => {
const { status, handleClose } = props;
- const classes = useStyles();
return (