Skip to content

feat: add redesigned organization settings sidebar #15932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b9ff0fa
wip
jaaydenh Oct 2, 2024
aab755d
fix
jaaydenh Oct 15, 2024
85ee8a2
wip
jaaydenh Oct 16, 2024
e556af9
revert css
jaaydenh Oct 16, 2024
4904c03
feat: changes for premium page
jaaydenh Oct 30, 2024
e99c314
feat: implement Premium page with Tailwind and shadcn button
jaaydenh Nov 1, 2024
c5696cc
chore: updates to button styles
jaaydenh Nov 1, 2024
8f295b0
chore: update variant
jaaydenh Nov 1, 2024
1474b5e
chore: move CacheProvider to ThemeProvider
jaaydenh Nov 1, 2024
1db3f36
chore: update paths for shadcn
jaaydenh Nov 1, 2024
cc0a52f
feat: show premium tab if no premium license
jaaydenh Nov 3, 2024
65f980b
fix: fix format
jaaydenh Nov 3, 2024
1388f77
fix: remove fontSize
jaaydenh Nov 5, 2024
377c711
feat: initial commit to setup redesign orgs sidebar
jaaydenh Dec 18, 2024
92d35ce
fix: remove margin left
jaaydenh Dec 18, 2024
e5cb90d
fix: e2e test fixes
jaaydenh Dec 19, 2024
8ada640
chore: improve styles
jaaydenh Dec 19, 2024
6a1bf43
chore: cleanup OrganizationSidebar
jaaydenh Dec 19, 2024
d626c6d
chore: updates to create organization page
jaaydenh Dec 20, 2024
7581c4e
fix: fix test
jaaydenh Jan 2, 2025
ea58488
fix: format
jaaydenh Jan 2, 2025
4c7a5c9
chore: if only one org, don't show in dropdown
jaaydenh Jan 2, 2025
4361c5c
chore: update for mobile
jaaydenh Jan 3, 2025
7d6974d
fix: remove link for organization breadcrumb
jaaydenh Jan 3, 2025
d052c40
feat: improve design of create organization page
jaaydenh Jan 3, 2025
51d84e2
feat: truncate long organization names
jaaydenh Jan 3, 2025
b6f9e4d
chore: update styling for premium banner
jaaydenh Jan 3, 2025
afe7b50
fix: handle display of more than 6 orgs
jaaydenh Jan 3, 2025
b0d7c4a
feat: add story
jaaydenh Jan 3, 2025
e2dbc31
fix: improve outline display
jaaydenh Jan 3, 2025
35788c0
fix: do not wrap command item with link
jaaydenh Jan 4, 2025
5d423d9
chore: cleanup
jaaydenh Jan 4, 2025
77f70b9
fix: replace create org button with command item
jaaydenh Jan 4, 2025
43690ad
fix: do not highlight background on selected
jaaydenh Jan 7, 2025
14ba63f
fix: ensure the popover closes when navigating to a new page
jaaydenh Jan 8, 2025
f029bb4
chore: cleanup
jaaydenh Jan 8, 2025
ab15e75
fix: format
jaaydenh Jan 8, 2025
b66bb79
fix: test
jaaydenh Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion site/e2e/tests/organizationGroups.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test("create group", async ({ page }) => {
await page.goto(`/organizations/${org.name}`);

// Navigate to groups page
await page.getByText("Groups").click();
await page.getByRole("link", { name: "Groups" }).click();
await expect(page).toHaveTitle(`Groups - Org ${org.name} - Coder`);

// Create a new group
Expand Down
2 changes: 1 addition & 1 deletion site/e2e/tests/organizationMembers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test("add and remove organization member", async ({ page }) => {
const { displayName } = await createOrganization(page);

// Navigate to members page
await page.getByText("Members").click();
await page.getByRole("link", { name: "Members" }).click();
await expect(page).toHaveTitle(`Members - ${displayName} - Coder`);

// Add a user to the org
Expand Down
12 changes: 11 additions & 1 deletion site/e2e/tests/organizations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,25 @@ test("create and delete organization", async ({ page }) => {
await expectUrl(page).toHavePathName(`/organizations/${name}`);
await expect(page.getByText("Organization created.")).toBeVisible();

await page.goto(`/organizations/${name}/settings`, {
waitUntil: "domcontentloaded",
});

const newName = randomName();
await page.getByLabel("Slug").fill(newName);
await page.getByLabel("Description").fill(`Org description ${newName}`);
await page.getByRole("button", { name: /save/i }).click();

// Expect to be redirected when renaming the organization
await expectUrl(page).toHavePathName(`/organizations/${newName}`);
await expectUrl(page).toHavePathName(`/organizations/${newName}/settings`);
await expect(page.getByText("Organization settings updated.")).toBeVisible();

await page.goto(`/organizations/${newName}/settings`, {
waitUntil: "domcontentloaded",
});
// Expect to be redirected when renaming the organization
await expectUrl(page).toHavePathName(`/organizations/${newName}/settings`);

await page.getByRole("button", { name: "Delete this organization" }).click();
const dialog = page.getByTestId("dialog");
await dialog.getByLabel("Name").fill(newName);
Expand Down
6 changes: 3 additions & 3 deletions site/src/components/Command/Command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const CommandList = forwardRef<
>(({ className, ...props }, ref) => (
<CommandPrimitive.List
ref={ref}
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
className={cn("max-h-96 overflow-y-auto overflow-x-hidden", className)}
{...props}
/>
));
Expand All @@ -92,7 +92,7 @@ export const CommandGroup = forwardRef<
<CommandPrimitive.Group
ref={ref}
className={cn(
`overflow-hidden p-1 text-content-primary
`overflow-hidden p-2 text-content-primary
[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs
[&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-content-secondary`,
className,
Expand All @@ -119,7 +119,7 @@ export const CommandItem = forwardRef<
<CommandPrimitive.Item
ref={ref}
className={cn(
`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none
`relative flex cursor-default gap-2 select-none text-content-secondary items-center rounded-sm px-2 py-2 text-sm font-medium outline-none
data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50
data-[selected=true]:bg-surface-secondary data-[selected=true]:text-content-primary
[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const PopoverContent = forwardRef<
align={align}
sideOffset={sideOffset}
className={cn(
`z-50 w-72 rounded-md border border-solid bg-surface-primary p-4
`z-50 w-72 rounded-md border border-solid bg-surface-primary
text-content-primary shadow-md outline-none
data-[state=open]:animate-in data-[state=closed]:animate-out
data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const SettingsSidebarNavItem: FC<SettingsSidebarNavItemProps> = ({
to={href}
className={({ isActive }) =>
cn(
"relative text-sm text-content-secondary no-underline font-medium py-2 px-3 hover:bg-surface-secondary rounded-md transition ease-in-out duration-150 ",
"relative text-sm text-content-secondary no-underline font-medium py-2 px-3 hover:bg-surface-secondary rounded-md transition ease-in-out duration-150",
{
"font-semibold text-content-primary": isActive,
},
Expand Down
4 changes: 2 additions & 2 deletions site/src/modules/management/DeploymentSettingsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const DeploymentSettingsLayout: FC = () => {
</BreadcrumbList>
</Breadcrumb>
<hr className="h-px border-none bg-border" />
<div className="px-6 max-w-screen-2xl">
<div className="flex flex-row gap-12 py-10">
<div className="px-10 max-w-screen-2xl">
<div className="flex flex-row gap-28 py-10">
<DeploymentSidebar />
<main css={{ flexGrow: 1 }}>
<Suspense fallback={<Loader />}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { withDashboardProvider } from "testHelpers/storybook";
import { DeploymentSidebarView } from "./DeploymentSidebarView";

const meta: Meta<typeof DeploymentSidebarView> = {
title: "modules/management/SidebarView",
title: "modules/management/DeploymentSidebarView",
component: DeploymentSidebarView,
decorators: [withDashboardProvider],
parameters: { showOrganizations: true },
Expand Down
21 changes: 6 additions & 15 deletions site/src/modules/management/OrganizationSettingsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { RequirePermission } from "contexts/auth/RequirePermission";
import { useDashboard } from "modules/dashboard/useDashboard";
import { type FC, Suspense, createContext, useContext } from "react";
import { Outlet, useParams } from "react-router-dom";
import { OrganizationSidebar } from "./OrganizationSidebar";

export const OrganizationSettingsContext = createContext<
OrganizationSettingsValue | undefined
Expand Down Expand Up @@ -82,13 +81,10 @@ const OrganizationSettingsLayout: FC = () => {
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink
href="/organizations"
className="flex items-center gap-2"
>
<BreadcrumbPage className="flex items-center gap-2">
Organizations
<FeatureStageBadge contentType="beta" size="sm" />
</BreadcrumbLink>
</BreadcrumbPage>
</BreadcrumbItem>
{organization && (
<>
Expand All @@ -109,15 +105,10 @@ const OrganizationSettingsLayout: FC = () => {
</BreadcrumbList>
</Breadcrumb>
<hr className="h-px border-none bg-border" />
<div className="px-6 max-w-screen-2xl">
<div className="flex flex-row gap-12 py-10">
<OrganizationSidebar />
<main css={{ flexGrow: 1 }}>
<Suspense fallback={<Loader />}>
<Outlet />
</Suspense>
</main>
</div>
<div className="px-10 max-w-screen-2xl">
<Suspense fallback={<Loader />}>
<Outlet />
</Suspense>
</div>
</div>
</OrganizationSettingsContext.Provider>
Expand Down
4 changes: 3 additions & 1 deletion site/src/modules/management/OrganizationSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ export const OrganizationSidebar: FC = () => {
return canEditOrganization(org.permissions);
});

const organization = editableOrgs?.find((o) => o.name === organizationName);

return (
<OrganizationSidebarView
activeOrganizationName={organizationName}
activeOrganization={organization}
organizations={editableOrgs}
permissions={permissions}
/>
Expand Down
19 changes: 19 additions & 0 deletions site/src/modules/management/OrganizationSidebarLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Loader } from "components/Loader/Loader";
import { type FC, Suspense } from "react";
import { Outlet } from "react-router-dom";
import { OrganizationSidebar } from "./OrganizationSidebar";

const OrganizationSidebarLayout: FC = () => {
return (
<div className="flex flex-row gap-28 py-10">
<OrganizationSidebar />
<main css={{ flexGrow: 1 }}>
<Suspense fallback={<Loader />}>
<Outlet />
</Suspense>
</main>
</div>
);
};

export default OrganizationSidebarLayout;
Loading
Loading