-
Notifications
You must be signed in to change notification settings - Fork 962
feat(teams): add teams as first-class org primitive #4403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
354efe5
feat(teams): add teams as first-class org primitive
saddlepaddle 154599a
fix(teams): harden hooks against duplicate inserts
saddlepaddle 60721aa
revert: drop unneeded onConflictDoNothing on team_members inserts
saddlepaddle fb567ef
fix(teams): address PR feedback
saddlepaddle 66a8a91
fix(teams): catch thrown rejections on team CRUD authClient calls
saddlepaddle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,9 +10,9 @@ import { electronTrpc } from "renderer/lib/electron-trpc"; | |
| import { | ||
| type SettingsSection, | ||
| useSetSettingsSearchQuery, | ||
| useSettingsOriginRoute, | ||
| useSettingsSearchQuery, | ||
| } from "renderer/stores/settings-state"; | ||
| import { NavigationControls } from "../_dashboard/components/NavigationControls"; | ||
| import { SearchResultsBanner } from "./components/SearchResultsBanner"; | ||
| import { SettingsSidebar } from "./components/SettingsSidebar"; | ||
| import { | ||
|
|
@@ -35,6 +35,7 @@ const SECTION_ORDER: SettingsSection[] = [ | |
| "links", | ||
| "models", | ||
| "organization", | ||
| "teams", | ||
| "integrations", | ||
| "billing", | ||
| "apikeys", | ||
|
|
@@ -46,6 +47,7 @@ const SECTION_ORDER: SettingsSection[] = [ | |
| function getSectionFromPath(pathname: string): SettingsSection | null { | ||
| if (pathname.includes("/settings/account")) return "account"; | ||
| if (pathname.includes("/settings/organization")) return "organization"; | ||
| if (pathname.includes("/settings/teams")) return "teams"; | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
|
||
| if (pathname.includes("/settings/appearance")) return "appearance"; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| if (pathname.includes("/settings/ringtones")) return "ringtones"; | ||
| if (pathname.includes("/settings/keyboard")) return "keyboard"; | ||
|
|
@@ -68,6 +70,8 @@ function getPathFromSection(section: SettingsSection): string { | |
| return "/settings/account"; | ||
| case "organization": | ||
| return "/settings/organization"; | ||
| case "teams": | ||
| return "/settings/teams"; | ||
| case "appearance": | ||
| return "/settings/appearance"; | ||
| case "ringtones": | ||
|
|
@@ -102,7 +106,6 @@ function SettingsLayout() { | |
| const isMac = platform === undefined || platform === "darwin"; | ||
| const searchQuery = useSettingsSearchQuery(); | ||
| const setSearchQuery = useSetSettingsSearchQuery(); | ||
| const originRoute = useSettingsOriginRoute(); | ||
| const location = useLocation(); | ||
| const navigate = useNavigate(); | ||
| const normalizedSearchQuery = searchQuery.trim(); | ||
|
|
@@ -137,11 +140,17 @@ function SettingsLayout() { | |
| "escape", | ||
| (event) => { | ||
| if (document.querySelector('[data-state="open"]')) return; | ||
| const segments = location.pathname.split("/").filter(Boolean); | ||
| // Peel one segment, but only if we're deeper than a top-of-section | ||
| // route like /settings/teams. Esc at the top is a no-op so users don't | ||
| // get yanked out of settings unexpectedly. | ||
| if (segments.length <= 2) return; | ||
| event.preventDefault(); | ||
| navigate({ to: originRoute }); | ||
| const parent = `/${segments.slice(0, -1).join("/")}`; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Parent-path Escape navigation loops on Prompt for AI agents |
||
| navigate({ to: parent }); | ||
| }, | ||
| { enableOnFormTags: false, enableOnContentEditable: false }, | ||
| [navigate, originRoute], | ||
| [navigate, location.pathname], | ||
| ); | ||
|
|
||
| const usesInnerSidebar = | ||
|
|
@@ -152,11 +161,13 @@ function SettingsLayout() { | |
| return ( | ||
| <div className="flex flex-col h-screen w-screen bg-tertiary"> | ||
| <div | ||
| className="drag h-8 w-full bg-tertiary" | ||
| className="drag flex h-12 w-full items-center gap-1.5 bg-tertiary" | ||
| style={{ | ||
| paddingLeft: isMac ? "88px" : "16px", | ||
| paddingLeft: isMac ? "96px" : "8px", | ||
| }} | ||
| /> | ||
| > | ||
| <NavigationControls /> | ||
| </div> | ||
|
|
||
| <div className="flex flex-1 overflow-hidden"> | ||
| <SettingsSidebar /> | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Fix collection id to match the established naming pattern.
The
teamMemberscollection id usesteam-members-${organizationId}(with hyphen), but the pattern throughout this file is to preserve table name underscores in collection ids. For consistency with existing collections liketask_statuses,v2_hosts, andautomation_runs, the id should beteam_members-${organizationId}.♻️ Proposed fix
const teamMembers = createPersistedElectricCollection( electricCollectionOptions<SelectTeamMember>({ - id: `team-members-${organizationId}`, + id: `team_members-${organizationId}`, shapeOptions: { url: electricUrl, params: {📝 Committable suggestion
🤖 Prompt for AI Agents