Skip to content

Commit

Permalink
Merge pull request #135 from shreyas1434shinde/main
Browse files Browse the repository at this point in the history
workspace popup issue fix
  • Loading branch information
itsvick authored Dec 2, 2024
2 parents 07448d8 + f876621 commit 85a239c
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"next-transpile-modules": "^10.0.1",
"react": "^18",
"react-dom": "^18",
"react-toastify": "^10.0.6",
"react-hot-toast": "^2.4.1",
"reflect-metadata": "^0.1.13",
"svg2img": "^1.0.0-beta.2",
"url": "^0.11.3",
Expand Down
75 changes: 61 additions & 14 deletions src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { useEffect, useState } from "react";
import { Box } from "@mui/material";
import { Box, Button } from "@mui/material";
import Sidebar from "./SideBar";
import { toast, ToastContainer } from "react-toastify";
import { Toaster, toast } from "react-hot-toast";
import CloseIcon from '@mui/icons-material/Close';
import PersonalVideoIcon from '@mui/icons-material/PersonalVideo';

interface LayoutProps {
children: React.ReactNode;
Expand All @@ -15,13 +17,32 @@ const Layout: React.FC<LayoutProps> = ({ children, selectedKey, onSelect }) => {
useEffect(() => {
const handleResize = () => {
if (window.innerWidth < 768 && !toastShown) {
toast.info("For a better experience, please use a desktop.", {
toast((t) => (
<Box style={{ display: "flex", alignItems: "center", gap:'15px', justifyContent: "space-between" }}>
<Box sx={{display:'flex', alignItems:'flex-start', gap:'15px'}}>
<PersonalVideoIcon sx={{ color:'#FFFFFF'}}/>
<Box sx={{ fontSize: '14px', color: '#F4F4F4', fontWeight: '500' }}>Switch to desktop for a better experience</Box>
</Box>
<Button
onClick={() => toast.dismiss(t.id)}
style={{
marginLeft: "10px",
background: "transparent",
border: "none",
color: "#fff",
cursor: "pointer",
}}
>
<CloseIcon/>
</Button>
</Box>
), {
position: "top-center",
autoClose: false,
hideProgressBar: true,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
duration: Infinity,
style: {
background: "green",
color: "#fff",
},
});
setToastShown(true); // Mark toast as shown
}
Expand All @@ -35,15 +56,41 @@ const Layout: React.FC<LayoutProps> = ({ children, selectedKey, onSelect }) => {
window.removeEventListener("resize", handleResize);
};
}, [toastShown]);

return (
<Box display="flex" sx={{ overflowX: 'hidden !important' }} minHeight={"100vh"}>
<ToastContainer position="bottom-left" autoClose={3000} stacked={false} />
<Box sx={{ maxHeight: '132vh', minHeight: '100vh', '@media (max-width: 900px)': { position: 'absolute', top:"3px" }, '@media (min-width: 900px)': { background: "linear-gradient(to bottom, white, #F8EFDA)", position:'fixed' } }}>
<Box display="flex" sx={{ overflowX: "hidden !important" }} minHeight="100vh">
<Toaster />
<Box
sx={{
maxHeight: "132vh",
minHeight: "100vh",
"@media (max-width: 900px)": {
position: "absolute",
top: "3px",
},
"@media (min-width: 900px)": {
background: "linear-gradient(to bottom, white, #F8EFDA)",
position: "fixed",
},
}}
>
<Sidebar selectedKey={selectedKey} onSelect={onSelect} />
</Box>
<Box sx={{ flex: 1, background: '#F3F5F8', '@media (min-width: 900px)': { width: 'calc(100% - 251px)', marginLeft:'284px' }, width: '100%' }}>{children}</Box>
<Box
sx={{
flex: 1,
background: "#F3F5F8",
"@media (min-width: 900px)": {
width: "calc(100% - 251px)",
marginLeft: "284px",
},
width: "100%",
}}
>
{children}
</Box>
</Box>
)
);
};

export default Layout;
export default Layout;
2 changes: 0 additions & 2 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ import "../styles/global.css";
import { AppProps } from "next/app";
import customTheme from "@/styles/CustomTheme";
import { useEffect, useState } from "react";
import { toast, ToastContainer } from "react-toastify";

export default function App({ Component, pageProps }: AppProps) {



return (
<CssVarsProvider theme={customTheme}>
<ToastContainer position="bottom-left" autoClose={3000} stacked={false} />
<Component {...pageProps} />;
</CssVarsProvider>
);
Expand Down

0 comments on commit 85a239c

Please sign in to comment.