Skip to content
Merged
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
19 changes: 16 additions & 3 deletions src/app/_components/common/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import { Group, Text } from "@mantine/core";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { usePathname, useRouter } from "next/navigation";
import { useState } from "react";
import { AdminDashboard } from "@/app/_components/admincomponents/admin-dashboard";
import Bell from "@/assets/icons/bell";
import Home from "@/assets/icons/home";
import { api } from "@/trpc/react";
import IconButton from "./button/IconButton";
import styles from "./navbar.module.scss";
import Profile from "./profile/profile";

Expand Down Expand Up @@ -35,11 +37,22 @@ function NavLink({ href, children }: NavLinkProps) {

export default function Navbar({ view, agencyName }: NavbarProps) {
const [inviteModalOpen, setInviteModalOpen] = useState(false);

const router = useRouter();
const { mutate } = api.organization.redirectToDashboard.useMutation({
onSuccess: (data) => {
router.replace(data.redirectUrl);
},
});
return (
<Group justify="space-between" className={`border-bottom ${styles.navbar}`}>
<Group>
<Home />
<IconButton
onClick={() => mutate()}
ariaLabel="Button"
icon={<Home />}
color="blue"
transparent={true}
></IconButton>
Comment on lines +49 to +55

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Improve ariaLabel for accessibility.

ariaLabel="Button" is not descriptive for screen reader users. Use a meaningful label like "Home" or "Go to dashboard".

♿ Proposed fix
        <IconButton
          onClick={() => mutate()}
-         ariaLabel="Button"
+         ariaLabel="Home"
          icon={<Home />}
          color="blue"
          transparent={true}
        ></IconButton>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<IconButton
onClick={() => mutate()}
ariaLabel="Button"
icon={<Home />}
color="blue"
transparent={true}
></IconButton>
<IconButton
onClick={() => mutate()}
ariaLabel="Home"
icon={<Home />}
color="blue"
transparent={true}
></IconButton>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/_components/common/navbar.tsx` around lines 49 - 55, The current
IconButton usage sets ariaLabel="Button", which is not descriptive; update the
IconButton component instance (the one with onClick={() => mutate()} and
icon={<Home />}) to use a meaningful ariaLabel such as "Home" or "Go to
dashboard" so screen readers understand the button's purpose; ensure the
ariaLabel prop is changed on that IconButton element in
src/app/_components/common/navbar.tsx.

<Text>{view === "agency" ? `${agencyName ?? "[Agency name]"} Home` : ""}</Text>
</Group>

Expand Down
Loading