Skip to content

Commit 64c9838

Browse files
committed
[#3261] - Redirects: UI Enhancements
1 parent 423f765 commit 64c9838

File tree

8 files changed

+292
-160
lines changed

8 files changed

+292
-160
lines changed

Diff for: src/apps/seo/src/app/index.tsx

+16-15
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@ import { Box } from "@mui/material";
55

66
import { RedirectsManager } from "../views/RedirectsManager";
77

8-
import styles from "./app.less";
98
export default connect((state) => state)(
109
class HealthApp extends Component {
1110
render() {
1211
return (
13-
<Box component="section" className={styles.HealthApp}>
14-
<Box
15-
component="main"
16-
className={styles.wrapper}
17-
sx={{
18-
backgroundColor: "background.paper",
19-
}}
20-
>
21-
<Switch>
22-
<Route exact path="/redirects">
23-
<RedirectsManager {...this.props} />
24-
</Route>
25-
</Switch>
26-
</Box>
12+
<Box
13+
component="section"
14+
bgcolor="grey.50"
15+
color="text.primary"
16+
height="calc(100vh - 40px)"
17+
width="100%"
18+
display="flex"
19+
flexDirection="column"
20+
boxSizing="border-box"
21+
overflow="hidden"
22+
>
23+
<Switch>
24+
<Route exact path="/redirects">
25+
<RedirectsManager {...this.props} />
26+
</Route>
27+
</Switch>
2728
</Box>
2829
);
2930
}
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,44 @@
1-
import { Box } from "@mui/material";
2-
import styles from "./RedirectActions.less";
3-
1+
import { Box, Typography } from "@mui/material";
2+
import { CSVImporter } from "../../../store/imports";
43
import { RedirectFilter } from "./RedirectFilter";
4+
import RedirectsImport from "./RedirectsImport";
5+
import { useDispatch } from "react-redux";
56

67
interface RedirectActionsProps {
78
redirectsTotal: number;
89
dispatch: () => void;
910
}
1011
export default function RedirectActions(props: RedirectActionsProps) {
12+
const dispatch = useDispatch();
1113
return (
1214
<Box
1315
component="header"
14-
className={styles.RedirectActions}
16+
width="100%"
1517
sx={{
1618
backgroundColor: "background.paper",
19+
alignItems: "center",
20+
justifyContent: "space-between",
21+
display: "flex",
22+
top: "0",
23+
zIndex: 2,
1724
}}
1825
>
19-
<h1 className={styles.title}>{props.redirectsTotal} Total Redirects</h1>
20-
<div className={styles.actions}>
26+
<Typography variant="h3" fontWeight="700">
27+
{props.redirectsTotal} Total Redirects
28+
</Typography>
29+
<Box
30+
display="flex"
31+
justifyContent="space-between"
32+
alignItems="center"
33+
columnGap={1}
34+
>
2135
<RedirectFilter dispatch={props.dispatch} />
22-
</div>
36+
<RedirectsImport
37+
onChange={(evt: any) => {
38+
dispatch(CSVImporter(evt as any));
39+
}}
40+
/>
41+
</Box>
2342
</Box>
2443
);
2544
}

Diff for: src/apps/seo/src/views/RedirectsManager/RedirectActions/RedirectFilter/RedirectFilter.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@ export function RedirectFilter(props) {
1717

1818
return (
1919
<TextField
20-
placeholder="Filter your redirects by url"
20+
placeholder="Filter Redirects"
2121
type="search"
2222
variant="outlined"
2323
size="small"
2424
value={filter}
2525
InputProps={{
26+
sx: {
27+
backgroundColor: "grey.50",
28+
input: {
29+
py: 0.75,
30+
},
31+
},
2632
startAdornment: (
2733
<InputAdornment position="start">
2834
<SearchIcon fontSize="small" />
@@ -33,6 +39,12 @@ export function RedirectFilter(props) {
3339
const term = evt.target.value.trim();
3440
handleFilter(term);
3541
}}
42+
sx={{
43+
width: "240px",
44+
"& .MuiOutlinedInput-notchedOutline": {
45+
border: 0,
46+
},
47+
}}
3648
/>
3749
);
3850
}

Diff for: src/apps/seo/src/views/RedirectsManager/RedirectActions/RedirectsImport/RedirectsImport.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import Button from "@mui/material/Button";
22
import UploadIcon from "@mui/icons-material/Upload";
33

44
// import styles from "./RedirectsImport.less";
5+
import Box from "@mui/material/Box";
56
export default function RedirectsImport(props) {
67
let fileInput = null;
78
return (
8-
<div>
9+
<Box>
910
<input
1011
type="file"
1112
hidden
@@ -15,13 +16,14 @@ export default function RedirectsImport(props) {
1516
<Button
1617
variant="outlined"
1718
color="inherit"
19+
size="small"
1820
onClick={() => {
1921
fileInput.click();
2022
}}
2123
startIcon={<UploadIcon />}
2224
>
2325
Import CSV/XML
2426
</Button>
25-
</div>
27+
</Box>
2628
);
2729
}
+42-21
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import { useEffect, useState } from "react";
2-
32
import { WithLoader } from "@zesty-io/core/WithLoader";
4-
5-
import RedirectActions from "./RedirectActions";
63
import RedirectsTable from "./RedirectsTable";
74
import RedirectImportTable from "./RedirectImportTable";
8-
95
import { fetchRedirects } from "../../store/redirects";
6+
import { Box } from "@mui/material";
7+
import RedirectActions from "./RedirectActions";
108

11-
import styles from "./RedirectsManager.less";
129
export default function RedirectManager(props) {
1310
const [loading, setLoading] = useState(true);
1411

@@ -30,23 +27,47 @@ export default function RedirectManager(props) {
3027
}, []);
3128

3229
return (
33-
<div className={styles.RedirectsManager}>
34-
<RedirectActions
35-
dispatch={props.dispatch}
36-
redirectsTotal={Object.keys(props.redirects).length}
37-
/>
30+
<>
31+
<Box
32+
display="flex"
33+
justifyContent="space-between"
34+
boxSizing="border-box"
35+
px={4}
36+
pt={4}
37+
pb={1.75}
38+
sx={{
39+
borderBottom: (theme) => `2px solid ${theme.palette.border}`,
40+
backgroundColor: "background.paper",
41+
}}
42+
>
43+
<RedirectActions
44+
dispatch={props.dispatch}
45+
redirectsTotal={Object.keys(props.redirects).length}
46+
/>
47+
</Box>
3848

39-
<WithLoader
40-
condition={!loading}
41-
message="Loading Redirects"
42-
height="calc(100vh - 172px)"
49+
<Box
50+
flexGrow={1}
51+
display="flex"
52+
justifyContent="center"
53+
alignItems="center"
54+
px={4}
55+
py={2}
56+
boxSizing="border-box"
57+
position="relative"
4358
>
44-
{Object.keys(props.imports).length ? (
45-
<RedirectImportTable {...props} />
46-
) : (
47-
<RedirectsTable {...props} />
48-
)}
49-
</WithLoader>
50-
</div>
59+
<WithLoader
60+
condition={!loading}
61+
message="Loading Redirects"
62+
height="100%"
63+
>
64+
{Object.keys(props.imports).length ? (
65+
<RedirectImportTable {...props} />
66+
) : (
67+
<RedirectsTable {...props} />
68+
)}
69+
</WithLoader>
70+
</Box>
71+
</>
5172
);
5273
}

0 commit comments

Comments
 (0)