Skip to content

refactor (desktop): avatar organization consolidation and move to top bar#758

Merged
AviPeltz merged 6 commits into
mainfrom
avatar-consolidate
Jan 15, 2026
Merged

refactor (desktop): avatar organization consolidation and move to top bar#758
AviPeltz merged 6 commits into
mainfrom
avatar-consolidate

Conversation

@AviPeltz
Copy link
Copy Markdown
Collaborator

@AviPeltz AviPeltz commented Jan 14, 2026

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

  • New Features

    • Added keyboard shortcuts reference and direct support contact options (Discord, X, Email Founders) to the organization dropdown menu.
  • Refactor

    • Consolidated the support menu into the organization dropdown, providing unified access to help and contact features.
    • Rebranded "Team" terminology to "Organization" throughout the application for consistency.
    • Updated related labels and empty state messages to reflect organizational language.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

The PR consolidates UI terminology from "Team" to "Organization" throughout the settings section, and refactors the top navigation bar by removing the separate SupportMenu component and integrating its functionality (keyboard shortcuts, report issues, contact options, organization switching) into an enhanced OrganizationDropdown component. Backend naming conventions are updated to reflect "Org" instead of "Workspace" in newly created organizations.

Changes

Cohort / File(s) Summary
Settings Terminology Updates
apps/desktop/src/renderer/routes/_authenticated/settings/components/SettingsSidebar/components/GeneralSettings/GeneralSettings.tsx, apps/desktop/src/renderer/routes/_authenticated/settings/team/components/MemberActions/MemberActions.tsx, apps/desktop/src/renderer/routes/_authenticated/settings/team/page.tsx
Text labels changed from "Team" to "Organization"; dialog title updated for member removal; empty state message simplified.
TopBar Navigation Consolidation
apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx
Removed isCollapsed prop (now no props). Enhanced with keyboard shortcut handlers, Contact Us submenu (Discord, X, Email), Report Issue option, and organization switching. Avatar display with organization/user name fallback. Styling and trigger button refined.
SupportMenu Removal
apps/desktop/src/renderer/screens/main/components/TopBar/SupportMenu.tsx
Entire component deleted; functionality merged into OrganizationDropdown.
TopBar Index
apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
SupportMenu import and usage replaced with OrganizationDropdown.
Sidebar Header Cleanup
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarHeader/WorkspaceSidebarHeader.tsx
OrganizationDropdown component and import removed from both collapsed and expanded header layouts.
Auth and Database Naming
packages/auth/src/server.ts, packages/db/drizzle/0006_add_better_auth_tables.sql
New organization naming convention: "[user]'s Org" (from "[user]'s Workspace") and slug suffix "-org" (from "-workspace").

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through dropdowns wide,
Where Team becomes Org with pride,
Support and settings take one seat,
As navigation grows so neat,
With Discord links and Discord cheer,
The organization menu's here! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete; it contains only the template structure with minimal information filled in. The Description, Related Issues, Testing, Screenshots, and Additional Notes sections are empty or use placeholder text. Fill in the Description section with details about the consolidation and top bar move, link any related issues, describe testing steps, and add relevant context or screenshots.
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 (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes: consolidating organization/avatar functionality and moving it to the top bar, as evidenced by the OrganizationDropdown changes and its relocation from the sidebar to TopBar.

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

✨ Finishing touches
  • 📝 Generate docstrings

🧹 Recent nitpick comments
apps/desktop/src/renderer/routes/_authenticated/settings/team/components/MemberActions/MemberActions.tsx (1)

62-70: Consider adding console error logging for debugging.

The error is appropriately shown to users via toast, but adding a console log with context would help with debugging in production.

Suggested improvement
 		} catch (error) {
+			console.error("[MemberActions/handleRemove] Failed:", error);
 			toast.error(
 				error instanceof Error
 					? error.message
 					: `Failed to ${isCurrentUser ? "leave" : "remove member from"} organization`,
 			);
 		} finally {
apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx (3)

54-63: Add error handling to async event handlers.

Both switchOrganization and handleSignOut are async functions used as event handlers but lack error handling. Unhandled promise rejections in event handlers won't surface properly and could leave the UI in an inconsistent state.

Suggested improvement
 const switchOrganization = async (newOrgId: string) => {
+  try {
     await authClient.organization.setActive({
       organizationId: newOrgId,
     });
+  } catch (error) {
+    console.error("[OrganizationDropdown/switchOrganization] Failed to switch organization:", error);
+  }
 };

 const handleSignOut = async () => {
+  try {
     await authClient.signOut();
     signOutMutation.mutate();
+  } catch (error) {
+    console.error("[OrganizationDropdown/handleSignOut] Sign out failed:", error);
+  }
 };

69-71: Simplify mailto link handling.

window.open with "_blank" is unconventional for mailto: URLs since they trigger the email client rather than opening a browser tab. This can cause inconsistent behavior across browsers.

Suggested fix
 const handleContactUs = () => {
-  window.open(COMPANY.MAIL_TO, "_blank");
+  window.location.href = COMPANY.MAIL_TO;
 };

161-191: Use onSelect instead of onClick for consistency and accessibility.

Several DropdownMenuItem components use onClick (lines 162, 166, 179, 183, 186) while others use onSelect (lines 111, 117, 140, 196). For Radix-based dropdown menus, onSelect is the canonical event handler that properly integrates with keyboard navigation and automatically closes the menu.

Suggested fix
 {/* Support section */}
-<DropdownMenuItem onClick={handleReportIssue}>
+<DropdownMenuItem onSelect={handleReportIssue}>
   <HiOutlineBugAnt className="h-4 w-4" />
   Report Issue
 </DropdownMenuItem>
-<DropdownMenuItem onClick={handleKeyboardShortcuts}>
+<DropdownMenuItem onSelect={handleKeyboardShortcuts}>
   <LuKeyboard className="h-4 w-4" />
   Keyboard Shortcuts
   {showShortcut && (
     <DropdownMenuShortcut>{shortcutsHotkey}</DropdownMenuShortcut>
   )}
 </DropdownMenuItem>
 <DropdownMenuSub>
   <DropdownMenuSubTrigger>
     <LuLifeBuoy className="h-4 w-4" />
     Contact Us
   </DropdownMenuSubTrigger>
   <DropdownMenuSubContent sideOffset={8} className="w-56">
-    <DropdownMenuItem onClick={handleJoinDiscord}>
+    <DropdownMenuItem onSelect={handleJoinDiscord}>
       <FaDiscord className="h-4 w-4" />
       Discord
     </DropdownMenuItem>
-    <DropdownMenuItem onClick={handleTwitter}>
-      <FaXTwitter className="h-4 w-4" />X
+    <DropdownMenuItem onSelect={handleTwitter}>
+      <FaXTwitter className="h-4 w-4" />
+      <span>X</span>
     </DropdownMenuItem>
-    <DropdownMenuItem onClick={handleContactUs}>
+    <DropdownMenuItem onSelect={handleContactUs}>
       <HiOutlineEnvelope className="h-4 w-4" />
       Email Founders
     </DropdownMenuItem>
   </DropdownMenuSubContent>
 </DropdownMenuSub>

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c5f0b67 and 766abc6.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • apps/desktop/src/renderer/routes/_authenticated/settings/components/SettingsSidebar/components/GeneralSettings/GeneralSettings.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/components/MemberActions/MemberActions.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/page.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/SupportMenu.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarHeader/WorkspaceSidebarHeader.tsx
  • packages/auth/src/server.ts
  • packages/db/drizzle/0006_add_better_auth_tables.sql
💤 Files with no reviewable changes (2)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarHeader/WorkspaceSidebarHeader.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/SupportMenu.tsx
🧰 Additional context used
📓 Path-based instructions (6)
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx}: For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc
Use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary.
For tRPC subscriptions with trpc-electron, ALWAYS use the observable pattern from @trpc/server/observable instead of async generators, as the library explicitly checks isObservable(result) and throws an error otherwise

Files:

  • apps/desktop/src/renderer/routes/_authenticated/settings/components/SettingsSidebar/components/GeneralSettings/GeneralSettings.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/page.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/components/MemberActions/MemberActions.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use object parameters for functions with 2+ parameters instead of positional arguments
Functions with 2+ parameters should accept a single params object with named properties for self-documentation and extensibility
Use prefixed console logging with context pattern: [domain/operation] message
Extract magic numbers and hardcoded values to named constants at module top
Use lookup objects/maps instead of repeated if (type === ...) conditionals
Avoid using any type - maintain type safety in TypeScript code
Never swallow errors silently - at minimum log them with context
Import from concrete files directly when possible - avoid barrel file abuse that creates circular dependencies
Avoid deep nesting (4+ levels) - use early returns, extract functions, and invert conditions
Use named properties in options objects instead of boolean parameters to avoid boolean blindness

Files:

  • apps/desktop/src/renderer/routes/_authenticated/settings/components/SettingsSidebar/components/GeneralSettings/GeneralSettings.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/page.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • packages/auth/src/server.ts
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/components/MemberActions/MemberActions.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never import Node.js modules (fs, path, os, net) in renderer process or shared code - they are externalized for browser compatibility

Files:

  • apps/desktop/src/renderer/routes/_authenticated/settings/components/SettingsSidebar/components/GeneralSettings/GeneralSettings.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/page.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/components/MemberActions/MemberActions.tsx
**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

One component per file - do not create multi-component files

Files:

  • apps/desktop/src/renderer/routes/_authenticated/settings/components/SettingsSidebar/components/GeneralSettings/GeneralSettings.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/page.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/components/MemberActions/MemberActions.tsx
apps/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Drizzle ORM for all database operations - never use raw SQL

Files:

  • apps/desktop/src/renderer/routes/_authenticated/settings/components/SettingsSidebar/components/GeneralSettings/GeneralSettings.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/page.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/components/MemberActions/MemberActions.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome for formatting and linting - run at root level with bun run lint:fix or biome check --write

Files:

  • apps/desktop/src/renderer/routes/_authenticated/settings/components/SettingsSidebar/components/GeneralSettings/GeneralSettings.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/page.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • packages/auth/src/server.ts
  • apps/desktop/src/renderer/routes/_authenticated/settings/team/components/MemberActions/MemberActions.tsx
🧠 Learnings (1)
📚 Learning: 2026-01-02T06:50:28.671Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-02T06:50:28.671Z
Learning: Applies to apps/*/src/components/{ui,ai-elements,react-flow}/*.tsx : Use kebab-case single files for shadcn/ui components (e.g., button.tsx, base-node.tsx) in src/components/ui/, src/components/ai-elements, and src/components/react-flow/

Applied to files:

  • apps/desktop/src/renderer/routes/_authenticated/settings/components/SettingsSidebar/components/GeneralSettings/GeneralSettings.tsx
🧬 Code graph analysis (2)
apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx (4)
apps/desktop/src/renderer/lib/electron-trpc.ts (1)
  • electronTrpc (9-11)
apps/desktop/src/renderer/stores/hotkeys/store.ts (1)
  • useHotkeyText (206-215)
packages/shared/src/constants.ts (1)
  • COMPANY (12-24)
packages/ui/src/components/ui/dropdown-menu.tsx (9)
  • DropdownMenu (249-249)
  • DropdownMenuTrigger (251-251)
  • DropdownMenuContent (252-252)
  • DropdownMenuItem (255-255)
  • DropdownMenuSeparator (259-259)
  • DropdownMenuShortcut (260-260)
  • DropdownMenuSub (261-261)
  • DropdownMenuSubTrigger (262-262)
  • DropdownMenuSubContent (263-263)
apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx (1)
apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx (1)
  • OrganizationDropdown (33-203)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Deploy Admin
  • GitHub Check: Deploy Docs
  • GitHub Check: Deploy Web
  • GitHub Check: Deploy API
  • GitHub Check: Deploy Marketing
  • GitHub Check: Build
🔇 Additional comments (11)
apps/desktop/src/renderer/routes/_authenticated/settings/team/components/MemberActions/MemberActions.tsx (1)

106-106: LGTM!

The text change from "Remove team member?" to "Remove member?" aligns with the PR's objective of consolidating terminology from "Team" to "Organization" across the settings UI.

packages/db/drizzle/0006_add_better_auth_tables.sql (1)

119-143: Backfill logic looks correct for the terminology change.

The rename from -workspace to -org is consistent between the org creation (line 124) and the subsequent member assignment JOIN (line 140).

Minor note: The triple-quoted apostrophe ('''s Org') handles SQL escaping correctly for possessive names, but if a user's name already contains an apostrophe (e.g., "O'Brien"), the resulting org name would be "O'Brien's Org" which parses correctly in this SQL context.

packages/auth/src/server.ts (1)

58-66: Naming convention aligns with migration backfill.

The org name (${user.name}'s Org) and slug pattern (${user.id.slice(0, 8)}-org) correctly match the SQL migration backfill logic, ensuring consistency between newly created users and migrated users.

apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx (2)

4-5: Good consolidation of user/org controls into a single dropdown.

The OrganizationDropdown now serves as a unified entry point for settings, organization management, support options, and sign out - cleaner than having separate menus.


35-36: LGTM.

The component swap from SupportMenu to OrganizationDropdown is straightforward.

apps/desktop/src/renderer/routes/_authenticated/settings/components/SettingsSidebar/components/GeneralSettings/GeneralSettings.tsx (1)

32-36: Label change is consistent with the PR's terminology shift.

The route path (/settings/team) remains unchanged while the display label updates to "Organization". This is pragmatic - route renaming would require more extensive changes. Consider renaming the route to /settings/organization in a future cleanup PR for full consistency.

apps/desktop/src/renderer/routes/_authenticated/settings/team/page.tsx (2)

68-71: Header and description now consistently use "Organization" terminology.

The update aligns the header with the existing description text ("Manage members in your organization").


97-99: Simplified empty state message reads well.

"No members yet" is clear in context and avoids the now-inconsistent "team" terminology.

apps/desktop/src/renderer/screens/main/components/TopBar/OrganizationDropdown.tsx (3)

88-107: LGTM!

The dropdown trigger is well-structured with proper aria-label for accessibility, appropriate visual styling with hover states, and good use of the no-drag class for Electron compatibility.


124-159: LGTM!

The organization switcher logic is sound—only rendering when multiple organizations exist, showing the active organization with a checkmark, and properly handling the async switch operation.


195-199: Good UX consideration.

The comment and implementation ensure users can always sign out regardless of state, preventing users from getting trapped in the app.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 14, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch
  • ✅ Electric Fly.io app

Thank you for your contribution! 🎉

Resolved conflict in OrganizationDropdown.tsx by:
- Using main's auth approach (authClient, electronTrpc)
- Keeping consolidated TopBar design with org name + chevron
- Preserving support menu items in the dropdown
@AviPeltz AviPeltz marked this pull request as ready for review January 15, 2026 00:01
@AviPeltz AviPeltz merged commit 7fe9d54 into main Jan 15, 2026
13 checks passed
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.

1 participant