Skip to content

Commit 4ac3fef

Browse files
author
John Rogers
committed
enabled buttons to discover with dialog
1 parent 602b2d4 commit 4ac3fef

2 files changed

Lines changed: 95 additions & 2 deletions

File tree

src/components/ComingSoonDialog.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import React from "react";
2+
import {
3+
Dialog,
4+
DialogTitle,
5+
DialogContent,
6+
DialogActions,
7+
Button,
8+
Typography,
9+
Box,
10+
IconButton,
11+
} from "@mui/material";
12+
import { Close as CloseIcon, Construction } from "@mui/icons-material";
13+
14+
export default function ComingSoonDialog({
15+
open,
16+
onClose,
17+
featureName = "This feature",
18+
}) {
19+
return (
20+
<Dialog
21+
open={open}
22+
onClose={onClose}
23+
maxWidth="sm"
24+
fullWidth
25+
PaperProps={{
26+
sx: {
27+
borderRadius: 2,
28+
},
29+
}}
30+
>
31+
<DialogTitle>
32+
<Box
33+
sx={{
34+
display: "flex",
35+
justifyContent: "space-between",
36+
alignItems: "center",
37+
}}
38+
>
39+
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
40+
<Construction sx={{ color: "#ff9800", fontSize: 24 }} />
41+
<Typography variant="h6">Coming Soon</Typography>
42+
</Box>
43+
<IconButton size="small" onClick={onClose}>
44+
<CloseIcon />
45+
</IconButton>
46+
</Box>
47+
</DialogTitle>
48+
<DialogContent dividers>
49+
<Typography variant="body1" color="text.secondary">
50+
{featureName} is coming soon! We're working hard to bring you this
51+
feature.
52+
</Typography>
53+
</DialogContent>
54+
<DialogActions sx={{ p: 3, pt: 2 }}>
55+
<Button onClick={onClose} variant="contained">
56+
Got it
57+
</Button>
58+
</DialogActions>
59+
</Dialog>
60+
);
61+
}

src/components/HarmonySidebar.js

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { Logout, JoinInner } from "@mui/icons-material/";
2121
import GoogleIcon from "@mui/icons-material/Google";
2222
import GitHubIcon from "@mui/icons-material/GitHub";
2323
import TwitterIcon from "@mui/icons-material/Twitter";
24+
import ComingSoonDialog from "./ComingSoonDialog";
2425

2526
// Get current domain for dynamic links
2627
const getCurrentDomain = () => {
@@ -106,6 +107,8 @@ export default function HarmonySidebar() {
106107
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
107108
const [anchorUser, setAnchorUser] = useState(null);
108109
const [apiVersion, setApiVersion] = useState(null);
110+
const [comingSoonOpen, setComingSoonOpen] = useState(false);
111+
const [comingSoonFeature, setComingSoonFeature] = useState("");
109112

110113
const {
111114
currentUser,
@@ -116,6 +119,16 @@ export default function HarmonySidebar() {
116119
} = useAuth();
117120
const { getVersion } = useData();
118121

122+
const handleNavigationClick = (e, item) => {
123+
// For Browse, Explore, Compare, and Saves, show coming soon dialog
124+
if (["Browse", "Explore", "Compare", "Saves"].includes(item.text)) {
125+
e.preventDefault();
126+
setComingSoonFeature(item.text);
127+
setComingSoonOpen(true);
128+
}
129+
// Search and Harmonise should work normally
130+
};
131+
119132
// Determine if an item is active
120133
const isActive = (item) => {
121134
if (item.text === "Harmonise") {
@@ -215,11 +228,17 @@ export default function HarmonySidebar() {
215228

216229
return (
217230
<ListItemButton
218-
disabled={isExternal}
231+
disabled={
232+
item.text !== "Search" &&
233+
["Browse", "Explore", "Compare", "Saves"].includes(item.text)
234+
? false
235+
: isExternal
236+
}
219237
key={item.text}
220238
component={isExternal ? "a" : Link}
221239
href={isExternal ? item.href : undefined}
222240
to={isExternal ? undefined : item.href}
241+
onClick={(e) => handleNavigationClick(e, item)}
223242
selected={isActive(item)}
224243
sx={{
225244
flexDirection: "column",
@@ -365,10 +384,18 @@ export default function HarmonySidebar() {
365384
return (
366385
<ListItem key={item.text} disablePadding>
367386
<ListItemButton
368-
disabled={isExternal}
387+
disabled={
388+
item.text !== "Search" &&
389+
["Browse", "Explore", "Compare", "Saves"].includes(
390+
item.text
391+
)
392+
? false
393+
: isExternal
394+
}
369395
component={isExternal ? "a" : Link}
370396
href={isExternal ? item.href : undefined}
371397
to={isExternal ? undefined : item.href}
398+
onClick={(e) => handleNavigationClick(e, item)}
372399
selected={isActive(item)}
373400
sx={{
374401
minHeight: 48,
@@ -594,6 +621,11 @@ export default function HarmonySidebar() {
594621
</Menu>
595622
</Box>
596623
</Box>
624+
<ComingSoonDialog
625+
open={comingSoonOpen}
626+
onClose={() => setComingSoonOpen(false)}
627+
featureName={comingSoonFeature}
628+
/>
597629
</>
598630
);
599631
}

0 commit comments

Comments
 (0)