Skip to content

Conversation

kushu30
Copy link

@kushu30 kushu30 commented Sep 30, 2025

Summary

Moved Sponsor/Help/Report Issue to the sidebar footer and left Logout in profile dropdown.

Changes

  • Removed Sponsor/Help/Report Issue from profile dropdown (components/layout/nav-user.tsx)
  • Added footer buttons in sidebar (components/layout/app-sidebar.tsx)

How to test

  • Manual: verify sidebar footer contains Sponsor, Help, Report Issue
  • If a preview deploy is available (Vercel/Netlify), open the deployment link from PR checks
  • CI will run lint/build/tests if workflows exist

Fixes #406

Summary by CodeRabbit

  • New Features

    • Added Sidebar footer actions: Sponsor, Help, and Report Issue.
    • One-click “Report Issue” opens a prefilled GitHub issue with device and environment details.
  • Refactor

    • Navigation is now consistently typed and permission-aware, improving reliability without changing visible routes.
    • Active navigation behavior remains unchanged; titles use translations where available.
  • UX Changes

    • User menu simplified to focus on Logout; Sponsor/Help/Report Issue moved to the Sidebar footer.

Copy link
Contributor

coderabbitai bot commented Sep 30, 2025

Walkthrough

Typed the sidebar’s data and permissions model, refactored nav filtering with useMemo, added footer actions (Sponsor, Help, Report Issue) with environment-aware issue URL. Removed sponsor/help/report from user menu. Simplified AppSidebar props by dropping toggleAddTeamModal. Updated selectors to typed AppState and constrained resources with a union type.

Changes

Cohort / File(s) Summary of Changes
Typed sidebar data, permissions, and footer actions
view/components/layout/app-sidebar.tsx
Added strict interfaces (User, Organization, AppState), Resource union, NavItem/NavSubItem; switched to typed data: { navMain }; refactored permission-filtering via useMemo reducer; added Sponsor/Help/Report Issue handlers with environment capture; removed toggleAddTeamModal from AppSidebar signature; updated selectors to AppState types; minor UI restructuring.
User menu cleanup
view/components/layout/nav-user.tsx
Removed sponsor/help/report options and related handlers/imports; retained logout flow; no public API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant SB as AppSidebar
  participant ST as Store (AppState)
  participant ACL as Permission Check
  participant UI as Sidebar UI

  U->>SB: Navigate / Render
  SB->>ST: Select user, orgs, activeOrg
  SB->>SB: useMemo reduce(data.navMain)
  loop For each NavItem
    SB->>ACL: hasAnyPermission(item.resource, subItems.resources)
    ACL-->>SB: allow/deny per item/sub-item
  end
  SB->>UI: Render filtered nav + footer actions
Loading
sequenceDiagram
  autonumber
  participant U as User
  participant SB as AppSidebar (Footer)
  participant ENV as Client Env
  participant GH as GitHub

  U->>SB: Click "Report Issue"
  SB->>ENV: Collect browser/OS/screen/lang/timezone/userAgent
  SB->>SB: Build prefilled issue URL
  SB->>GH: window.open(issue URL, _blank)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

In burrows of code where sidebars reside,
I twitch my ears—new buttons to guide.
Help, Sponsor, Report—now easy to see,
Hopped from the menu to nest by the tree.
Typed trails and guards keep paths in view,
Carrots for clarity—ship it anew! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The pull request introduces extensive TypeScript typing improvements, new navigation types, permission logic refactors, selector type updates, and data structure changes that go beyond the scope of simply moving the Report Issue action as specified in linked issue #406. These broader refactors and interface declarations are unrelated to the enhancement and risk obscuring the core intent of this change. The inclusion of selector and reducer modifications further deviates from the original UI-focused objective. Consider isolating the type and navigation refactor work into a separate pull request and limit this PR to the repositioning of Sponsor, Help, and Report Issue to maintain focus on the stated enhancement.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely describes the primary change of relocating the Sponsor, Help, and Report Issue actions to the sidebar footer and references the issue being fixed. It uses a conventional prefix and is specific to the UI update implemented. The phrasing avoids vague terms and directly conveys the intent of the pull request.
Linked Issues Check ✅ Passed The changes remove the Report Issue action from the profile dropdown and add it to a bottom-anchored footer in the sidebar, ensuring it remains visible by default as described in issue #406. This implementation aligns with the linked issue’s requirement to improve discoverability by relocating the action without cluttering primary navigation.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
view/components/layout/app-sidebar.tsx (1)

31-145: Stop redefining User/Organization locally.

The bespoke interfaces drop required fields like username and avatar. As a result user is now typed without those properties, so <NavUser user={user} /> fails type-checking (Property 'username' is missing…) and the build breaks. Please reuse the canonical types coming from the Redux layer instead of shadowing them here—e.g. import the real User/Organization (or at least the RootState) and let the selectors infer their proper shapes.

To unblock, delete the custom interfaces and change the selectors back to:

-const user = useAppSelector((state: AppState) => state.auth.user);
-const organizations = useAppSelector((state: AppState) => state.user.organizations);
-const activeOrg = useAppSelector((state: AppState) => state.user.activeOrganization);
+const user = useAppSelector((state) => state.auth.user);
+const organizations = useAppSelector((state) => state.user.organizations);
+const activeOrg = useAppSelector((state) => state.user.activeOrganization);

Then rely on the existing exported types for any further refinements.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57e3ff8 and 8d0a735.

📒 Files selected for processing (2)
  • view/components/layout/app-sidebar.tsx (5 hunks)
  • view/components/layout/nav-user.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
view/components/layout/app-sidebar.tsx (4)
view/lib/rbac.ts (2)
  • Resource (4-20)
  • useRBAC (26-58)
view/hooks/use-translation.ts (1)
  • useTranslation (6-62)
view/redux/hooks.ts (2)
  • useAppSelector (5-5)
  • useAppDispatch (4-4)
view/components/layout/nav-main.tsx (1)
  • NavMain (32-87)

Comment on lines +310 to +327
{t('user.menu.sponsor') || 'Sponsor'}
</button>

<button
type="button"
onClick={handleHelpClick}
className="w-full py-2 rounded-lg border"
>
{t('user.menu.help') || 'Help'}
</button>

<button
type="button"
onClick={handleReportIssueClick}
className="w-full py-2 rounded-lg border"
>
{t('user.menu.reportIssue') || 'Report Issue'}
</button>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix the translation fallback.

t() always returns a truthy string (the translated value or the key itself), so t('user.menu.sponsor') || 'Sponsor' never hits the fallback and you end up rendering the raw i18n key while translations load. Compare against the key explicitly and reuse the helper for all three buttons:

+  const translateOrFallback = React.useCallback(
+    (key: string, fallback: string) => {
+      const value = t(key);
+      return value === key ? fallback : value;
+    },
+    [t]
+  );
...
-              {t('user.menu.sponsor') || 'Sponsor'}
+              {translateOrFallback('user.menu.sponsor', 'Sponsor')}
...
-              {t('user.menu.help') || 'Help'}
+              {translateOrFallback('user.menu.help', 'Help')}
...
-              {t('user.menu.reportIssue') || 'Report Issue'}
+              {translateOrFallback('user.menu.reportIssue', 'Report Issue')}
📝 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
{t('user.menu.sponsor') || 'Sponsor'}
</button>
<button
type="button"
onClick={handleHelpClick}
className="w-full py-2 rounded-lg border"
>
{t('user.menu.help') || 'Help'}
</button>
<button
type="button"
onClick={handleReportIssueClick}
className="w-full py-2 rounded-lg border"
>
{t('user.menu.reportIssue') || 'Report Issue'}
</button>
// (Some lines earlier in your component…)
const { t } = useTranslation();
const translateOrFallback = React.useCallback(
(key: string, fallback: string) => {
const value = t(key);
return value === key ? fallback : value;
},
[t]
);
// …then in your JSX render:
<button
type="button"
onClick={handleSponsorClick}
className="w-full py-2 rounded-lg border"
>
{translateOrFallback('user.menu.sponsor', 'Sponsor')}
</button>
<button
type="button"
onClick={handleHelpClick}
className="w-full py-2 rounded-lg border"
>
{translateOrFallback('user.menu.help', 'Help')}
</button>
<button
type="button"
onClick={handleReportIssueClick}
className="w-full py-2 rounded-lg border"
>
{translateOrFallback('user.menu.reportIssue', 'Report Issue')}
</button>
🤖 Prompt for AI Agents
In view/components/layout/app-sidebar.tsx around lines 310 to 327, the code uses
t('user.menu.sponsor') || 'Sponsor' (and similar for Help and Report Issue) but
t() always returns a string so the fallback never runs; update the JSX to use a
reuseable check that compares the returned value to the key (e.g. if t(key) ===
key then use the human fallback) and apply that helper for all three buttons
(Sponsor, Help, Report Issue) so the readable fallback text is rendered while
translations are loading.

@raghavyuva
Copy link
Owner

@kushu30 can you also attach a video recording for reference?, thanks!

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.

enhancement: Move Report Issue to sidebar (bottom)

2 participants