Skip to content

Commit

Permalink
fix: link
Browse files Browse the repository at this point in the history
  • Loading branch information
RiverTwilight committed Oct 29, 2024
1 parent 75a095d commit 0425183
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import ListItemIcon from "@mui/material/ListItemIcon";
import ListItemText from "@mui/material/ListItemText";
import ListItemAvatar from "@mui/material/ListItemAvatar";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import HomeOutlinedIcon from "@mui/icons-material/HomeOutlined";
import { repo } from "../site.config";
import MessageOutlinedIcon from "@mui/icons-material/MessageOutlined";
Expand All @@ -32,8 +31,6 @@ import { ListItemButton, Theme, useMediaQuery } from "@mui/material";
import { useSidebar } from "@/contexts/sidebar";
import Text from "./i18n";
import { isIOS, isWeb } from "@/utils/platform";
import useNotifications from "@/utils/Hooks/useNotification";
import { Badge } from "@mui/material";

const drawerWidth = 260;

Expand All @@ -44,8 +41,8 @@ type SidebarItem = {
Icon: React.ReactNode;
text: React.ReactNode | string;
href: string;
sx?: any; // Add sx prop to fix the TypeScript error
isExternal?: boolean; // New prop to identify external links
sx?: any; // Ensure sx is optional
isExternal?: boolean;
};

const LinkWrapper = ({
Expand All @@ -68,8 +65,8 @@ const LinkWrapper = ({
href={href}
passHref
legacyBehavior
{...props}
target={isExternal ? "_blank" : undefined}
{...props}
>
<ListItemButton
onClick={handleClick}
Expand All @@ -83,8 +80,7 @@ const LinkWrapper = ({
...sx,
}}
className={router.pathname == href ? "Mui-selected" : ""}
button
key={text}
key={href}
>
<ListItemIcon>{Icon}</ListItemIcon>
<ListItemText primary={text} />
Expand All @@ -100,10 +96,6 @@ const LinkWrapper = ({
};

const Sidebar = () => {
// const history = useHistory()

const userData = React.useContext(UserContext);

const { sidebar, setSidebar } = useSidebar();

const downXs = useMediaQuery((theme: Theme) =>
Expand All @@ -116,9 +108,6 @@ const Sidebar = () => {
}
};

const [notifications] = useNotifications();
const unreadCount = notifications.filter((n) => !n.isRead).length;

const list = [
{
Icon: <HomeOutlinedIcon />,
Expand All @@ -134,14 +123,12 @@ const Sidebar = () => {
Icon: <MessageOutlinedIcon />,
text: <Text k="navbar.feedback" />,
href: "/feedback",
// href: "https://support.qq.com/product/421719",
},
!isIOS() && {
Icon: <VolunteerActivismOutlinedIcon />,
text: <Text k="navbar.donation" />,
href: "/donate",
},

{
Icon: <InfoOutlinedIcon />,
text: "<divider />",
Expand All @@ -155,15 +142,11 @@ const Sidebar = () => {
{
Icon: <GitHubIcon />,
text: "GitHub",
href: repo,
href: "https://github.com/rivertwilight/geekits",
isExternal: true,
},
{
Icon: (
<Badge badgeContent={unreadCount} color="error">
<TimerOutlined />
</Badge>
),
Icon: <TimerOutlined />,
text: <Text k="navbar.log" />,
href: "https://www.ygeeker.com/geekits/support/release-notes",
isExternal: true,
Expand Down

0 comments on commit 0425183

Please sign in to comment.