Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(settings): add a team settings group with a Members page (#8355)
Jacob Beckerman7c6021a2090d
diff --git a/apps/web/src/features/settings/MobileSettings.tsx b/apps/web/src/features/settings/MobileSettings.tsxindex ad3f7ee660..d81ad321e6 100644--- a/apps/web/src/features/settings/MobileSettings.tsx+++ b/apps/web/src/features/settings/MobileSettings.tsx@@ -10,11 +10,13 @@ import { Show, Suspense } from 'solid-js';import { useMobileSettings } from './context/mobile-settings';import { MobileSettingsSheet } from './MobileSettingsSheet';import { SettingsTabContent } from './SettingsTabContent';+import { useTeamSettingsGroups } from './teamSettingsGroups';export function MobileSettings() {const settings = useMobileSettings();const signatures = useFeatureFlag(enableEmailSignatures);const { groups, searchGroups } = useSettingsTabs();+ const navGroups = useTeamSettingsGroups(groups);const userId = useUserId();const email = useEmail();const name = useOwnUserName();@@ -32,7 +34,7 @@ export function MobileSettings() {<MobileSettingsSheetopen={settings.open()}page={settings.page()}- groups={groups()}+ groups={navGroups()}searchGroups={searchGroups()}emailSignatures={signatures().enabled}name={displayName()}diff --git a/apps/web/src/features/settings/Settings.tsx b/apps/web/src/features/settings/Settings.tsxindex 2caae11f9b..6b40b78f56 100644--- a/apps/web/src/features/settings/Settings.tsx+++ b/apps/web/src/features/settings/Settings.tsx@@ -39,6 +39,7 @@ import {} from './core/settings-search';import { SettingsTabContent } from './SettingsTabContent';import { TeamSidebarAction } from './TeamSidebarAction';+import { useTeamSettingsGroups } from './teamSettingsGroups';export function SettingsPanelComponentWrapper() {const params = useParams<{ tab?: string }>();@@ -84,7 +85,11 @@ type SettingsPanelProps = {export function SettingsPanel(props: SettingsPanelProps) {const { closeSettings, activeTabId, selectTab } = useSettingsState();const splitNavigate = useSplitNavigate();- const { groups, searchGroups, flatTabs } = useSettingsTabs();+ const { groups, searchGroups } = useSettingsTabs();+ const navGroups = useTeamSettingsGroups(groups);+ // Hotkeys and touch pills follow the visible nav, which hides team pages+ // from people without a team.+ const navTabs = createMemo(() => navGroups().flatMap((group) => group.items));const signatures = useFeatureFlag(enableEmailSignatures);const activeNavigationTab = activeTabId;@@ -142,7 +147,7 @@ export function SettingsPanel(props: SettingsPanelProps) {// Helper to navigate to a tab by indexfunction navigateToTabIndex(index: number): boolean {- const tabs = flatTabs();+ const tabs = navTabs();if (index >= 0 && index < tabs.length) {const tab = tabs[index];if (tab) {@@ -169,14 +174,14 @@ export function SettingsPanel(props: SettingsPanelProps) {}const handleTabChange = (value: string) => {- if (flatTabs().some((tab) => tab.tab === value)) {+ if (navTabs().some((tab) => tab.tab === value)) {selectRoutedTab(value as SettingsTab);}};// Tab list for the touch pill strip.const tabItems = () =>- flatTabs().map((tab) => ({ value: tab.tab, label: tab.label }));+ navTabs().map((tab) => ({ value: tab.tab, label: tab.label }));const content = () => (<Show when={activeTabId()}>@@ -241,7 +246,7 @@ export function SettingsPanel(props: SettingsPanelProps) {><ViewShell.Aside><SettingsSidebar- groups={groups()}+ groups={navGroups()}results={searchResults()}selectedResultId={searchSelection()?.tab === activeTabId()diff --git a/apps/web/src/features/settings/SettingsTabContent.tsx b/apps/web/src/features/settings/SettingsTabContent.tsxindex 2bd139267e..2525211485 100644--- a/apps/web/src/features/settings/SettingsTabContent.tsx+++ b/apps/web/src/features/settings/SettingsTabContent.tsx@@ -20,7 +20,10 @@ import { MobileApp } from './MobileApp';import { Notifications } from './Notifications';import { Shortcuts } from './Shortcuts';import { Tags } from './Tags';-import { Team } from './Team';+import { TeamPage } from './Team';+import { TeamConnections } from './TeamConnections';+import { TeamGeneral } from './TeamGeneral';+import { TeamMembers } from './TeamMembers';/** Shared forms for desktop panels and mobile sheet detail pages. */export function SettingsTabContent(props: { tab: SettingsTab }) {@@ -63,7 +66,13 @@ export function SettingsTabContent(props: { tab: SettingsTab }) {<Shortcuts /></Show><Show when={isCurrentTab('Team')}>- <Team />+ <TeamPage>{(team) => <TeamGeneral team={team} />}</TeamPage>+ </Show>+ <Show when={isCurrentTab('Team Members')}>+ <TeamPage>{(team) => <TeamMembers team={team} />}</TeamPage>+ </Show>+ <Show when={isCurrentTab('Team Connections')}>+ <TeamPage>{(team) => <TeamConnections team={team} />}</TeamPage></Show><Show when={isCurrentTab('Tags')}><Tags />diff --git a/apps/web/src/features/settings/Team.tsx b/apps/web/src/features/settings/Team.tsxindex 8fa0fbcd92..233214a068 100644--- a/apps/web/src/features/settings/Team.tsx+++ b/apps/web/src/features/settings/Team.tsx@@ -1,181 +1,39 @@-import { SlackImport } from '@app/features/slack-import/slack-import';-import { useFeatureFlag } from '@app/lib/analytics/posthog';-import { toast } from '@core/component/Toast/Toast';-import {- getLinkShareScope,- LINK_SHARE_SCOPE_OPTIONS,- type LinkShareScope,- NO_LINK_SHARE,-} from '@core/component/TopBar/linkShare';-import { UserIcon } from '@core/component/UserIcon';-import { enableAiUsageBilling } from '@core/constant/featureFlags';-import { useSettingsState } from '@core/constant/SettingsState';-import { SERVER_HOSTS } from '@core/constant/servers';import { useUserId } from '@core/context/user';-import { getDisplayName, macroIdToEmail, tryMacroId } from '@core/user';-import { debouncedDependent } from '@core/util/debounce';-import { fuzzyFilter } from '@core/util/fuzzy';-import { getWebOrigin } from '@core/util/webOrigin';-import { formatRelativeTimestamp } from '@entity';-import GithubIcon from '@icon/mcp-github.svg';-import type { CollectionNode } from '@kobalte/core';-import { Select } from '@kobalte/core/select';-import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';-import CaretDownIcon from '@phosphor/caret-down.svg';-import CheckIcon from '@phosphor/check.svg';-import CopyIcon from '@phosphor/copy.svg';+import { getDisplayName, tryMacroId } from '@core/user';import EnvelopeIcon from '@phosphor/envelope.svg';-import LinkIcon from '@phosphor/link.svg';-import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';import PlusIcon from '@phosphor/plus.svg';import SpinnerIcon from '@phosphor/spinner.svg';-import TrashIcon from '@phosphor/trash.svg';import UsersIcon from '@phosphor/users.svg';import XIcon from '@phosphor/x.svg';-import {- useAiBillingSummaryQuery,- useGithubLinkStatusQuery,-} from '@queries/auth';import {useJoinTeamMutation,useRejectInvitationMutation,useUserInvitesQuery,} from '@queries/team/invitations';-import {- useDeleteTeamInviteMutation,- useInviteToTeamMutation,- useTeamInvitesQuery,-} from '@queries/team/invites';-import {- useRemoveUserFromTeamMutation,- useSetTeamMemberPlanMutation,-} from '@queries/team/members';+import { useInviteToTeamMutation } from '@queries/team/invites';import {useCreateTeamWithInvitesMutation,- useDeleteTeamMutation,- usePatchTeamMutation,useTeamQuery,- useToggleAutoJoinDomainMutation,- useToggleNonAdminInvitesMutation,useUserTeamsQuery,} from '@queries/team/teams';-import type { PaidPlan } from '@service-auth/ai-billing-types';+import type { Team as TeamSummary } from '@service-auth/generated/schemas/team';import type { TeamInviteDetails } from '@service-auth/generated/schemas/teamInviteDetails';-import type { TeamMember } from '@service-auth/generated/schemas/teamMember';-import { TeamRole } from '@service-auth/generated/schemas/teamRole';-import {- Button,- ConfirmDialog,- cn,- Dialog,- Panel,- SegmentedControl,- ToggleSwitch,- Tooltip,-} from '@ui';+import { Button, cn, Dialog, Panel, Tooltip } from '@ui';import {+ type Accessor,createMemo,createSignal,For,Index,+ type JSX,Match,- mapArray,- onCleanup,Show,Suspense,Switch,} from 'solid-js';import { z } from 'zod';-import { TeamSeatPlanSelect } from './components/team-seat-plan-select';-import { ConnectAction } from './integration-ui';-import {- IntegrationRow,- SettingsCard,- SettingsPage,- SettingsRow,- SettingsSection,-} from './primitives';-import {- canInviteToTeam,- canRemoveTeamMember,- isTeamAdminOrOwner,-} from './teamMemberPermissions';-import {- buildTeamTaskAutolinkTargetUrl,- getTeamSlugError,- normalizeTeamSlugInput,-} from './teamSlug';--const roleOrder: Record<string, number> = {- [TeamRole.owner]: 0,- [TeamRole.admin]: 1,- [TeamRole.member]: 2,-};--type RoleOption = { value: TeamRole; label: string };--const roleOptions: RoleOption[] = [- { value: TeamRole.member, label: 'Member' },- { value: TeamRole.admin, label: 'Admin' },-];--function RoleSelect(props: {- value: TeamRole;- onChange: (role: TeamRole) => void;- disabled?: boolean;-}) {- const selectedOption = () =>- roleOptions.find((o) => o.value === props.value) ?? roleOptions[0];-- return (- <Select<RoleOption>- options={roleOptions}- value={selectedOption()}- onChange={(opt) => opt && props.onChange(opt.value)}- optionValue="value"- optionTextValue="label"- gutter={4}- placement="bottom-end"- disabled={props.disabled}- itemComponent={(itemProps: { item: CollectionNode<RoleOption> }) => (- <Select.Item- item={itemProps.item}- class="flex items-center justify-between gap-2 px-2 py-1.5 text-sm rounded-xs hover:bg-hover outline-none data-highlighted:bg-hover"- >- <Select.ItemLabel>{itemProps.item.rawValue.label}</Select.ItemLabel>- <Select.ItemIndicator>- <CheckIcon class="size-3" />- </Select.ItemIndicator>- </Select.Item>- )}- >- <Select.Trigger- as={Button}- class="rounded-xs px-1 py-0.5 text-xs -ml-1 data-expanded:bg-ink/10"- disabled={props.disabled}- >- <Select.Value<RoleOption>>- {(state) => state.selectedOption().label}- </Select.Value>- <CaretDownIcon class="size-3 text-ink-muted shrink-0" />- </Select.Trigger>- <Select.Portal>- <Select.Content class="menu-surface z-action-menu min-w-25 p-1">- <Select.Listbox />- </Select.Content>- </Select.Portal>- </Select>- );-}--/**- * The plan a member's seat is billed at. Until the generated `TeamMember`- * schema carries `plan`, read it defensively; every seat starts on Pro.- */-function memberPlan(member: TeamMember): PaidPlan {- const plan = (member as TeamMember & { plan?: PaidPlan }).plan;- return plan === 'max' ? 'max' : 'premium';-}+import { SettingsCard, SettingsPage, SettingsSection } from './primitives';+import { isTeamAdminOrOwner } from './teamMemberPermissions';const emailSchema = z.string().email();@@ -337,185 +195,6 @@ function InviteEmailsInput(props: {);}-function MemberRow(props: {- member: TeamMember;- isOwner: boolean;- isCurrentUser: boolean;- canManageRemovals: boolean;- canRemove: boolean;- /** Whether seat plans apply (paid team) and the viewer may change them. */- showPlan: boolean;- canEditPlan: boolean;- planPending: boolean;- pendingDowngrade: boolean;- onRemove: () => void;- onRoleChange: (role: TeamRole) => void;- onPlanChange: (plan: PaidPlan) => void;-}) {- const aiUsageBilling = useFeatureFlag(enableAiUsageBilling);- const displayName = () => getDisplayName(tryMacroId(props.member.user_id));- const isMemberOwner = () => props.member.role === TeamRole.owner;- const email = () => {- const id = tryMacroId(props.member.user_id);- return id ? macroIdToEmail(id) : undefined;- };- const showEmail = () => {- const e = email();- return e && e !== displayName();- };-- return (- <div class="flex items-center justify-between gap-2 px-4 py-4">- <div class="flex items-center gap-3 min-w-0 flex-1">- <div class="shrink-0">- <UserIcon id={props.member.user_id} isDeleted={false} size="lg" />- </div>- <div class="min-w-0 flex-1">- <div class="text-sm font-medium text-ink truncate">- {displayName()}- {props.isCurrentUser && (- <span class="text-ink-muted font-normal"> (you)</span>- )}- </div>- <Show when={showEmail()}>- <div class="text-xs text-ink-muted truncate">{email()}</div>- </Show>- </div>- </div>- <div class="flex items-center gap-2 shrink-0">- <Show when={props.showPlan}>- <Show- when={props.canEditPlan}- fallback={- <span class="text-xs text-ink-muted capitalize">- {memberPlan(props.member)}- </span>- }- >- <TeamSeatPlanSelect- value={memberPlan(props.member)}- onChange={props.onPlanChange}- disabled={props.planPending}- aiUsageBilling={aiUsageBilling().enabled}- pendingDowngrade={props.pendingDowngrade}- />- </Show>- </Show>- <Show- when={props.isOwner && !isMemberOwner()}- fallback={- <span class="text-xs text-ink-muted capitalize">- {props.member.role}- </span>- }- >- <RoleSelect value={props.member.role} onChange={props.onRoleChange} />- </Show>- <Show when={props.canManageRemovals}>- <Show- when={props.canRemove}- fallback={- <Tooltip- label={- isMemberOwner()- ? 'Cannot remove team owner'- : 'Cannot remove yourself'- }- >- <Button- variant="ghost"- size="sm"- disabled- class="opacity-50 cursor-not-allowed"- >- <TrashIcon class="size-4" />- </Button>- </Tooltip>- }- >- <Tooltip label="Remove member">- <Button variant="ghost" size="sm" onClick={props.onRemove}>- <TrashIcon class="size-4" />- </Button>- </Tooltip>- </Show>- </Show>- </div>- </div>- );-}--function MemberName(props: { memberId: string }) {- const displayName = () => getDisplayName(tryMacroId(props.memberId));- return <span class="font-medium">{displayName()}</span>;-}--function InviteRow(props: {- invite: TeamInviteDetails;- canChange: boolean;- onCancel: () => void;-}) {- const [copied, setCopied] = createSignal(false);- let copyResetTimeout: ReturnType<typeof setTimeout> | undefined;- onCleanup(() => clearTimeout(copyResetTimeout));- const handleCopyLink = async () => {- try {- await navigator.clipboard.writeText(- `${getWebOrigin()}/app/team-invite?id=${props.invite.id}`- );- } catch (err) {- console.error('Failed to copy to clipboard', err);- return;- }- setCopied(true);- clearTimeout(copyResetTimeout);- copyResetTimeout = setTimeout(() => setCopied(false), 2000);- };-- return (- <div class="flex items-center justify-between gap-2 px-4 py-4">- <div class="flex items-center gap-3 min-w-0 flex-1">- <div class="size-8 rounded-full bg-accent/10 flex items-center justify-center shrink-0">- <EnvelopeIcon class="size-4 text-accent" />- </div>- <div class="min-w-0 flex-1">- <div class="text-sm text-ink truncate">{props.invite.email}</div>- <div class="text-xs text-ink-muted">- Invited as {props.invite.team_role} ·{' '}- {formatRelativeTimestamp(props.invite.created_at, {- condensed: true,- })}- </div>- </div>- </div>- <Show when={props.canChange}>- <Tooltip label={copied() ? 'Copied' : 'Copy invite link'}>- <Button- variant="ghost"- size="sm"- class="shrink-0"- onClick={handleCopyLink}- >- <Show when={copied()} fallback={<LinkIcon class="size-4" />}>- <CheckIcon class="size-4" />- </Show>- </Button>- </Tooltip>- <Tooltip label="Cancel invite">- <Button- variant="ghost"- size="sm"- class="shrink-0"- onClick={props.onCancel}- >- <XIcon class="size-4" />- </Button>- </Tooltip>- </Show>- </div>- );-}-function InviterName(props: { inviterId: string }) {const displayName = () => getDisplayName(tryMacroId(props.inviterId));return <span class="font-medium">{displayName()}</span>;@@ -614,7 +293,7 @@ function TeamInvites() {const TEAM_NAME_MAX_LENGTH = 50;-const teamNameSchema = z+export const teamNameSchema = z.string().transform((s) => s.trim()).pipe(@@ -899,182 +578,11 @@ function EmptyTeamState() {);}-/** Shared styling for the editable Name/Slug fields in the team-details card.- * Narrows on mobile so the field + Save/Cancel cluster fits a phone width. */-/** Width for the editable Name/Slug fields; pairs with the shared `settings-input`- * utility. Narrows on mobile so the field + Save/Cancel cluster fits a phone. */-const TEAM_FIELD_CLASS = 'settings-input w-56 mobile:w-32';--/** Disabled field shown to non-owners, with a tooltip explaining why it's locked.- * The muted look comes from `settings-input`'s `:disabled` styling. */-function ReadOnlyField(props: { value: string; tooltip: string }) {- return (- <Tooltip label={props.tooltip} placement="top">- <input- type="text"- value={props.value}- disabled- class={TEAM_FIELD_CLASS}- />- </Tooltip>- );-}--/** The Save / Cancel cluster shown while an inline field has unsaved changes. */-function SaveCancelButtons(props: {- onSave: () => void;- onCancel: () => void;- saveDisabled?: boolean;- pending?: boolean;-}) {- return (- <div class="flex items-center gap-1 shrink-0">- <Tooltip label="Save">- <Button- variant="accent"- size="icon-sm"- disabled={props.saveDisabled}- onClick={props.onSave}- >- <Show when={props.pending} fallback={<CheckIcon class="size-4" />}>- <SpinnerIcon class="size-4 animate-spin" />- </Show>- </Button>- </Tooltip>- <Tooltip label="Cancel">- <Button- variant="ghost"- size="icon-sm"- disabled={props.pending}- onClick={props.onCancel}- >- <XIcon class="size-4" />- </Button>- </Tooltip>- </div>- );-}--function TeamManagement(props: {- teamId: string;- teamName: string;- teamSlug: string;- ownerId: string;-}) {+/** The viewer's standing on a team, shared by the team settings pages. */+export function useTeamViewer(team: Accessor<TeamSummary>) {const userId = useUserId();-- const teamQuery = useTeamQuery(() => props.teamId);- const invitesQuery = useTeamInvitesQuery(() => props.teamId);- const githubLink = useGithubLinkStatusQuery();- const { openSettings } = useSettingsState();-- const deleteInviteMutation = useDeleteTeamInviteMutation();- const removeUserMutation = useRemoveUserFromTeamMutation();- const patchTeamMutation = usePatchTeamMutation();- const deleteTeamMutation = useDeleteTeamMutation();- const toggleAutoJoinMutation = useToggleAutoJoinDomainMutation();- const toggleNonAdminInvitesMutation = useToggleNonAdminInvitesMutation();-- const [showDeleteTeamModal, setShowDeleteTeamModal] = createSignal(false);- const [deleteConfirmation, setDeleteConfirmation] = createSignal('');- const [showRemoveModal, setShowRemoveModal] = createSignal<TeamMember | null>(- null- );- const [showCancelInviteModal, setShowCancelInviteModal] =- createSignal<TeamInviteDetails | null>(null);- const [showInviteModal, setShowInviteModal] = createSignal(false);- const [editingTeamName, setEditingTeamName] = createSignal<- string | undefined- >(undefined);- const [editingTeamSlug, setEditingTeamSlug] = createSignal<- string | undefined- >(undefined);- const [teamSlugError, setTeamSlugError] = createSignal<string | undefined>(- undefined- );-- const deleteConfirmationPhrase = () => `Delete ${props.teamName}`;- const canDeleteTeam = () =>- deleteConfirmation() === deleteConfirmationPhrase();-- const teamNameValue = () => editingTeamName() ?? props.teamName;- const hasTeamNameChanged = () => {- const editing = editingTeamName();- return editing !== undefined && editing.trim() !== props.teamName;- };-- const teamSlugValue = () => editingTeamSlug() ?? props.teamSlug;- const hasTeamSlugInputChanged = () => {- const editing = editingTeamSlug();- return editing !== undefined && editing !== props.teamSlug;- };- const hasTeamSlugChanged = () => {- const editing = editingTeamSlug();- return (- editing !== undefined &&- normalizeTeamSlugInput(editing) !== props.teamSlug- );- };- const normalizedTeamSlugPreview = () => {- const editing = editingTeamSlug();- if (editing === undefined || !hasTeamSlugChanged()) return undefined;- if (getTeamSlugError(editing)) return undefined;-- const normalized = normalizeTeamSlugInput(editing);- return normalized === editing ? undefined : normalized;- };- const canSaveTeamSlug = () => {- const editing = editingTeamSlug();- return (- editing !== undefined &&- hasTeamSlugChanged() &&- !patchTeamMutation.isPending &&- getTeamSlugError(editing) === undefined- );- };-- const members = createMemo(() => {- const unsorted = teamQuery.data?.members ?? [];- return [...unsorted].sort((a, b) => {- const roleCompare = (roleOrder[a.role] ?? 3) - (roleOrder[b.role] ?? 3);- if (roleCompare !== 0) return roleCompare;- return a.user_id.localeCompare(b.user_id);- });- });-- const [memberQuery, setMemberQuery] = createSignal('');- // The input stays live (`memberQuery`); filtering reads this debounced view so- // a burst of typing collapses to one O(n) scan instead of one per keystroke.- const debouncedMemberQuery = debouncedDependent(memberQuery, 120);-- // Resolve each member's display name reactively. `mapArray` keeps one stable- // name lookup per member (not recreated on every keystroke / re-render), and- // disposes it when the member leaves the list.- const memberSearchIndex = mapArray(members, (member) => {- const macroId = tryMacroId(member.user_id);- const displayName = () => getDisplayName(macroId);- const email = macroId ? macroIdToEmail(macroId) : '';- // Memoized so the lowercased search string is built once (and only rebuilt- // when the name resolves), not re-allocated for every member on each scan.- const haystack = createMemo(() =>- `${displayName()} ${email}`.toLowerCase()- );- return { member, haystack };- });-- // Only worth showing the filter once the list is long enough to scan.- const showMemberSearch = () => members().length > 5;-- const filteredMembers = createMemo(() => {- const q = debouncedMemberQuery().trim().toLowerCase();- if (!q) return members();- // Shared uFuzzy-backed filter (ranks by relevance, favoring contiguity).- return fuzzyFilter(q, memberSearchIndex(), (entry) => entry.haystack()).map(- (entry) => entry.member- );- });-- const currentUserRole = createMemo(() => {+ const teamQuery = useTeamQuery(() => team().id);+ const role = createMemo(() => {const currentUserId = userId();if (!currentUserId) return undefined;@@ -1082,686 +590,19 @@ function TeamManagement(props: {(member) => member.user_id === currentUserId)?.role;});- const isAdminOrOwner = () => isTeamAdminOrOwner(currentUserRole());- const canManageMemberRemovals = () => isAdminOrOwner();- // Seat plans only exist on teams billed per seat: enterprise teams, and- // paying teams, whose shared credits and overage are billed to the owner.- // The team API does not expose its subscription, so a paying team is- // recognised from the viewer's billing position: a paid tier whose payer is- // the team owner and whose seat count spans more than one member (a free-team- // owner with a personal subscription is billed for exactly one seat). A- // paying team of one therefore shows no seat menu; its owner moves their own- // seat from Billing.- const billingSummary = useAiBillingSummaryQuery();- const showSeatPlans = () => {- const team = teamQuery.data?.team;- if (!team) return false;- if (team.enterprise) return true;- return (- billingSummary.isSuccess &&- billingSummary.data.tier !== 'free' &&- billingSummary.data.payer === team.owner_id &&- billingSummary.data.seats > 1- );- };- const setMemberPlanMutation = useSetTeamMemberPlanMutation();- // Seat moves read and rewrite the subscription's item quantities, so only- // one may be in flight per team: every plan menu waits while one runs.- const planMovePending = () => setMemberPlanMutation.isPending;- const isOwner = createMemo(() => {- const currentUserId = userId();- if (!currentUserId) return false;- return props.ownerId === currentUserId;- });-- // The team's auto-join domain doubles as the toggle state: a string means- // auto-join is on for that domain, null/undefined means it's off.- const autoJoinDomain = () => teamQuery.data?.team.auto_join_domain ?? null;- const autoJoinDescription = () => {- const domain = autoJoinDomain();- return domain- ? `New sign-ups with an @${domain} email automatically join this team.`- : "Automatically add new sign-ups whose email matches the team owner's domain.";- };-- const handleToggleAutoJoin = () => {- if (!props.teamId || toggleAutoJoinMutation.isPending) return;- toggleAutoJoinMutation.mutate({ teamId: props.teamId });- };-- // Whether non-admin members may invite. Teams default to true; only the- // backend response flips it, so missing data reads as the default.- const allowNonAdminInvites = () =>- teamQuery.data?.team.allow_non_admin_invites ?? true;-- const handleToggleNonAdminInvites = () => {- if (!props.teamId || toggleNonAdminInvitesMutation.isPending) return;- toggleNonAdminInvitesMutation.mutate({ teamId: props.teamId });- };-- // The team-wide default link-share scope for newly shared items. NONE- // (stored as null) means link sharing starts off.- const defaultLinkShare = () =>- getLinkShareScope(teamQuery.data?.team.default_link_share);-- const handleChangeDefaultLinkShare = (scope: LinkShareScope) => {- if (!props.teamId || patchTeamMutation.isPending) return;- if (scope === defaultLinkShare()) return;- patchTeamMutation.mutate({- teamId: props.teamId,- request: { default_link_share: scope === NO_LINK_SHARE ? null : scope },- });- };-- const handleSaveTeamName = () => {- const newName = editingTeamName()?.trim();- if (!props.teamId || !newName) return;-- // Validate against the same schema as the create flow (e.g. max length)- // so rename can't push a name the create path would reject.- const parsed = teamNameSchema.safeParse(newName);- if (!parsed.success) return;-- patchTeamMutation.mutate(- { teamId: props.teamId, request: { name: parsed.data } },- { onSuccess: () => setEditingTeamName(undefined) }- );- };-- const handleCancelTeamNameEdit = () => {- setEditingTeamName(undefined);- };-- const validateTeamSlug = (slug: string) => {- const error = getTeamSlugError(slug);- setTeamSlugError(error);- return error === undefined;- };-- const handleTeamSlugChange = (slug: string) => {- setEditingTeamSlug(slug);- validateTeamSlug(slug);- };-- const handleSaveTeamSlug = () => {- const editedSlug = editingTeamSlug();- if (!props.teamId || editedSlug === undefined) return;- if (!validateTeamSlug(editedSlug) || !hasTeamSlugChanged()) return;-- // Persist the normalized slug so the saved value matches the "Will save as"- // preview (and the backend's UPPERCASE_UNDERSCORE format).- patchTeamMutation.mutate(- {- teamId: props.teamId,- request: { slug: normalizeTeamSlugInput(editedSlug) },- },- {- onSuccess: () => {- setEditingTeamSlug(undefined);- setTeamSlugError(undefined);- },- }- );- };-- const handleCancelTeamSlugEdit = () => {- setEditingTeamSlug(undefined);- setTeamSlugError(undefined);- };-- const handleCopyGithubAutolinkUrl = async () => {- const targetUrl = buildTeamTaskAutolinkTargetUrl(- props.teamSlug,- getWebOrigin()- );- try {- await navigator.clipboard.writeText(targetUrl);- toast.success('GitHub autolink URL copied');- } catch (error) {- console.error('Failed to copy GitHub autolink URL', error);- toast.failure('Failed to copy GitHub autolink URL');- }- };-- const handleDeleteTeam = () => {- if (!props.teamId) return;-- deleteTeamMutation.mutate(- { teamId: props.teamId },- {- onSuccess: () => {- setDeleteConfirmation('');- setShowDeleteTeamModal(false);- },- }- );+ return {+ teamQuery,+ role,+ isOwner: () => !!userId() && team().owner_id === userId(),+ isAdminOrOwner: () => isTeamAdminOrOwner(role()),+ // Teams default to letting members invite; only the backend response+ // flips it, so missing data reads as the default.+ allowNonAdminInvites: () =>+ teamQuery.data?.team.allow_non_admin_invites ?? true,};-- const handleDeleteTeamModalClose = (open: boolean) => {- if (!open) {- setDeleteConfirmation('');- setShowDeleteTeamModal(false);- }- };-- const handleRemoveMember = () => {- const member = showRemoveModal();- if (!props.teamId || !member) return;-- removeUserMutation.mutate(- { teamId: props.teamId, userId: member.user_id },- { onSuccess: () => setShowRemoveModal(null) }- );- };-- const handleCancelInvite = () => {- const invite = showCancelInviteModal();- if (!props.teamId || !invite) return;-- deleteInviteMutation.mutate(- { teamId: props.teamId, teamInviteId: invite.id },- { onSuccess: () => setShowCancelInviteModal(null) }- );- };-- return (- <>- <SettingsPage- title="Team"- actions={- <Show when={isOwner()}>- <Button- variant="danger"- size="sm"- onClick={() => setShowDeleteTeamModal(true)}- >- <TrashIcon class="size-4" />- Delete Team- </Button>- </Show>- }- >- <SettingsSection title="General">- <SettingsCard>- <SettingsRow- label="Name"- description="What your team is called — shown in invitations and billing."- hideDescriptionOnMobile- >- <Show- when={isOwner()}- fallback={- <ReadOnlyField- value={props.teamName}- tooltip="Only the team owner can change the team name."- />- }- >- <div class="flex items-center gap-2">- <input- type="text"- value={teamNameValue()}- onInput={(e) => setEditingTeamName(e.currentTarget.value)}- onKeyDown={(e) => {- if (e.key === 'Enter') {- if (hasTeamNameChanged() && editingTeamName()?.trim()) {- handleSaveTeamName();- }- } else if (e.key === 'Escape') {- handleCancelTeamNameEdit();- e.currentTarget.blur();- }- }}- placeholder="Enter team name"- class={TEAM_FIELD_CLASS}- />- <Show when={hasTeamNameChanged()}>- <SaveCancelButtons- onSave={handleSaveTeamName}- onCancel={handleCancelTeamNameEdit}- saveDisabled={- patchTeamMutation.isPending ||- !editingTeamName()?.trim()- }- pending={patchTeamMutation.isPending}- />- </Show>- </div>- </Show>- </SettingsRow>-- <SettingsRow- label="Slug"- description="Short code in task references like ENG-42 (GitHub, branch names)."- hideDescriptionOnMobile- >- <Show- when={isOwner()}- fallback={- <ReadOnlyField- value={props.teamSlug}- tooltip="Only the team owner can change the team slug."- />- }- >- <div class="flex items-center gap-2">- <div class="flex flex-col items-end gap-1 min-w-0">- <input- type="text"- value={teamSlugValue()}- onInput={(e) =>- handleTeamSlugChange(e.currentTarget.value)- }- onKeyDown={(e) => {- if (e.key === 'Enter') {- if (canSaveTeamSlug()) handleSaveTeamSlug();- } else if (e.key === 'Escape') {- handleCancelTeamSlugEdit();- e.currentTarget.blur();- }- }}- placeholder="Enter team slug"- class={TEAM_FIELD_CLASS}- aria-invalid={!!teamSlugError()}- />- <Show when={teamSlugError()}>- <p class="text-xs text-failure-ink text-right">- {teamSlugError()}- </p>- </Show>- <Show when={normalizedTeamSlugPreview()}>- <p class="text-xs text-ink-muted text-right">- Will save as {normalizedTeamSlugPreview()}- </p>- </Show>- </div>- <Show when={hasTeamSlugInputChanged()}>- <SaveCancelButtons- onSave={handleSaveTeamSlug}- onCancel={handleCancelTeamSlugEdit}- saveDisabled={!canSaveTeamSlug()}- pending={patchTeamMutation.isPending}- />- </Show>- </div>- </Show>- </SettingsRow>-- <SettingsRow- label="GitHub autolink"- description={- <>- Use <code>{props.teamSlug}-</code> as the reference prefix in- GitHub, then paste this target URL.- </>- }- hideDescriptionOnMobile- >- <Button- variant="outline"- size="sm"- onClick={handleCopyGithubAutolinkUrl}- >- <CopyIcon class="size-4" />- Copy target URL- </Button>- </SettingsRow>-- <Show when={isAdminOrOwner()}>- <SettingsRow- label="Auto-join on domain"- description={autoJoinDescription()}- hideDescriptionOnMobile- >- <ToggleSwitch- size="md"- checked={!!autoJoinDomain()}- disabled={- toggleAutoJoinMutation.isPending || teamQuery.isLoading- }- onChange={handleToggleAutoJoin}- />- </SettingsRow>-- <SettingsRow- label="Members can invite"- description="Let every team member invite people. When off, only admins and the owner can send invites."- hideDescriptionOnMobile- >- <ToggleSwitch- size="md"- checked={allowNonAdminInvites()}- disabled={- toggleNonAdminInvitesMutation.isPending ||- teamQuery.isLoading- }- onChange={handleToggleNonAdminInvites}- />- </SettingsRow>-- <SettingsRow- label="Default link sharing"- description="The link-sharing scope newly shared items start with. None means link sharing starts off."- hideDescriptionOnMobile- >- <SegmentedControl- aria-label="Default link sharing scope"- size="sm"- value={defaultLinkShare()}- options={LINK_SHARE_SCOPE_OPTIONS.map((option) => ({- ...option,- disabled:- patchTeamMutation.isPending || teamQuery.isLoading,- }))}- onChange={handleChangeDefaultLinkShare}- />- </SettingsRow>- </Show>- </SettingsCard>- </SettingsSection>-- <SettingsSection title="Connections">- <SettingsCard>- <SlackImport teamId={props.teamId} isAdmin={isAdminOrOwner()} />- <IntegrationRow- icon={<GithubIcon />}- title="GitHub App"- description="Connect your team's repositories for pull request sync."- >- {/* The install callback rejects users without a linked GitHub- account, so don't offer the flow until they've connected one- on the Integrations page. */}- <Show- when={githubLink.data?.status === 'linked'}- fallback={- <Show- when={!githubLink.isLoading}- fallback={- <span class="text-xs text-ink-muted">Loading…</span>- }- >- <ConnectAction- label="Connect your GitHub account first"- onClick={() => openSettings('Connected')}- />- </Show>- }- >- <a- href={`${SERVER_HOSTS['document-storage-service']}/github/install-sync`}- target="_blank"- rel="noopener noreferrer"- class="inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-sm font-medium text-ink-muted outline-none transition-colors hover:bg-ink/4 hover:text-ink focus-visible:bg-ink/6"- >- Configure app- <ArrowUpRightIcon class="size-3.5 opacity-70" />- </a>- </Show>- </IntegrationRow>- </SettingsCard>- </SettingsSection>-- <SettingsSection- title="Members"- actions={- // Members can invite unless the team has restricted inviting- // to admins; removals stay admin-only.- <Show- when={canInviteToTeam(currentUserRole(), allowNonAdminInvites())}- >- <Button- variant="outline"- size="sm"- onClick={() => setShowInviteModal(true)}- >- <PlusIcon class="size-4" />- Invite- </Button>- </Show>- }- >- <Show when={showMemberSearch()}>- <label class="flex items-center gap-2 h-9 px-3 rounded-lg border border-edge-muted text-ink-muted focus-within:border-accent focus-within:text-ink">- <MagnifyingGlassIcon class="size-4 shrink-0" />- <input- type="text"- value={memberQuery()}- onInput={(e) => setMemberQuery(e.currentTarget.value)}- placeholder="Filter members"- class="flex-1 min-w-0 bg-transparent text-sm text-ink outline-none placeholder:text-ink-placeholder"- />- <Show when={memberQuery()}>- <button- type="button"- class="shrink-0 text-ink-muted hover:text-ink"- aria-label="Clear filter"- onClick={() => setMemberQuery('')}- >- <XIcon class="size-4" />- </button>- </Show>- </label>- </Show>-- <Show- when={- teamQuery.isSuccess &&- showSeatPlans() &&- isAdminOrOwner() &&- !teamQuery.data?.team.enterprise &&- // A successful team response omits this field only on lookup failure.- teamQuery.data?.scheduled_seat_plans == null- }- >- <div- class="flex items-center gap-2 text-xs text-ink-muted"- role="status"- >- <span>Couldn't load scheduled plan changes.</span>- <Button- variant="ghost"- size="sm"- onClick={() => teamQuery.refetch()}- >- Try again- </Button>- </div>- </Show>-- <Show- when={!teamQuery.isLoading}- fallback={- <SettingsCard>- <div class="animate-pulse bg-skeleton rounded h-16 m-4" />- </SettingsCard>- }- >- <Show- when={filteredMembers().length > 0}- fallback={- <SettingsCard>- <div class="px-6 py-8 text-center text-sm text-ink-muted">- No members match “{memberQuery()}”- </div>- </SettingsCard>- }- >- <SettingsCard>- <For each={filteredMembers()}>- {(member) => (- <MemberRow- member={member}- isOwner={isOwner()}- isCurrentUser={member.user_id === userId()}- canManageRemovals={canManageMemberRemovals()}- canRemove={canRemoveTeamMember(- userId(),- currentUserRole(),- member- )}- showPlan={showSeatPlans()}- canEditPlan={isAdminOrOwner()}- planPending={planMovePending()}- pendingDowngrade={- teamQuery.data?.scheduled_seat_plans?.[member.user_id]- ?.plan === 'premium'- }- onPlanChange={(plan) => {- if (!props.teamId) return;- setMemberPlanMutation.mutate({- teamId: props.teamId,- userId: member.user_id,- plan,- });- }}- onRemove={() => setShowRemoveModal(member)}- onRoleChange={(newRole) => {- if (!props.teamId) return;- patchTeamMutation.mutate({- teamId: props.teamId,- request: {- user_role_updates: [- {- team_user_id: member.user_id,- role: newRole,- },- ],- },- });- }}- />- )}- </For>- </SettingsCard>- </Show>- </Show>- </SettingsSection>-- <Show- when={- (isOwner() || allowNonAdminInvites()) &&- (invitesQuery.data?.invites?.length ?? 0) > 0- }- >- <SettingsSection title="Pending invites">- <SettingsCard>- <For each={invitesQuery.data?.invites ?? []}>- {(invite) => (- <InviteRow- invite={invite}- canChange={isOwner() || allowNonAdminInvites()}- onCancel={() => setShowCancelInviteModal(invite)}- />- )}- </For>- </SettingsCard>- </SettingsSection>- </Show>- </SettingsPage>-- <Dialog- open={showDeleteTeamModal()}- onOpenChange={handleDeleteTeamModalClose}- >- <Panel depth={2} class="max-h-[75vh] text-ink rounded-xl">- <Panel.Header class="px-2 gap-1">- <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm">- <XIcon />- </Dialog.CloseButton>- <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">- Delete Team- </Dialog.Title>- </Panel.Header>- <Panel.Body class="p-3 flex flex-col gap-3">- <p>- Are you sure you want to delete{' '}- <span class="font-medium">{props.teamName}</span>? This action- cannot be undone and all team members will lose access.- </p>- <p class="text-sm text-ink-muted">- Type{' '}- <span class="font-medium text-ink">- {deleteConfirmationPhrase()}- </span>{' '}- to confirm.- </p>- <input- type="text"- value={deleteConfirmation()}- onInput={(e) => setDeleteConfirmation(e.currentTarget.value)}- placeholder={deleteConfirmationPhrase()}- class="settings-input w-full"- />- <div class="flex justify-end gap-1 pt-2">- <Button- variant="ghost"- disabled={deleteTeamMutation.isPending}- onClick={() => handleDeleteTeamModalClose(false)}- >- Cancel- </Button>- <Button- variant="strong"- disabled={!canDeleteTeam() || deleteTeamMutation.isPending}- onClick={handleDeleteTeam}- >- <Show- when={deleteTeamMutation.isPending}- fallback="Delete Team"- >- <SpinnerIcon class="size-4 animate-spin" />- </Show>- </Button>- </div>- </Panel.Body>- </Panel>- </Dialog>-- <ConfirmDialog- open={!!showRemoveModal()}- onOpenChange={(open) => !open && setShowRemoveModal(null)}- title="Remove Member"- tone="danger"- confirmLabel="Remove"- pending={removeUserMutation.isPending}- onConfirm={handleRemoveMember}- body={- <>- Are you sure you want to remove{' '}- <Show when={showRemoveModal()}>- {(member) => <MemberName memberId={member().user_id} />}- </Show>{' '}- from the team?- </>- }- />- <ConfirmDialog- open={!!showCancelInviteModal()}- onOpenChange={(open) => !open && setShowCancelInviteModal(null)}- title="Cancel Invitation"- tone="danger"- confirmLabel="Cancel Invite"- cancelLabel="Keep"- pending={deleteInviteMutation.isPending}- onConfirm={handleCancelInvite}- body={- <>- Are you sure you want to cancel the invitation for{' '}- <span class="font-medium">{showCancelInviteModal()?.email}</span>?- </>- }- />-- <InviteToTeamDialog- teamId={props.teamId}- open={showInviteModal()}- onClose={() => setShowInviteModal(false)}- />- </>- );}-function TeamContent() {+function TeamContent(props: { children: (team: TeamSummary) => JSX.Element }) {const userTeamsQuery = useUserTeamsQuery();const userInvitesQuery = useUserInvitesQuery();@@ -1776,14 +617,7 @@ function TeamContent() {return (<Switch><Match when={team()} keyed>- {(t) => (- <TeamManagement- teamId={t.id}- teamName={t.name}- teamSlug={t.slug}- ownerId={t.owner_id}- />- )}+ {(t) => props.children(t)}</Match><Match when={hasInvites()}><TeamInvites />@@ -1795,14 +629,21 @@ function TeamContent() {);}-export function Team() {+/**+ * Frame for every page in the Team settings group: renders the page for the+ * viewer's team, or their pending invitations / the create-team prompt when+ * they don't have one.+ */+export function TeamPage(props: {+ children: (team: TeamSummary) => JSX.Element;+}) {return (// Each state renders its own SettingsPage (scrolling, centered column) so// Team matches the Account/Appearance layout.<Suspensefallback={<div class="animate-pulse bg-skeleton rounded h-4 w-32 m-6" />}>- <TeamContent />+ <TeamContent>{props.children}</TeamContent></Suspense>);}diff --git a/apps/web/src/features/settings/TeamConnections.tsx b/apps/web/src/features/settings/TeamConnections.tsxnew file mode 100644index 0000000000..27b0426161--- /dev/null+++ b/apps/web/src/features/settings/TeamConnections.tsx@@ -0,0 +1,68 @@+import { SlackImport } from '@app/features/slack-import/slack-import';+import { useSettingsState } from '@core/constant/SettingsState';+import { SERVER_HOSTS } from '@core/constant/servers';+import GithubIcon from '@icon/mcp-github.svg';+import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';+import { useGithubLinkStatusQuery } from '@queries/auth';+import type { Team as TeamSummary } from '@service-auth/generated/schemas/team';+import { Show } from 'solid-js';+import { ConnectAction } from './integration-ui';+import {+ IntegrationRow,+ SettingsCard,+ SettingsPage,+ SettingsSection,+} from './primitives';+import { useTeamViewer } from './Team';++/** Team › Connections: team-wide Slack import and the GitHub App. */+export function TeamConnections(props: { team: TeamSummary }) {+ const { isAdminOrOwner } = useTeamViewer(() => props.team);+ const githubLink = useGithubLinkStatusQuery();+ const { openSettings } = useSettingsState();++ return (+ <SettingsPage title="Team connections">+ <SettingsSection title="Connections">+ <SettingsCard>+ <SlackImport teamId={props.team.id} isAdmin={isAdminOrOwner()} />+ <IntegrationRow+ icon={<GithubIcon />}+ title="GitHub App"+ description="Connect your team's repositories for pull request sync."+ >+ {/* The install callback rejects users without a linked GitHub+ account, so don't offer the flow until they've connected one+ on the Integrations page. */}+ <Show+ when={githubLink.data?.status === 'linked'}+ fallback={+ <Show+ when={!githubLink.isLoading}+ fallback={+ <span class="text-xs text-ink-muted">Loading…</span>+ }+ >+ <ConnectAction+ label="Connect your GitHub account first"+ onClick={() => openSettings('Connected')}+ />+ </Show>+ }+ >+ <a+ href={`${SERVER_HOSTS['document-storage-service']}/github/install-sync`}+ target="_blank"+ rel="noopener noreferrer"+ class="inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-sm font-medium text-ink-muted outline-none transition-colors hover:bg-ink/4 hover:text-ink focus-visible:bg-ink/6"+ >+ Configure app+ <ArrowUpRightIcon class="size-3.5 opacity-70" />+ </a>+ </Show>+ </IntegrationRow>+ </SettingsCard>+ </SettingsSection>+ </SettingsPage>+ );+}diff --git a/apps/web/src/features/settings/TeamGeneral.tsx b/apps/web/src/features/settings/TeamGeneral.tsxnew file mode 100644index 0000000000..cbe852f11d--- /dev/null+++ b/apps/web/src/features/settings/TeamGeneral.tsx@@ -0,0 +1,475 @@+import { toast } from '@core/component/Toast/Toast';+import {+ getLinkShareScope,+ LINK_SHARE_SCOPE_OPTIONS,+ type LinkShareScope,+ NO_LINK_SHARE,+} from '@core/component/TopBar/linkShare';+import { getWebOrigin } from '@core/util/webOrigin';+import CheckIcon from '@phosphor/check.svg';+import CopyIcon from '@phosphor/copy.svg';+import SpinnerIcon from '@phosphor/spinner.svg';+import TrashIcon from '@phosphor/trash.svg';+import XIcon from '@phosphor/x.svg';+import {+ useDeleteTeamMutation,+ usePatchTeamMutation,+} from '@queries/team/teams';+import type { Team as TeamSummary } from '@service-auth/generated/schemas/team';+import { Button, Dialog, Panel, SegmentedControl, Tooltip } from '@ui';+import { createSignal, Show } from 'solid-js';+import {+ SettingsCard,+ SettingsPage,+ SettingsRow,+ SettingsSection,+} from './primitives';+import { teamNameSchema, useTeamViewer } from './Team';+import {+ buildTeamTaskAutolinkTargetUrl,+ getTeamSlugError,+ normalizeTeamSlugInput,+} from './teamSlug';++/** Disabled field shown to non-owners, with a tooltip explaining why it's locked.+ * The muted look comes from `settings-input`'s `:disabled` styling. */+function ReadOnlyField(props: { value: string; tooltip: string }) {+ return (+ <Tooltip label={props.tooltip} placement="top">+ <input+ type="text"+ value={props.value}+ disabled+ class="settings-input w-56 mobile:w-32"+ />+ </Tooltip>+ );+}++/** The Save / Cancel cluster shown while an inline field has unsaved changes. */+function SaveCancelButtons(props: {+ onSave: () => void;+ onCancel: () => void;+ saveDisabled?: boolean;+ pending?: boolean;+}) {+ return (+ <div class="flex items-center gap-1 shrink-0">+ <Tooltip label="Save">+ <Button+ variant="accent"+ size="icon-sm"+ disabled={props.saveDisabled}+ onClick={props.onSave}+ >+ <Show when={props.pending} fallback={<CheckIcon class="size-4" />}>+ <SpinnerIcon class="size-4 animate-spin" />+ </Show>+ </Button>+ </Tooltip>+ <Tooltip label="Cancel">+ <Button+ variant="ghost"+ size="icon-sm"+ disabled={props.pending}+ onClick={props.onCancel}+ >+ <XIcon class="size-4" />+ </Button>+ </Tooltip>+ </div>+ );+}++/** Team › General: name, slug, link sharing, and deletion. */+export function TeamGeneral(props: { team: TeamSummary }) {+ const { teamQuery, isOwner, isAdminOrOwner } = useTeamViewer(+ () => props.team+ );++ const patchTeamMutation = usePatchTeamMutation();+ const deleteTeamMutation = useDeleteTeamMutation();++ const [showDeleteTeamModal, setShowDeleteTeamModal] = createSignal(false);+ const [deleteConfirmation, setDeleteConfirmation] = createSignal('');+ const [editingTeamName, setEditingTeamName] = createSignal<+ string | undefined+ >(undefined);+ const [editingTeamSlug, setEditingTeamSlug] = createSignal<+ string | undefined+ >(undefined);+ const [teamSlugError, setTeamSlugError] = createSignal<string | undefined>(+ undefined+ );++ const deleteConfirmationPhrase = () => `Delete ${props.team.name}`;+ const canDeleteTeam = () =>+ deleteConfirmation() === deleteConfirmationPhrase();++ const teamNameValue = () => editingTeamName() ?? props.team.name;+ const hasTeamNameChanged = () => {+ const editing = editingTeamName();+ return editing !== undefined && editing.trim() !== props.team.name;+ };++ const teamSlugValue = () => editingTeamSlug() ?? props.team.slug;+ const hasTeamSlugInputChanged = () => {+ const editing = editingTeamSlug();+ return editing !== undefined && editing !== props.team.slug;+ };+ const hasTeamSlugChanged = () => {+ const editing = editingTeamSlug();+ return (+ editing !== undefined &&+ normalizeTeamSlugInput(editing) !== props.team.slug+ );+ };+ const normalizedTeamSlugPreview = () => {+ const editing = editingTeamSlug();+ if (editing === undefined || !hasTeamSlugChanged()) return undefined;+ if (getTeamSlugError(editing)) return undefined;++ const normalized = normalizeTeamSlugInput(editing);+ return normalized === editing ? undefined : normalized;+ };+ const canSaveTeamSlug = () => {+ const editing = editingTeamSlug();+ return (+ editing !== undefined &&+ hasTeamSlugChanged() &&+ !patchTeamMutation.isPending &&+ getTeamSlugError(editing) === undefined+ );+ };++ // The team-wide default link-share scope for newly shared items. NONE+ // (stored as null) means link sharing starts off.+ const defaultLinkShare = () =>+ getLinkShareScope(teamQuery.data?.team.default_link_share);++ const handleChangeDefaultLinkShare = (scope: LinkShareScope) => {+ if (!props.team.id || patchTeamMutation.isPending) return;+ if (scope === defaultLinkShare()) return;+ patchTeamMutation.mutate({+ teamId: props.team.id,+ request: { default_link_share: scope === NO_LINK_SHARE ? null : scope },+ });+ };++ const handleSaveTeamName = () => {+ const newName = editingTeamName()?.trim();+ if (!props.team.id || !newName) return;++ // Validate against the same schema as the create flow (e.g. max length)+ // so rename can't push a name the create path would reject.+ const parsed = teamNameSchema.safeParse(newName);+ if (!parsed.success) return;++ patchTeamMutation.mutate(+ { teamId: props.team.id, request: { name: parsed.data } },+ { onSuccess: () => setEditingTeamName(undefined) }+ );+ };++ const handleCancelTeamNameEdit = () => {+ setEditingTeamName(undefined);+ };++ const validateTeamSlug = (slug: string) => {+ const error = getTeamSlugError(slug);+ setTeamSlugError(error);+ return error === undefined;+ };++ const handleTeamSlugChange = (slug: string) => {+ setEditingTeamSlug(slug);+ validateTeamSlug(slug);+ };++ const handleSaveTeamSlug = () => {+ const editedSlug = editingTeamSlug();+ if (!props.team.id || editedSlug === undefined) return;+ if (!validateTeamSlug(editedSlug) || !hasTeamSlugChanged()) return;++ // Persist the normalized slug so the saved value matches the "Will save as"+ // preview (and the backend's UPPERCASE_UNDERSCORE format).+ patchTeamMutation.mutate(+ {+ teamId: props.team.id,+ request: { slug: normalizeTeamSlugInput(editedSlug) },+ },+ {+ onSuccess: () => {+ setEditingTeamSlug(undefined);+ setTeamSlugError(undefined);+ },+ }+ );+ };++ const handleCancelTeamSlugEdit = () => {+ setEditingTeamSlug(undefined);+ setTeamSlugError(undefined);+ };++ const handleCopyGithubAutolinkUrl = async () => {+ const targetUrl = buildTeamTaskAutolinkTargetUrl(+ props.team.slug,+ getWebOrigin()+ );+ try {+ await navigator.clipboard.writeText(targetUrl);+ toast.success('GitHub autolink URL copied');+ } catch (error) {+ console.error('Failed to copy GitHub autolink URL', error);+ toast.failure('Failed to copy GitHub autolink URL');+ }+ };++ const handleDeleteTeam = () => {+ if (!props.team.id) return;++ deleteTeamMutation.mutate(+ { teamId: props.team.id },+ {+ onSuccess: () => {+ setDeleteConfirmation('');+ setShowDeleteTeamModal(false);+ },+ }+ );+ };++ const handleDeleteTeamModalClose = (open: boolean) => {+ if (!open) {+ setDeleteConfirmation('');+ setShowDeleteTeamModal(false);+ }+ };++ return (+ <>+ <SettingsPage+ title="Team"+ actions={+ <Show when={isOwner()}>+ <Button+ variant="danger"+ size="sm"+ onClick={() => setShowDeleteTeamModal(true)}+ >+ <TrashIcon class="size-4" />+ Delete Team+ </Button>+ </Show>+ }+ >+ <SettingsSection title="General">+ <SettingsCard>+ <SettingsRow+ label="Name"+ description="What your team is called — shown in invitations and billing."+ hideDescriptionOnMobile+ >+ <Show+ when={isOwner()}+ fallback={+ <ReadOnlyField+ value={props.team.name}+ tooltip="Only the team owner can change the team name."+ />+ }+ >+ <div class="flex items-center gap-2">+ <input+ type="text"+ value={teamNameValue()}+ onInput={(e) => setEditingTeamName(e.currentTarget.value)}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ if (hasTeamNameChanged() && editingTeamName()?.trim()) {+ handleSaveTeamName();+ }+ } else if (e.key === 'Escape') {+ handleCancelTeamNameEdit();+ e.currentTarget.blur();+ }+ }}+ placeholder="Enter team name"+ class="settings-input w-56 mobile:w-32"+ />+ <Show when={hasTeamNameChanged()}>+ <SaveCancelButtons+ onSave={handleSaveTeamName}+ onCancel={handleCancelTeamNameEdit}+ saveDisabled={+ patchTeamMutation.isPending ||+ !editingTeamName()?.trim()+ }+ pending={patchTeamMutation.isPending}+ />+ </Show>+ </div>+ </Show>+ </SettingsRow>++ <SettingsRow+ label="Slug"+ description="Short code in task references like ENG-42 (GitHub, branch names)."+ hideDescriptionOnMobile+ >+ <Show+ when={isOwner()}+ fallback={+ <ReadOnlyField+ value={props.team.slug}+ tooltip="Only the team owner can change the team slug."+ />+ }+ >+ <div class="flex items-center gap-2">+ <div class="flex flex-col items-end gap-1 min-w-0">+ <input+ type="text"+ value={teamSlugValue()}+ onInput={(e) =>+ handleTeamSlugChange(e.currentTarget.value)+ }+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ if (canSaveTeamSlug()) handleSaveTeamSlug();+ } else if (e.key === 'Escape') {+ handleCancelTeamSlugEdit();+ e.currentTarget.blur();+ }+ }}+ placeholder="Enter team slug"+ class="settings-input w-56 mobile:w-32"+ aria-invalid={!!teamSlugError()}+ />+ <Show when={teamSlugError()}>+ <p class="text-xs text-failure-ink text-right">+ {teamSlugError()}+ </p>+ </Show>+ <Show when={normalizedTeamSlugPreview()}>+ <p class="text-xs text-ink-muted text-right">+ Will save as {normalizedTeamSlugPreview()}+ </p>+ </Show>+ </div>+ <Show when={hasTeamSlugInputChanged()}>+ <SaveCancelButtons+ onSave={handleSaveTeamSlug}+ onCancel={handleCancelTeamSlugEdit}+ saveDisabled={!canSaveTeamSlug()}+ pending={patchTeamMutation.isPending}+ />+ </Show>+ </div>+ </Show>+ </SettingsRow>++ <SettingsRow+ label="GitHub autolink"+ description={+ <>+ Use <code>{props.team.slug}-</code> as the reference prefix in+ GitHub, then paste this target URL.+ </>+ }+ hideDescriptionOnMobile+ >+ <Button+ variant="outline"+ size="sm"+ onClick={handleCopyGithubAutolinkUrl}+ >+ <CopyIcon class="size-4" />+ Copy target URL+ </Button>+ </SettingsRow>++ <Show when={isAdminOrOwner()}>+ <SettingsRow+ label="Default link sharing"+ description="The link-sharing scope newly shared items start with. None means link sharing starts off."+ hideDescriptionOnMobile+ >+ <SegmentedControl+ aria-label="Default link sharing scope"+ size="sm"+ value={defaultLinkShare()}+ options={LINK_SHARE_SCOPE_OPTIONS.map((option) => ({+ ...option,+ disabled:+ patchTeamMutation.isPending || teamQuery.isLoading,+ }))}+ onChange={handleChangeDefaultLinkShare}+ />+ </SettingsRow>+ </Show>+ </SettingsCard>+ </SettingsSection>+ </SettingsPage>++ <Dialog+ open={showDeleteTeamModal()}+ onOpenChange={handleDeleteTeamModalClose}+ >+ <Panel depth={2} class="max-h-[75vh] text-ink rounded-xl">+ <Panel.Header class="px-2 gap-1">+ <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm">+ <XIcon />+ </Dialog.CloseButton>+ <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">+ Delete Team+ </Dialog.Title>+ </Panel.Header>+ <Panel.Body class="p-3 flex flex-col gap-3">+ <p>+ Are you sure you want to delete{' '}+ <span class="font-medium">{props.team.name}</span>? This action+ cannot be undone and all team members will lose access.+ </p>+ <p class="text-sm text-ink-muted">+ Type{' '}+ <span class="font-medium text-ink">+ {deleteConfirmationPhrase()}+ </span>{' '}+ to confirm.+ </p>+ <input+ type="text"+ value={deleteConfirmation()}+ onInput={(e) => setDeleteConfirmation(e.currentTarget.value)}+ placeholder={deleteConfirmationPhrase()}+ class="settings-input w-full"+ />+ <div class="flex justify-end gap-1 pt-2">+ <Button+ variant="ghost"+ disabled={deleteTeamMutation.isPending}+ onClick={() => handleDeleteTeamModalClose(false)}+ >+ Cancel+ </Button>+ <Button+ variant="strong"+ disabled={!canDeleteTeam() || deleteTeamMutation.isPending}+ onClick={handleDeleteTeam}+ >+ <Show+ when={deleteTeamMutation.isPending}+ fallback="Delete Team"+ >+ <SpinnerIcon class="size-4 animate-spin" />+ </Show>+ </Button>+ </div>+ </Panel.Body>+ </Panel>+ </Dialog>+ </>+ );+}diff --git a/apps/web/src/features/settings/TeamMembers.tsx b/apps/web/src/features/settings/TeamMembers.tsxnew file mode 100644index 0000000000..737266b144--- /dev/null+++ b/apps/web/src/features/settings/TeamMembers.tsx@@ -0,0 +1,688 @@+import { useFeatureFlag } from '@app/lib/analytics/posthog';+import { UserIcon } from '@core/component/UserIcon';+import { enableAiUsageBilling } from '@core/constant/featureFlags';+import { useUserId } from '@core/context/user';+import { getDisplayName, macroIdToEmail, tryMacroId } from '@core/user';+import { debouncedDependent } from '@core/util/debounce';+import { fuzzyFilter } from '@core/util/fuzzy';+import { getWebOrigin } from '@core/util/webOrigin';+import { formatRelativeTimestamp } from '@entity';+import type { CollectionNode } from '@kobalte/core';+import { Select } from '@kobalte/core/select';+import CaretDownIcon from '@phosphor/caret-down.svg';+import CheckIcon from '@phosphor/check.svg';+import EnvelopeIcon from '@phosphor/envelope.svg';+import LinkIcon from '@phosphor/link.svg';+import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';+import PlusIcon from '@phosphor/plus.svg';+import TrashIcon from '@phosphor/trash.svg';+import XIcon from '@phosphor/x.svg';+import { useAiBillingSummaryQuery } from '@queries/auth';+import {+ useDeleteTeamInviteMutation,+ useTeamInvitesQuery,+} from '@queries/team/invites';+import {+ useRemoveUserFromTeamMutation,+ useSetTeamMemberPlanMutation,+} from '@queries/team/members';+import {+ usePatchTeamMutation,+ useToggleAutoJoinDomainMutation,+ useToggleNonAdminInvitesMutation,+} from '@queries/team/teams';+import type { PaidPlan } from '@service-auth/ai-billing-types';+import type { Team as TeamSummary } from '@service-auth/generated/schemas/team';+import type { TeamInviteDetails } from '@service-auth/generated/schemas/teamInviteDetails';+import type { TeamMember } from '@service-auth/generated/schemas/teamMember';+import { TeamRole } from '@service-auth/generated/schemas/teamRole';+import { Button, ConfirmDialog, ToggleSwitch, Tooltip } from '@ui';+import {+ createMemo,+ createSignal,+ For,+ mapArray,+ onCleanup,+ Show,+} from 'solid-js';+import { TeamSeatPlanSelect } from './components/team-seat-plan-select';+import {+ SettingsCard,+ SettingsPage,+ SettingsRow,+ SettingsSection,+} from './primitives';+import { InviteToTeamDialog, useTeamViewer } from './Team';+import { canInviteToTeam, canRemoveTeamMember } from './teamMemberPermissions';++const roleOrder: Record<string, number> = {+ [TeamRole.owner]: 0,+ [TeamRole.admin]: 1,+ [TeamRole.member]: 2,+};++type RoleOption = { value: TeamRole; label: string };++const roleOptions: RoleOption[] = [+ { value: TeamRole.member, label: 'Member' },+ { value: TeamRole.admin, label: 'Admin' },+];++function RoleSelect(props: {+ value: TeamRole;+ onChange: (role: TeamRole) => void;+ disabled?: boolean;+}) {+ const selectedOption = () =>+ roleOptions.find((o) => o.value === props.value) ?? roleOptions[0];++ return (+ <Select<RoleOption>+ options={roleOptions}+ value={selectedOption()}+ onChange={(opt) => opt && props.onChange(opt.value)}+ optionValue="value"+ optionTextValue="label"+ gutter={4}+ placement="bottom-end"+ disabled={props.disabled}+ itemComponent={(itemProps: { item: CollectionNode<RoleOption> }) => (+ <Select.Item+ item={itemProps.item}+ class="flex items-center justify-between gap-2 px-2 py-1.5 text-sm rounded-xs hover:bg-hover outline-none data-highlighted:bg-hover"+ >+ <Select.ItemLabel>{itemProps.item.rawValue.label}</Select.ItemLabel>+ <Select.ItemIndicator>+ <CheckIcon class="size-3" />+ </Select.ItemIndicator>+ </Select.Item>+ )}+ >+ <Select.Trigger+ as={Button}+ class="rounded-xs px-1 py-0.5 text-xs -ml-1 data-expanded:bg-ink/10"+ disabled={props.disabled}+ >+ <Select.Value<RoleOption>>+ {(state) => state.selectedOption().label}+ </Select.Value>+ <CaretDownIcon class="size-3 text-ink-muted shrink-0" />+ </Select.Trigger>+ <Select.Portal>+ <Select.Content class="menu-surface z-action-menu min-w-25 p-1">+ <Select.Listbox />+ </Select.Content>+ </Select.Portal>+ </Select>+ );+}++/**+ * The plan a member's seat is billed at. Until the generated `TeamMember`+ * schema carries `plan`, read it defensively; every seat starts on Pro.+ */+function memberPlan(member: TeamMember): PaidPlan {+ const plan = (member as TeamMember & { plan?: PaidPlan }).plan;+ return plan === 'max' ? 'max' : 'premium';+}++function MemberRow(props: {+ member: TeamMember;+ isOwner: boolean;+ isCurrentUser: boolean;+ canManageRemovals: boolean;+ canRemove: boolean;+ /** Whether seat plans apply (paid team) and the viewer may change them. */+ showPlan: boolean;+ canEditPlan: boolean;+ planPending: boolean;+ pendingDowngrade: boolean;+ onRemove: () => void;+ onRoleChange: (role: TeamRole) => void;+ onPlanChange: (plan: PaidPlan) => void;+}) {+ const aiUsageBilling = useFeatureFlag(enableAiUsageBilling);+ const displayName = () => getDisplayName(tryMacroId(props.member.user_id));+ const isMemberOwner = () => props.member.role === TeamRole.owner;+ const email = () => {+ const id = tryMacroId(props.member.user_id);+ return id ? macroIdToEmail(id) : undefined;+ };+ const showEmail = () => {+ const e = email();+ return e && e !== displayName();+ };++ return (+ <div class="flex items-center justify-between gap-2 px-4 py-4">+ <div class="flex items-center gap-3 min-w-0 flex-1">+ <div class="shrink-0">+ <UserIcon id={props.member.user_id} isDeleted={false} size="lg" />+ </div>+ <div class="min-w-0 flex-1">+ <div class="text-sm font-medium text-ink truncate">+ {displayName()}+ {props.isCurrentUser && (+ <span class="text-ink-muted font-normal"> (you)</span>+ )}+ </div>+ <Show when={showEmail()}>+ <div class="text-xs text-ink-muted truncate">{email()}</div>+ </Show>+ </div>+ </div>+ <div class="flex items-center gap-2 shrink-0">+ <Show when={props.showPlan}>+ <Show+ when={props.canEditPlan}+ fallback={+ <span class="text-xs text-ink-muted capitalize">+ {memberPlan(props.member)}+ </span>+ }+ >+ <TeamSeatPlanSelect+ value={memberPlan(props.member)}+ onChange={props.onPlanChange}+ disabled={props.planPending}+ aiUsageBilling={aiUsageBilling().enabled}+ pendingDowngrade={props.pendingDowngrade}+ />+ </Show>+ </Show>+ <Show+ when={props.isOwner && !isMemberOwner()}+ fallback={+ <span class="text-xs text-ink-muted capitalize">+ {props.member.role}+ </span>+ }+ >+ <RoleSelect value={props.member.role} onChange={props.onRoleChange} />+ </Show>+ <Show when={props.canManageRemovals}>+ <Show+ when={props.canRemove}+ fallback={+ <Tooltip+ label={+ isMemberOwner()+ ? 'Cannot remove team owner'+ : 'Cannot remove yourself'+ }+ >+ <Button+ variant="ghost"+ size="sm"+ disabled+ class="opacity-50 cursor-not-allowed"+ >+ <TrashIcon class="size-4" />+ </Button>+ </Tooltip>+ }+ >+ <Tooltip label="Remove member">+ <Button variant="ghost" size="sm" onClick={props.onRemove}>+ <TrashIcon class="size-4" />+ </Button>+ </Tooltip>+ </Show>+ </Show>+ </div>+ </div>+ );+}++function MemberName(props: { memberId: string }) {+ const displayName = () => getDisplayName(tryMacroId(props.memberId));+ return <span class="font-medium">{displayName()}</span>;+}++function InviteRow(props: {+ invite: TeamInviteDetails;+ canChange: boolean;+ onCancel: () => void;+}) {+ const [copied, setCopied] = createSignal(false);+ let copyResetTimeout: ReturnType<typeof setTimeout> | undefined;+ onCleanup(() => clearTimeout(copyResetTimeout));+ const handleCopyLink = async () => {+ try {+ await navigator.clipboard.writeText(+ `${getWebOrigin()}/app/team-invite?id=${props.invite.id}`+ );+ } catch (err) {+ console.error('Failed to copy to clipboard', err);+ return;+ }+ setCopied(true);+ clearTimeout(copyResetTimeout);+ copyResetTimeout = setTimeout(() => setCopied(false), 2000);+ };++ return (+ <div class="flex items-center justify-between gap-2 px-4 py-4">+ <div class="flex items-center gap-3 min-w-0 flex-1">+ <div class="size-8 rounded-full bg-accent/10 flex items-center justify-center shrink-0">+ <EnvelopeIcon class="size-4 text-accent" />+ </div>+ <div class="min-w-0 flex-1">+ <div class="text-sm text-ink truncate">{props.invite.email}</div>+ <div class="text-xs text-ink-muted">+ Invited as {props.invite.team_role} ·{' '}+ {formatRelativeTimestamp(props.invite.created_at, {+ condensed: true,+ })}+ </div>+ </div>+ </div>+ <Show when={props.canChange}>+ <Tooltip label={copied() ? 'Copied' : 'Copy invite link'}>+ <Button+ variant="ghost"+ size="sm"+ class="shrink-0"+ onClick={handleCopyLink}+ >+ <Show when={copied()} fallback={<LinkIcon class="size-4" />}>+ <CheckIcon class="size-4" />+ </Show>+ </Button>+ </Tooltip>+ <Tooltip label="Cancel invite">+ <Button+ variant="ghost"+ size="sm"+ class="shrink-0"+ onClick={props.onCancel}+ >+ <XIcon class="size-4" />+ </Button>+ </Tooltip>+ </Show>+ </div>+ );+}++/** Team › Members: the roster, roles and seats, and how people join. */+export function TeamMembers(props: { team: TeamSummary }) {+ const userId = useUserId();+ const {+ teamQuery,+ role: currentUserRole,+ isOwner,+ isAdminOrOwner,+ allowNonAdminInvites,+ } = useTeamViewer(() => props.team);+ const invitesQuery = useTeamInvitesQuery(() => props.team.id);++ const deleteInviteMutation = useDeleteTeamInviteMutation();+ const removeUserMutation = useRemoveUserFromTeamMutation();+ const patchTeamMutation = usePatchTeamMutation();+ const toggleAutoJoinMutation = useToggleAutoJoinDomainMutation();+ const toggleNonAdminInvitesMutation = useToggleNonAdminInvitesMutation();++ const [showRemoveModal, setShowRemoveModal] = createSignal<TeamMember | null>(+ null+ );+ const [showCancelInviteModal, setShowCancelInviteModal] =+ createSignal<TeamInviteDetails | null>(null);+ const [showInviteModal, setShowInviteModal] = createSignal(false);++ const members = createMemo(() => {+ const unsorted = teamQuery.data?.members ?? [];+ return [...unsorted].sort((a, b) => {+ const roleCompare = (roleOrder[a.role] ?? 3) - (roleOrder[b.role] ?? 3);+ if (roleCompare !== 0) return roleCompare;+ return a.user_id.localeCompare(b.user_id);+ });+ });++ const [memberQuery, setMemberQuery] = createSignal('');+ // The input stays live (`memberQuery`); filtering reads this debounced view so+ // a burst of typing collapses to one O(n) scan instead of one per keystroke.+ const debouncedMemberQuery = debouncedDependent(memberQuery, 120);++ // Resolve each member's display name reactively. `mapArray` keeps one stable+ // name lookup per member (not recreated on every keystroke / re-render), and+ // disposes it when the member leaves the list.+ const memberSearchIndex = mapArray(members, (member) => {+ const macroId = tryMacroId(member.user_id);+ const displayName = () => getDisplayName(macroId);+ const email = macroId ? macroIdToEmail(macroId) : '';+ // Memoized so the lowercased search string is built once (and only rebuilt+ // when the name resolves), not re-allocated for every member on each scan.+ const haystack = createMemo(() =>+ `${displayName()} ${email}`.toLowerCase()+ );+ return { member, haystack };+ });++ // Only worth showing the filter once the list is long enough to scan.+ const showMemberSearch = () => members().length > 5;++ const filteredMembers = createMemo(() => {+ const q = debouncedMemberQuery().trim().toLowerCase();+ if (!q) return members();+ // Shared uFuzzy-backed filter (ranks by relevance, favoring contiguity).+ return fuzzyFilter(q, memberSearchIndex(), (entry) => entry.haystack()).map(+ (entry) => entry.member+ );+ });++ const canManageMemberRemovals = () => isAdminOrOwner();++ // The team's auto-join domain doubles as the toggle state: a string means+ // auto-join is on for that domain, null/undefined means it's off.+ const autoJoinDomain = () => teamQuery.data?.team.auto_join_domain ?? null;+ const autoJoinDescription = () => {+ const domain = autoJoinDomain();+ return domain+ ? `New sign-ups with an @${domain} email automatically join this team.`+ : "Automatically add new sign-ups whose email matches the team owner's domain.";+ };++ const handleToggleAutoJoin = () => {+ if (!props.team.id || toggleAutoJoinMutation.isPending) return;+ toggleAutoJoinMutation.mutate({ teamId: props.team.id });+ };++ const handleToggleNonAdminInvites = () => {+ if (!props.team.id || toggleNonAdminInvitesMutation.isPending) return;+ toggleNonAdminInvitesMutation.mutate({ teamId: props.team.id });+ };++ // Seat plans only exist on teams billed per seat: enterprise teams, and+ // paying teams, whose shared credits and overage are billed to the owner.+ // The team API does not expose its subscription, so a paying team is+ // recognised from the viewer's billing position: a paid tier whose payer is+ // the team owner and whose seat count spans more than one member (a free-team+ // owner with a personal subscription is billed for exactly one seat). A+ // paying team of one therefore shows no seat menu; its owner moves their own+ // seat from Billing.+ const billingSummary = useAiBillingSummaryQuery();+ const showSeatPlans = () => {+ const team = teamQuery.data?.team;+ if (!team) return false;+ if (team.enterprise) return true;+ return (+ billingSummary.isSuccess &&+ billingSummary.data.tier !== 'free' &&+ billingSummary.data.payer === team.owner_id &&+ billingSummary.data.seats > 1+ );+ };+ const setMemberPlanMutation = useSetTeamMemberPlanMutation();+ // Seat moves read and rewrite the subscription's item quantities, so only+ // one may be in flight per team: every plan menu waits while one runs.+ const planMovePending = () => setMemberPlanMutation.isPending;++ const handleRemoveMember = () => {+ const member = showRemoveModal();+ if (!props.team.id || !member) return;++ removeUserMutation.mutate(+ { teamId: props.team.id, userId: member.user_id },+ { onSuccess: () => setShowRemoveModal(null) }+ );+ };++ const handleCancelInvite = () => {+ const invite = showCancelInviteModal();+ if (!props.team.id || !invite) return;++ deleteInviteMutation.mutate(+ { teamId: props.team.id, teamInviteId: invite.id },+ { onSuccess: () => setShowCancelInviteModal(null) }+ );+ };++ return (+ <>+ <SettingsPage+ title="Members"+ description={`Invite people to ${props.team.name} and manage their roles.`}+ actions={+ // Members can invite unless the team has restricted inviting+ // to admins; removals stay admin-only.+ <Show+ when={canInviteToTeam(currentUserRole(), allowNonAdminInvites())}+ >+ {/* Inverted (black on light, white on dark) so inviting is the+ page's primary action. */}+ <Button+ variant="cta"+ glass={false}+ class="bg-ink text-[15px] text-surface"+ onClick={() => setShowInviteModal(true)}+ >+ <PlusIcon class="size-4" />+ Invite+ </Button>+ </Show>+ }+ >+ <SettingsSection>+ <Show when={showMemberSearch()}>+ <label class="flex items-center gap-2 h-9 px-3 rounded-lg border border-edge-muted text-ink-muted focus-within:border-accent focus-within:text-ink">+ <MagnifyingGlassIcon class="size-4 shrink-0" />+ <input+ type="text"+ value={memberQuery()}+ onInput={(e) => setMemberQuery(e.currentTarget.value)}+ placeholder="Filter members"+ class="flex-1 min-w-0 bg-transparent text-sm text-ink outline-none placeholder:text-ink-placeholder"+ />+ <Show when={memberQuery()}>+ <button+ type="button"+ class="shrink-0 text-ink-muted hover:text-ink"+ aria-label="Clear filter"+ onClick={() => setMemberQuery('')}+ >+ <XIcon class="size-4" />+ </button>+ </Show>+ </label>+ </Show>++ <Show+ when={+ teamQuery.isSuccess &&+ showSeatPlans() &&+ isAdminOrOwner() &&+ !teamQuery.data?.team.enterprise &&+ // A successful team response omits this field only on lookup failure.+ teamQuery.data?.scheduled_seat_plans == null+ }+ >+ <div+ class="flex items-center gap-2 text-xs text-ink-muted"+ role="status"+ >+ <span>Couldn't load scheduled plan changes.</span>+ <Button+ variant="ghost"+ size="sm"+ onClick={() => teamQuery.refetch()}+ >+ Try again+ </Button>+ </div>+ </Show>++ <Show+ when={!teamQuery.isLoading}+ fallback={+ <SettingsCard>+ <div class="animate-pulse bg-skeleton rounded h-16 m-4" />+ </SettingsCard>+ }+ >+ <Show+ when={filteredMembers().length > 0}+ fallback={+ <SettingsCard>+ <div class="px-6 py-8 text-center text-sm text-ink-muted">+ No members match “{memberQuery()}”+ </div>+ </SettingsCard>+ }+ >+ {/* Long rosters scroll inside the card so Invite settings+ below stay in reach. The height cuts a row in half so the+ list visibly continues. */}+ <SettingsCard class="max-h-[418px] overflow-y-auto! overscroll-contain">+ <For each={filteredMembers()}>+ {(member) => (+ <MemberRow+ member={member}+ isOwner={isOwner()}+ isCurrentUser={member.user_id === userId()}+ canManageRemovals={canManageMemberRemovals()}+ canRemove={canRemoveTeamMember(+ userId(),+ currentUserRole(),+ member+ )}+ showPlan={showSeatPlans()}+ canEditPlan={isAdminOrOwner()}+ planPending={planMovePending()}+ pendingDowngrade={+ teamQuery.data?.scheduled_seat_plans?.[member.user_id]+ ?.plan === 'premium'+ }+ onPlanChange={(plan) => {+ if (!props.team.id) return;+ setMemberPlanMutation.mutate({+ teamId: props.team.id,+ userId: member.user_id,+ plan,+ });+ }}+ onRemove={() => setShowRemoveModal(member)}+ onRoleChange={(newRole) => {+ if (!props.team.id) return;+ patchTeamMutation.mutate({+ teamId: props.team.id,+ request: {+ user_role_updates: [+ {+ team_user_id: member.user_id,+ role: newRole,+ },+ ],+ },+ });+ }}+ />+ )}+ </For>+ </SettingsCard>+ </Show>+ </Show>+ </SettingsSection>++ <Show+ when={+ (isOwner() || allowNonAdminInvites()) &&+ (invitesQuery.data?.invites?.length ?? 0) > 0+ }+ >+ <SettingsSection title="Pending invites">+ <SettingsCard>+ <For each={invitesQuery.data?.invites ?? []}>+ {(invite) => (+ <InviteRow+ invite={invite}+ canChange={isOwner() || allowNonAdminInvites()}+ onCancel={() => setShowCancelInviteModal(invite)}+ />+ )}+ </For>+ </SettingsCard>+ </SettingsSection>+ </Show>++ <Show when={isAdminOrOwner()}>+ <SettingsSection title="Invite settings">+ <SettingsCard>+ <SettingsRow+ label="Auto-join on domain"+ description={autoJoinDescription()}+ hideDescriptionOnMobile+ >+ <ToggleSwitch+ size="md"+ checked={!!autoJoinDomain()}+ disabled={+ toggleAutoJoinMutation.isPending || teamQuery.isLoading+ }+ onChange={handleToggleAutoJoin}+ />+ </SettingsRow>++ <SettingsRow+ label="Members can invite"+ description="Let every team member invite people. When off, only admins and the owner can send invites."+ hideDescriptionOnMobile+ >+ <ToggleSwitch+ size="md"+ checked={allowNonAdminInvites()}+ disabled={+ toggleNonAdminInvitesMutation.isPending ||+ teamQuery.isLoading+ }+ onChange={handleToggleNonAdminInvites}+ />+ </SettingsRow>+ </SettingsCard>+ </SettingsSection>+ </Show>+ </SettingsPage>++ <ConfirmDialog+ open={!!showRemoveModal()}+ onOpenChange={(open) => !open && setShowRemoveModal(null)}+ title="Remove Member"+ tone="danger"+ confirmLabel="Remove"+ pending={removeUserMutation.isPending}+ onConfirm={handleRemoveMember}+ body={+ <>+ Are you sure you want to remove{' '}+ <Show when={showRemoveModal()}>+ {(member) => <MemberName memberId={member().user_id} />}+ </Show>{' '}+ from the team?+ </>+ }+ />+ <ConfirmDialog+ open={!!showCancelInviteModal()}+ onOpenChange={(open) => !open && setShowCancelInviteModal(null)}+ title="Cancel Invitation"+ tone="danger"+ confirmLabel="Cancel Invite"+ cancelLabel="Keep"+ pending={deleteInviteMutation.isPending}+ onConfirm={handleCancelInvite}+ body={+ <>+ Are you sure you want to cancel the invitation for{' '}+ <span class="font-medium">{showCancelInviteModal()?.email}</span>?+ </>+ }+ />++ <InviteToTeamDialog+ teamId={props.team.id}+ open={showInviteModal()}+ onClose={() => setShowInviteModal(false)}+ />+ </>+ );+}diff --git a/apps/web/src/features/settings/components/billing-settings-view.tsx b/apps/web/src/features/settings/components/billing-settings-view.tsxindex 6c4fb75ec9..1e6d48925e 100644--- a/apps/web/src/features/settings/components/billing-settings-view.tsx+++ b/apps/web/src/features/settings/components/billing-settings-view.tsx@@ -88,7 +88,7 @@ export function BillingSettingsView(props: {each seat's plan in{' '}<aclass="text-link hover:text-link-hover"- href="/app/settings/team"+ href="/app/settings/team-members"onClick={props.onTeamSettings}>Team settings@@ -109,7 +109,7 @@ export function BillingSettingsView(props: {• set each seat's plan in{' '}<aclass="text-link hover:text-link-hover"- href="/app/settings/team"+ href="/app/settings/team-members"onClick={props.onTeamSettings}>Team settingsdiff --git a/apps/web/src/features/settings/components/settings-search-results.tsx b/apps/web/src/features/settings/components/settings-search-results.tsxindex 37517f776a..90dfe6b9e1 100644--- a/apps/web/src/features/settings/components/settings-search-results.tsx+++ b/apps/web/src/features/settings/components/settings-search-results.tsx@@ -36,11 +36,11 @@ export function SettingsSearchResults(props: {<span class="block text-sm leading-5 text-ink">{result.title}</span>- <Show when={result.title !== result.page.label}>- <span class="mt-1 block text-sm text-ink/50">- {result.page.label}- </span>- </Show>+ <span class="mt-1 block text-sm text-ink/50">+ {result.title === result.page.label+ ? result.group+ : `${result.group} · ${result.page.label}`}+ </span></span></button>)}diff --git a/apps/web/src/features/settings/components/settings-search-target.test.tsx b/apps/web/src/features/settings/components/settings-search-target.test.tsxindex a3369388d5..04af31fef4 100644--- a/apps/web/src/features/settings/components/settings-search-target.test.tsx+++ b/apps/web/src/features/settings/components/settings-search-target.test.tsx@@ -11,6 +11,7 @@ const result: SettingsSearchResult = {target: 'signatures',keywords: '',page: { tab: 'Email', label: 'Email', keywords: [], icon: () => null },+ group: 'Blocks',};afterEach(cleanup);describe('settings search navigation', () => {diff --git a/apps/web/src/features/settings/core/settings-search.test.ts b/apps/web/src/features/settings/core/settings-search.test.tsindex 9feed9e354..e2d9a65a59 100644--- a/apps/web/src/features/settings/core/settings-search.test.ts+++ b/apps/web/src/features/settings/core/settings-search.test.ts@@ -60,6 +60,22 @@ describe('individual settings search', () => {}).some((result) => result.title === 'Email signatures')).toBe(false);});+ it('finds the team members page for inviting people', () => {+ for (const query of ['invite', 'members', 'team members', 'teammates']) {+ expect(search(query)[0]).toMatchObject({+ tab: 'Team Members',+ group: 'Team',+ });+ }+ expect(search('pending invites')[0]).toMatchObject({+ tab: 'Team Members',+ target: 'pending-invites',+ });+ });+ it('finds team connections apart from personal integrations', () => {+ expect(search('slack import')[0].tab).toBe('Team Connections');+ expect(search('team github')[0].tab).toBe('Team Connections');+ });it('has no results for empty or unrelated queries', () => {expect(search(' ')).toEqual([]);expect(search('xyz123')).toEqual([]);diff --git a/apps/web/src/features/settings/core/settings-search.ts b/apps/web/src/features/settings/core/settings-search.tsindex 99d258c315..ac0cb18f8e 100644--- a/apps/web/src/features/settings/core/settings-search.ts+++ b/apps/web/src/features/settings/core/settings-search.ts@@ -15,6 +15,8 @@ type Setting = {export type SettingsSearchResult = Setting & {id: string;page: SettingsTabItem;+ /** The nav group holding the page, so `General` reads as `Team · General`. */+ group: string;};// Targets are the visible SettingsSection/SettingsRow labels, not DOM selectors.@@ -180,25 +182,29 @@ const SETTINGS: Setting[] = [keywords: 'workspace slug rename',},{- tab: 'Team',- title: 'Members',- target: 'Members',- keywords: 'invite users role permissions remove workspace team',+ tab: 'Team Members',+ title: 'Invite people',+ keywords: 'invite add teammates coworkers colleagues email join team',},{- tab: 'Team',+ tab: 'Team Members',+ title: 'Member roles',+ keywords: 'admin owner permissions remove users team',+ },+ {+ tab: 'Team Members',title: 'Pending invites',target: 'Pending invites',- keywords: 'invitations cancel resend',+ keywords: 'invitations cancel resend copy link team',},{- tab: 'Team',+ tab: 'Team Members',title: 'Auto-join on domain',target: 'Auto-join on domain',keywords: 'email workspace membership automatic',},{- tab: 'Team',+ tab: 'Team Members',title: 'Members can invite',target: 'Members can invite',keywords: 'permissions invitation',@@ -210,11 +216,17 @@ const SETTINGS: Setting[] = [keywords: 'access public private permission',},{- tab: 'Team',+ tab: 'Team Connections',title: 'Team GitHub connection',target: 'Connections',keywords: 'repository app install integration',},+ {+ tab: 'Team Connections',+ title: 'Import from Slack',+ target: 'Connections',+ keywords: 'slack export channels messages history team',+ },{tab: 'Tags',title: 'Personal tags',@@ -307,14 +319,17 @@ export function searchSettings(): SettingsSearchResult[] {const tokens = words(query);if (!tokens.length) return [];- const pages = groups.flatMap((group) => group.items);- const entries = pages.flatMap((page) => [+ const pages = groups.flatMap((group) =>+ group.items.map((page) => ({ page, group: group.label }))+ );+ const entries = pages.flatMap(({ page, group }) => [{id: page.tab,tab: page.tab,title: page.label,keywords: page.keywords.join(' '),page,+ group,},...SETTINGS.filter((setting) =>@@ -326,6 +341,7 @@ export function searchSettings(target: settingsTarget(setting.target),id: `${page.tab}:${setting.title}`,page,+ group,})),]);return entriesdiff --git a/apps/web/src/features/settings/teamSettingsGroups.test.ts b/apps/web/src/features/settings/teamSettingsGroups.test.tsnew file mode 100644index 0000000000..a1960fbdc8--- /dev/null+++ b/apps/web/src/features/settings/teamSettingsGroups.test.ts@@ -0,0 +1,53 @@+import { SETTINGS_TAB_GROUPS } from '@core/constant/settingsTabsConfig';+import { createRoot } from 'solid-js';+import { createStore } from 'solid-js/store';+import { afterEach, describe, expect, it, vi } from 'vitest';+import { useTeamSettingsGroups } from './teamSettingsGroups';++const [teamsQuery, setTeamsQuery] = createStore<{+ isSuccess: boolean;+ data: { name: string }[] | undefined;+}>({ isSuccess: false, data: undefined });++vi.mock('@queries/team/teams', () => ({+ useUserTeamsQuery: () => teamsQuery,+}));++let dispose: () => void;+afterEach(() => dispose?.());++const teamGroup = () =>+ createRoot((cleanup) => {+ dispose = cleanup;+ const groups = useTeamSettingsGroups(() => SETTINGS_TAB_GROUPS);+ return () => groups()[0];+ });++describe('team settings group', () => {+ it('names the group after the team and lists every team page', () => {+ setTeamsQuery({ isSuccess: true, data: [{ name: 'Macro' }] });+ const group = teamGroup();+ expect(group().label).toBe('Team · Macro');+ expect(group().items.map((item) => item.label)).toEqual([+ 'General',+ 'Members',+ 'Connections',+ ]);+ });++ it('keeps only the create-team page without a team', () => {+ setTeamsQuery({ isSuccess: true, data: [] });+ const group = teamGroup();+ expect(group().label).toBe('Team');+ expect(group().items.map((item) => item.tab)).toEqual(['Team']);+ });++ it('keeps every page while teams load', () => {+ setTeamsQuery({ isSuccess: false, data: undefined });+ const group = teamGroup();+ expect(group().label).toBe('Team');+ expect(group().items).toHaveLength(3);+ setTeamsQuery({ isSuccess: true, data: [{ name: 'Acme' }] });+ expect(group().label).toBe('Team · Acme');+ });+});diff --git a/apps/web/src/features/settings/teamSettingsGroups.ts b/apps/web/src/features/settings/teamSettingsGroups.tsnew file mode 100644index 0000000000..b136c06382--- /dev/null+++ b/apps/web/src/features/settings/teamSettingsGroups.ts@@ -0,0 +1,29 @@+import {+ type SettingsTabGroup,+ TEAM_SETTINGS_GROUP_LABEL,+} from '@core/constant/settingsTabsConfig';+import { useUserTeamsQuery } from '@queries/team/teams';+import { type Accessor, createMemo } from 'solid-js';++/**+ * Names the settings nav's team group after the viewer's team+ * (`Team · Macro`). Without a team only General stays, where the create-team+ * prompt and pending invitations live.+ */+export function useTeamSettingsGroups(groups: Accessor<SettingsTabGroup[]>) {+ const userTeamsQuery = useUserTeamsQuery();+ return createMemo(() => {+ // Keep every page while teams load so the nav doesn't jump.+ const teams = userTeamsQuery.isSuccess ? userTeamsQuery.data : undefined;+ return groups().map((group) => {+ if (group.label !== TEAM_SETTINGS_GROUP_LABEL || !teams) return group;+ const team = teams[0];+ return team+ ? { ...group, label: `${group.label} · ${team.name}` }+ : {+ ...group,+ items: group.items.filter((item) => item.tab === 'Team'),+ };+ });+ });+}diff --git a/apps/web/src/lib/core/constant/SettingsState.tsx b/apps/web/src/lib/core/constant/SettingsState.tsxindex 17a3a9b50b..8e47bc1152 100644--- a/apps/web/src/lib/core/constant/SettingsState.tsx+++ b/apps/web/src/lib/core/constant/SettingsState.tsx@@ -32,6 +32,8 @@ export type SettingsTab =| 'Harness'| 'Bots'| 'Team'+ | 'Team Members'+ | 'Team Connections'| 'Tags'| 'CRM'| 'Connected'diff --git a/apps/web/src/lib/core/constant/settingsTabsConfig.test.ts b/apps/web/src/lib/core/constant/settingsTabsConfig.test.tsindex 3ce65a8e84..a78afd9e39 100644--- a/apps/web/src/lib/core/constant/settingsTabsConfig.test.ts+++ b/apps/web/src/lib/core/constant/settingsTabsConfig.test.ts@@ -30,9 +30,22 @@ describe('settings navigation', () => {expect(settingsSlugToTab('connections')).toBe('Connected');});- it('groups blocks first and separates account and agent integrations', () => {- expect(SETTINGS_TAB_GROUPS[0].label).toBe('Blocks');+ it('puts team settings first, with members on their own page', () => {+ expect(SETTINGS_TAB_GROUPS[0].label).toBe('Team');expect(SETTINGS_TAB_GROUPS[0].items.map((item) => item.tab)).toEqual([+ 'Team',+ 'Team Members',+ 'Team Connections',+ ]);+ // Old team links keep opening the team's general page.+ expect(settingsSlugToTab('team')).toBe('Team');+ expect(settingsSlugToTab('team-members')).toBe('Team Members');+ expect(settingsSlugToTab('team-connections')).toBe('Team Connections');+ });++ it('groups blocks after the team and separates account and agent integrations', () => {+ expect(SETTINGS_TAB_GROUPS[1].label).toBe('Blocks');+ expect(SETTINGS_TAB_GROUPS[1].items.map((item) => item.tab)).toEqual(['Email','Calendar','Agents',diff --git a/apps/web/src/lib/core/constant/settingsTabsConfig.tsx b/apps/web/src/lib/core/constant/settingsTabsConfig.tsxindex 1c33eaa679..145159d370 100644--- a/apps/web/src/lib/core/constant/settingsTabsConfig.tsx+++ b/apps/web/src/lib/core/constant/settingsTabsConfig.tsx@@ -19,6 +19,7 @@ import AgentIcon from '@phosphor/sparkle.svg';import SwatchesIcon from '@phosphor/swatches.svg';import TagIcon from '@phosphor/tag-simple.svg';import UserIconPhosphor from '@phosphor/user.svg';+import UsersIcon from '@phosphor/users.svg';import UsersThreeIcon from '@phosphor/users-three.svg';import { type Component, createMemo } from 'solid-js';import { useHasPermission } from '../context/user';@@ -52,6 +53,12 @@ export type SettingsTabItem = {searchOnly?: boolean;};+/**+ * The team group's static label. The settings nav appends the team's name+ * (`Team · Macro`); search and tests match on this label.+ */+export const TEAM_SETTINGS_GROUP_LABEL = 'Team';+export type SettingsTabGroup = {label: string;items: SettingsTabItem[];@@ -68,6 +75,37 @@ export type SettingsTabGroup = {* one definition.*/export const SETTINGS_TAB_GROUPS: SettingsTabGroup[] = [+ {+ label: TEAM_SETTINGS_GROUP_LABEL,+ items: [+ {+ tab: 'Team',+ label: 'General',+ icon: UsersThreeIcon,+ keywords: ['team', 'workspace', 'organization', 'name', 'slug'],+ },+ {+ tab: 'Team Members',+ label: 'Members',+ icon: UsersIcon,+ keywords: [+ 'team',+ 'invite',+ 'people',+ 'users',+ 'teammates',+ 'roles',+ 'seats',+ ],+ },+ {+ tab: 'Team Connections',+ label: 'Connections',+ icon: PlugIcon,+ keywords: ['team', 'slack', 'github', 'import', 'app'],+ },+ ],+ },{label: 'Blocks',items: [@@ -153,12 +191,6 @@ export const SETTINGS_TAB_GROUPS: SettingsTabGroup[] = [{label: 'Workspace',items: [- {- tab: 'Team',- label: 'Team',- icon: UsersThreeIcon,- keywords: ['members', 'users', 'workspace'],- },{tab: 'Tags',label: 'Tags',@@ -240,6 +272,8 @@ const SETTINGS_TAB_SLUGS: Record<SettingsTab, string> = {Harness: 'runtimes',Bots: 'bots',Team: 'team',+ 'Team Members': 'team-members',+ 'Team Connections': 'team-connections',Calendar: 'calendar',Tags: 'tags',CRM: 'crm',@@ -301,6 +335,8 @@ export const useSettingsTabAvailable = () => {case 'API Keys':return !isMobile();case 'Team':+ case 'Team Members':+ case 'Team Connections':case 'Tags':return true;// CRM is still rolling out (Macro-internal only); keep the settings tabdiff --git a/docs/agent-guide/settings.md b/docs/agent-guide/settings.mdindex 83d0d57870..e9326a88e6 100644--- a/docs/agent-guide/settings.md+++ b/docs/agent-guide/settings.md@@ -135,8 +135,9 @@ enterprise teams retain their billing bypass.On a local stack started with `--no-doppler`, verify free-team creation from afresh passwordless signup. It must work without Stripe credentials.-Under **Team**, owners/admins can turn **Auto-join on domain** off and can restrict-invitations to admins with **Members can invite**. These controls still apply.+Under **Team → Members** (**Invite settings**), owners/admins can turn+**Auto-join on domain** off and can restrict invitations to admins with+**Members can invite**. These controls still apply.To verify the membership flow, use a local free team with five members: inviteand accept a sixth member, then sign up another user on its enabled auto-joindomain. Both should appear in the team's member list and configured auto-join@@ -146,7 +147,7 @@ same-domain signup is not added automatically.### NavigationOn phones, **More views → Settings** opens an inset glass sheet over the current-page. The main page has a profile shortcut and the same grouped Blocks, Personal, Workspace,+page. The main page has a profile shortcut and the same grouped Team, Blocks, Personal, Workspace,and Developer sections as desktop, plus enabled admin settings. Search findsindividual settings; selecting a result opens its page and reveals the section. Tap a row to open that settingspage inside the sheet; **Back to settings** returns to the grouped list at its@@ -213,9 +214,16 @@ seconds (pointer, or Space/Enter); releasing early cancels.Left nav (feature and platform gates still apply):+- **Team · <team name>** (just **Team** without a team): General (name, slug,+ GitHub autolink, default link sharing, Delete Team), Members (member list,+ roles and seat plans, **Invite**, pending invites, auto-join and+ members-can-invite), Connections (Slack import, GitHub App). Without a team+ only General shows, with pending invitations or **Create Team**. Search+ finds these by `invite`, `members`, `teammates`, `slack`, and similar terms;+ results name their group, e.g. **Team · Members**.- **Blocks**: Email, Calendar, Agents, CRM.- **Personal**: Account, Appearance, Notifications, Keyboard shortcuts, Usage, Billing, Desktop App, Mobile App.-- **Workspace**: Team, Tags, Integrations (personal Gmail/GitHub accounts).+- **Workspace**: Tags, Integrations (personal Gmail/GitHub accounts).- **Developer**: Agent connections, Runtimes, MCP server, API Keys, Bots.**Desktop App** (`/app/settings/desktop-app`) is titled@@ -426,7 +434,7 @@ Max stays active until renewal; **Keep Max plan** cancels a pending downgradewithout resetting usage. Failed renewal-detail reads offer **Try again**.Team members who cannot manage billing see the notice without its action.-`Team` (members list; on a paid team each row shows the seat's plan,+`Team → Members` (`/app/settings/team-members`; on a paid team each row shows the seat's plan,and admins/owners can move a seat between Pro and Max with the `Seat plan`menu; Max upgrades are immediate and prorated, Pro downgrades start at renewal.**Keep Max** appears only for a confirmed pending downgrade and cancels it;