Skip to content

Commit 4540c41

Browse files
committed
improvement(ui): expand settings modal, remove teams tab for users that don't have access
1 parent 09bbf1d commit 4540c41

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

sim/app/w/components/sidebar/components/settings-modal/components/settings-navigation/settings-navigation.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ interface SettingsNavigationProps {
77
onSectionChange: (
88
section: 'general' | 'environment' | 'account' | 'credentials' | 'apikeys' | 'subscription' | 'team'
99
) => void
10+
isTeam?: boolean
1011
}
1112

1213
type NavigationItem = {
1314
id: 'general' | 'environment' | 'account' | 'credentials' | 'apikeys' | 'subscription' | 'team'
1415
label: string
1516
icon: React.ComponentType<{ className?: string }>
1617
hideInDev?: boolean
18+
requiresTeam?: boolean
1719
}
1820

1921
const allNavigationItems: NavigationItem[] = [
@@ -53,14 +55,22 @@ const allNavigationItems: NavigationItem[] = [
5355
label: 'Team',
5456
icon: Users,
5557
hideInDev: true,
58+
requiresTeam: true,
5659
},
5760
]
5861

59-
export function SettingsNavigation({ activeSection, onSectionChange }: SettingsNavigationProps) {
62+
export function SettingsNavigation({ activeSection, onSectionChange, isTeam = false }: SettingsNavigationProps) {
6063
const navigationItems = allNavigationItems.filter(item => {
64+
// Hide items based on development environment
6165
if (item.hideInDev && isDev) {
6266
return false
6367
}
68+
69+
// Hide team tab if user doesn't have team subscription
70+
if (item.requiresTeam && !isTeam) {
71+
return false
72+
}
73+
6474
return true
6575
})
6676

sim/app/w/components/sidebar/components/settings-modal/settings-modal.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ export function SettingsModal({ open, onOpenChange }: SettingsModalProps) {
5353
if (response.ok) {
5454
const data = await response.json()
5555
setIsTeam(data.isTeam)
56+
57+
if (!data.isTeam && activeSection === 'team') {
58+
setActiveSection('general')
59+
}
5660
}
5761
} catch (error) {
5862
logger.error('Error checking team plan:', error)
@@ -62,14 +66,14 @@ export function SettingsModal({ open, onOpenChange }: SettingsModalProps) {
6266
if (open) {
6367
checkTeamPlan()
6468
}
65-
}, [open])
69+
}, [open, activeSection])
6670

6771
// Check if subscriptions are enabled
6872
const isSubscriptionEnabled = !!client.subscription
6973

7074
return (
7175
<Dialog open={open} onOpenChange={onOpenChange}>
72-
<DialogContent className="sm:max-w-[700px] h-[64vh] flex flex-col p-0 gap-0" hideCloseButton>
76+
<DialogContent className="sm:max-w-[800px] h-[70vh] flex flex-col p-0 gap-0" hideCloseButton>
7377
<DialogHeader className="px-6 py-4 border-b">
7478
<div className="flex items-center justify-between">
7579
<DialogTitle className="text-lg font-medium">Settings</DialogTitle>
@@ -88,7 +92,11 @@ export function SettingsModal({ open, onOpenChange }: SettingsModalProps) {
8892
<div className="flex flex-1 min-h-0">
8993
{/* Navigation Sidebar */}
9094
<div className="w-[200px] border-r">
91-
<SettingsNavigation activeSection={activeSection} onSectionChange={setActiveSection} />
95+
<SettingsNavigation
96+
activeSection={activeSection}
97+
onSectionChange={setActiveSection}
98+
isTeam={isTeam}
99+
/>
92100
</div>
93101

94102
{/* Content Area */}

0 commit comments

Comments
 (0)