Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a star repo modal #1492

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions Client/src/Components/Sidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import ChangeLog from "../../assets/icons/changeLog.svg?react";
import Docs from "../../assets/icons/docs.svg?react";
import Folder from "../../assets/icons/folder.svg?react";
import ChatBubbleOutlineRoundedIcon from "@mui/icons-material/ChatBubbleOutlineRounded";
import CloseIcon from "@mui/icons-material/Close"; // Importing CloseIcon from MUI

import "./index.css";

Expand Down Expand Up @@ -119,6 +120,7 @@ function Sidebar() {
const [anchorEl, setAnchorEl] = useState(null);
const [popup, setPopup] = useState();
const { user } = useSelector((state) => state.auth);
const [showStarRepo, setShowStarRepo] = useState(true);

const accountMenuItem = menu.find((item) => item.name === "Account");
if (user.role?.includes("demo") && accountMenuItem) {
Expand Down Expand Up @@ -156,6 +158,18 @@ function Sidebar() {
}
}, [location]);

useEffect(() => {
const hasClosed = localStorage.getItem("starRepoClosed");
if (hasClosed) {
setShowStarRepo(false);
}
}, []);

const handleCloseStarRepo = () => {
setShowStarRepo(false);
localStorage.setItem("starRepoClosed", "true");
};

/* TODO refactor this, there are a some ternaries and comments in the return */

return (
Expand Down Expand Up @@ -508,6 +522,44 @@ function Sidebar() {
</List>
<Divider sx={{ mt: "auto" }} />

{showStarRepo && (
<Box
sx={{
backgroundColor: "white",
padding: theme.spacing(4),
borderRadius: theme.shape.borderRadius,
position: "relative",
height: "100px",
display: "flex",
flexDirection: "column",
justifyContent: "center",
margin: theme.spacing(3),
}}
>
<Typography style={{ fontStyle: "bold" , marginTop: "5px",color: "black" , fontSize: "16px" }} variant="body2" color="black">
Star Checkmate
</Typography>
<Typography style={{ fontSize: "13px" , marginTop: "10px" , color: "black" }} variant="body2" color="black">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded values, especially font sizes and colors, are inhernetly not maintainable.

Please refactor to make use of the theme.

See the latest releases and help grow the community on GitHub
</Typography>
<Box sx={{ display: "flex", justifyContent: "Start", alignItems: "center" , marginTop: "10px" , marginBottom: "10px" }}>
<a href="https://github.com/bluewave-labs/checkmate" target="_blank" rel="noopener noreferrer"> <img src="https://img.shields.io/github/stars/bluewave-labs/checkmate?label=checkmate&style=social" alt="Checkmate Logo" /> </a>
</Box>
<Box sx={{ borderTop: '1px solid', borderColor: theme.palette.divider, my: 2 }} />
<IconButton
sx={{
position: "absolute",
top: 0,
right: 0,
mt: "-10px",
}}
onClick={handleCloseStarRepo}
>
<CloseIcon />
</IconButton>
</Box>
)}

<Stack
direction="row"
height="50px"
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Dikshit! Thanks for your effort.

Since the Client and Server has separate dependencies in their directories we don't need package-lock.json file in the root directory. I think it comes from wrongly used npm install command, you can remove it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, please remove this pacakge-lock.json file.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.