Skip to content

SANC-98-Fix home button - #71

Merged
promatty merged 1 commit into
mainfrom
SANC-98-Fix-Home-Button
Apr 2, 2026
Merged

SANC-98-Fix home button#71
promatty merged 1 commit into
mainfrom
SANC-98-Fix-Home-Button

Conversation

@JustinTan-1

@JustinTan-1 JustinTan-1 commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

The home button now redirects to the same page that is redirected to upon login.

Summary by CodeRabbit

  • New Features
    • The navbar home button is now interactive and redirects to the dashboard on click.

@vercel

vercel Bot commented Apr 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
salvationarmy Ready Ready Preview, Comment Apr 1, 2026 11:07pm

@coderabbitai

coderabbitai Bot commented Apr 1, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The navbar's home icon is enhanced to become an interactive control. It now calls a tRPC mutation endpoint (api.organization.redirectToDashboard) instead of remaining static, then navigates to the dashboard URL returned by the server.

Changes

Cohort / File(s) Summary
Home button interactivity
src/app/_components/common/navbar.tsx
Replaces static home icon with IconButton that triggers redirectToDashboard mutation and redirects using the returned URL.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • burtonjong
  • promatty
  • themaxboucher
  • Yemyam
  • wesleylui

Poem

🏠 A button once static, now springs to life,
Calling the server to end the strife,
Dashboard awaits with a smooth redirect,
The home icon's journey—now more direct! 🐰✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'SANC-98-Fix home button' directly relates to the main change: modifying the home button in the navbar to implement proper redirect functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch SANC-98-Fix-Home-Button

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/app/_components/common/navbar.tsx (1)

41-45: Consider adding error handling for the mutation.

If the API call fails (e.g., organization not found, network error), the user receives no feedback. Adding an onError callback with a toast notification would improve UX.

💡 Suggested improvement
+ import { notifications } from "@mantine/notifications";
+ // ... or use your project's toast/notification system

  const { mutate } = api.organization.redirectToDashboard.useMutation({
    onSuccess: (data) => {
      router.replace(data.redirectUrl);
    },
+   onError: (error) => {
+     notifications.show({
+       title: "Navigation failed",
+       message: error.message,
+       color: "red",
+     });
+   },
  });
🤖 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 41 - 45, The mutation
call using api.organization.redirectToDashboard.useMutation currently only
supplies onSuccess; add an onError handler to provide user feedback when the API
fails (e.g., network error or org not found). In the useMutation options for
api.organization.redirectToDashboard.useMutation, add an onError callback that
displays a toast/error notification (using your app's toast utility, e.g.,
toast.error or showToast) with a helpful message and include the error
message/details, and optionally log the error; keep the existing onSuccess
behavior and still call mutate(...) as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app/_components/common/navbar.tsx`:
- Around line 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.

---

Nitpick comments:
In `@src/app/_components/common/navbar.tsx`:
- Around line 41-45: The mutation call using
api.organization.redirectToDashboard.useMutation currently only supplies
onSuccess; add an onError handler to provide user feedback when the API fails
(e.g., network error or org not found). In the useMutation options for
api.organization.redirectToDashboard.useMutation, add an onError callback that
displays a toast/error notification (using your app's toast utility, e.g.,
toast.error or showToast) with a helpful message and include the error
message/details, and optionally log the error; keep the existing onSuccess
behavior and still call mutate(...) as before.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 62dbaf53-c184-4669-97b5-65f37f377dd4

📥 Commits

Reviewing files that changed from the base of the PR and between 52ed963 and dabec9c.

📒 Files selected for processing (1)
  • src/app/_components/common/navbar.tsx

Comment on lines +49 to +55
<IconButton
onClick={() => mutate()}
ariaLabel="Button"
icon={<Home />}
color="blue"
transparent={true}
></IconButton>

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.

@promatty promatty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@promatty
promatty merged commit a9f337f into main Apr 2, 2026
4 checks passed
@promatty
promatty deleted the SANC-98-Fix-Home-Button branch April 2, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants