-
Notifications
You must be signed in to change notification settings - Fork 878
chore: clean up groups page #16259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: clean up groups page #16259
Changes from 1 commit
3928c9f
6ad8d8a
3edd915
7791f86
9dccf36
afed20d
9d4c705
6679635
95f295c
eea6cf6
e0521c8
ed8e84f
670ef77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
import { useAuthenticated } from "contexts/auth/RequireAuth"; | ||
import type { FC } from "react"; | ||
import { DeploymentSidebarView } from "./DeploymentSidebarView"; | ||
import { useDashboard } from "modules/dashboard/useDashboard"; | ||
|
||
/** | ||
* A sidebar for deployment settings. | ||
*/ | ||
export const DeploymentSidebar: FC = () => { | ||
const { permissions } = useAuthenticated(); | ||
const { entitlements, showOrganizations } = useDashboard(); | ||
const hasPremiumLicense = | ||
entitlements.features.multiple_organizations.enabled; | ||
|
||
return <DeploymentSidebarView permissions={permissions} />; | ||
return ( | ||
<DeploymentSidebarView | ||
permissions={permissions} | ||
showOrganizations={showOrganizations} | ||
hasPremiumLicense={hasPremiumLicense} | ||
/> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,18 @@ | ||
import type { AuthorizationResponse, Organization } from "api/typesGenerated"; | ||
import { FeatureStageBadge } from "components/FeatureStageBadge/FeatureStageBadge"; | ||
import { | ||
Sidebar as BaseSidebar, | ||
SettingsSidebarNavItem as SidebarNavItem, | ||
} from "components/Sidebar/Sidebar"; | ||
import { Stack } from "components/Stack/Stack"; | ||
import type { Permissions } from "contexts/auth/permissions"; | ||
import { useFeatureVisibility } from "modules/dashboard/useFeatureVisibility"; | ||
import { ArrowUpRight } from "lucide-react"; | ||
import type { FC } from "react"; | ||
|
||
export interface OrganizationWithPermissions extends Organization { | ||
permissions: AuthorizationResponse; | ||
} | ||
|
||
interface DeploymentSidebarProps { | ||
/** Site-wide permissions. */ | ||
permissions: Permissions; | ||
} | ||
|
||
/** | ||
* A combined deployment settings and organization menu. | ||
*/ | ||
export const DeploymentSidebarView: FC<DeploymentSidebarProps> = ({ | ||
permissions, | ||
}) => { | ||
const { multiple_organizations: hasPremiumLicense } = useFeatureVisibility(); | ||
|
||
return ( | ||
<BaseSidebar> | ||
<DeploymentSettingsNavigation | ||
permissions={permissions} | ||
isPremium={hasPremiumLicense} | ||
/> | ||
</BaseSidebar> | ||
); | ||
}; | ||
|
||
interface DeploymentSettingsNavigationProps { | ||
interface DeploymentSidebarViewProps { | ||
/** Site-wide permissions. */ | ||
permissions: Permissions; | ||
isPremium: boolean; | ||
showOrganizations: boolean; | ||
hasPremiumLicense: boolean; | ||
} | ||
|
||
/** | ||
|
@@ -48,12 +22,13 @@ interface DeploymentSettingsNavigationProps { | |
* Menu items are shown based on the permissions. If organizations can be | ||
* viewed, groups are skipped since they will show under each org instead. | ||
*/ | ||
const DeploymentSettingsNavigation: FC<DeploymentSettingsNavigationProps> = ({ | ||
export const DeploymentSidebarView: FC<DeploymentSidebarViewProps> = ({ | ||
permissions, | ||
isPremium, | ||
showOrganizations, | ||
hasPremiumLicense, | ||
}) => { | ||
return ( | ||
<div> | ||
<BaseSidebar> | ||
<div className="flex flex-col gap-1"> | ||
{permissions.viewDeploymentValues && ( | ||
<SidebarNavItem href="/deployment/general">General</SidebarNavItem> | ||
|
@@ -100,7 +75,11 @@ const DeploymentSettingsNavigation: FC<DeploymentSettingsNavigationProps> = ({ | |
<SidebarNavItem href="/deployment/users">Users</SidebarNavItem> | ||
)} | ||
{permissions.viewAnyGroup && ( | ||
<SidebarNavItem href="/deployment/groups">Groups</SidebarNavItem> | ||
<SidebarNavItem href="/deployment/groups"> | ||
<Stack direction="row" alignItems="center" spacing={0.5}> | ||
Groups {showOrganizations && <ArrowUpRight size={16} />} | ||
</Stack> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there some precedent for using ArrowUpRight to convey this type of meaning? Did you get some feedback from christin? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was imagining something a bit more explicit to let users know they are be taken to the default organization There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm just trying something new, and keep hearing about how she's already busy enough. If we don't like it we can change it later. 😅 |
||
</SidebarNavItem> | ||
)} | ||
{permissions.viewNotificationTemplate && ( | ||
<SidebarNavItem href="/deployment/notifications"> | ||
|
@@ -115,10 +94,10 @@ const DeploymentSettingsNavigation: FC<DeploymentSettingsNavigationProps> = ({ | |
IdP Organization Sync | ||
</SidebarNavItem> | ||
)} | ||
{!isPremium && ( | ||
{!hasPremiumLicense && ( | ||
<SidebarNavItem href="/deployment/premium">Premium</SidebarNavItem> | ||
)} | ||
</div> | ||
</div> | ||
</BaseSidebar> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With your changes here, when I navigate to
/organizations/coder/
from another route, none of the left side bar menu items are highlighted by default. Members should be active by default. This was the reason for the useMatch workaround