Skip to content

Commit c304463

Browse files
committed
padding and cleanup
1 parent 325148c commit c304463

File tree

5 files changed

+54
-17
lines changed

5 files changed

+54
-17
lines changed

site/src/components/Margins/Margins.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,15 @@ const widthBySize: Record<Size, number> = {
1313
small: containerWidth / 3,
1414
};
1515

16-
export const Margins: FC<JSX.IntrinsicElements["div"] & { size?: Size }> = ({
16+
type MarginsProps = JSX.IntrinsicElements["div"] & {
17+
size?: Size;
18+
verticalMargin?: string | number;
19+
};
20+
21+
export const Margins: FC<MarginsProps> = ({
1722
size = "regular",
23+
verticalMargin = 0,
24+
children,
1825
...divProps
1926
}) => {
2027
const maxWidth = widthBySize[size];
@@ -27,6 +34,9 @@ export const Margins: FC<JSX.IntrinsicElements["div"] & { size?: Size }> = ({
2734
padding: `0 ${sidePadding}px`,
2835
width: "100%",
2936
}}
30-
/>
37+
style={{ marginTop: verticalMargin, marginBottom: verticalMargin }}
38+
>
39+
{children}
40+
</div>
3141
);
3242
};

site/src/modules/dashboard/Navbar/DeploymentDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const DeploymentDropdownContent: FC<DeploymentDropdownProps> = ({
101101
Settings
102102
</MenuItem>
103103
)}
104-
{canViewDeployment && (
104+
{canViewOrganizations && (
105105
<MenuItem
106106
component={NavLink}
107107
to="/organizations"

site/src/pages/DeploySettingsPage/Sidebar.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ export const Sidebar: FC = () => {
2323
<SidebarNavItem href="licenses" icon={ApprovalIcon}>
2424
Licenses
2525
</SidebarNavItem>
26-
<SidebarNavItem href="teams" icon={TeamsIcon}>
27-
Teams
28-
</SidebarNavItem>
2926
<SidebarNavItem href="appearance" icon={Brush}>
3027
Appearance
3128
</SidebarNavItem>

site/src/pages/OrganizationSettingsPage/OrganizationSettingsPage.tsx

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,45 @@ import {
77
deleteOrganization,
88
} from "api/queries/organizations";
99
import { myOrganizations } from "api/queries/users";
10+
import { Margins } from "components/Margins/Margins";
11+
import { ErrorAlert } from "components/Alert/ErrorAlert";
1012

11-
const TeamsSettingsPage: FC = () => {
13+
const OrganizationSettingsPage: FC = () => {
1214
const queryClient = useQueryClient();
13-
const addTeamMutation = useMutation(createOrganization(queryClient));
14-
const deleteTeamMutation = useMutation(deleteOrganization(queryClient));
15+
const addOrganizationMutation = useMutation(createOrganization(queryClient));
16+
const deleteOrganizationMutation = useMutation(
17+
deleteOrganization(queryClient),
18+
);
1519
const organizationsQuery = useQuery(myOrganizations());
1620
const [newOrgName, setNewOrgName] = useState("");
21+
22+
const error =
23+
addOrganizationMutation.error ?? deleteOrganizationMutation.error;
24+
1725
return (
18-
<>
26+
<Margins verticalMargin={48}>
27+
{Boolean(error) && <ErrorAlert error={error} />}
28+
1929
<TextField
2030
label="New organization name"
2131
onChange={(event) => setNewOrgName(event.target.value)}
2232
/>
23-
<p>{String(addTeamMutation.error)}</p>
24-
<Button onClick={() => addTeamMutation.mutate({ name: newOrgName })}>
33+
<Button
34+
onClick={() => addOrganizationMutation.mutate({ name: newOrgName })}
35+
>
2536
add new team
2637
</Button>
2738

28-
<div>{String(deleteTeamMutation.error)}</div>
29-
3039
{organizationsQuery.data?.map((org) => (
3140
<div key={org.id}>
3241
{org.name}{" "}
33-
<Button onClick={() => deleteTeamMutation.mutate(org.id)}>
42+
<Button onClick={() => deleteOrganizationMutation.mutate(org.id)}>
3443
Delete
3544
</Button>
3645
</div>
3746
))}
38-
</>
47+
</Margins>
3948
);
4049
};
4150

42-
export default TeamsSettingsPage;
51+
export default OrganizationSettingsPage;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import GeneralIcon from "@mui/icons-material/SettingsOutlined";
2+
import type { FC } from "react";
3+
import type { Template } from "api/typesGenerated";
4+
import {
5+
Sidebar as BaseSidebar,
6+
SidebarNavItem,
7+
} from "components/Sidebar/Sidebar";
8+
9+
interface SidebarProps {
10+
template: Template;
11+
}
12+
13+
export const Sidebar: FC<SidebarProps> = ({ template }) => {
14+
return (
15+
<BaseSidebar>
16+
<SidebarNavItem href="" icon={GeneralIcon}>
17+
General
18+
</SidebarNavItem>
19+
</BaseSidebar>
20+
);
21+
};

0 commit comments

Comments
 (0)