Skip to content

Commit 784ea5b

Browse files
committed
refactor(web): streamline sidebar items and optimize icon imports in routing components
1 parent fcdc746 commit 784ea5b

4 files changed

Lines changed: 57 additions & 59 deletions

File tree

apps/web/src/components/app-header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import BookOpen from "lucide-react/icons/book-open";
12
import Bot from "lucide-react/icons/bot";
23
import Building from "lucide-react/icons/building";
3-
import BookOpen from "lucide-react/icons/book-open";
44
import Settings from "lucide-react/icons/settings";
55
import { Link } from "react-router";
66

apps/web/src/components/org-layout.tsx

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,70 @@
11
import type { OrganizationInfo } from "@dafthunk/types";
2+
import {
3+
Database,
4+
KeyRound,
5+
LayoutDashboard,
6+
Lock,
7+
Logs,
8+
SquareTerminal,
9+
Target,
10+
Users,
11+
} from "lucide-react";
212
import React, { useEffect } from "react";
313
import { useParams } from "react-router";
414

515
import { useAuth } from "@/components/auth-context";
616
import { AppLayout } from "@/components/layouts/app-layout";
7-
import { getDashboardSidebarItems } from "@/routes";
817
import { useOrganizations } from "@/services/organizations-service";
918

1019
interface OrgLayoutProps {
1120
children: React.ReactNode;
1221
title: string;
1322
}
1423

24+
export const getDashboardSidebarItems = (orgHandle: string) => [
25+
{
26+
title: "Dashboard",
27+
url: `/org/${orgHandle}/dashboard`,
28+
icon: LayoutDashboard,
29+
},
30+
{
31+
title: "Workflows",
32+
url: `/org/${orgHandle}/workflows`,
33+
icon: SquareTerminal,
34+
},
35+
36+
{
37+
title: "Datasets",
38+
url: `/org/${orgHandle}/datasets`,
39+
icon: Database,
40+
},
41+
{
42+
title: "Secrets",
43+
url: `/org/${orgHandle}/secrets`,
44+
icon: Lock,
45+
},
46+
{
47+
title: "Deployments",
48+
url: `/org/${orgHandle}/deployments`,
49+
icon: Target,
50+
},
51+
{
52+
title: "Executions",
53+
url: `/org/${orgHandle}/executions`,
54+
icon: Logs,
55+
},
56+
{
57+
title: "API Keys",
58+
url: `/org/${orgHandle}/api-keys`,
59+
icon: KeyRound,
60+
},
61+
{
62+
title: "Members",
63+
url: `/org/${orgHandle}/members`,
64+
icon: Users,
65+
},
66+
];
67+
1568
export const OrgLayout: React.FC<OrgLayoutProps> = ({ children, title }) => {
1669
const params = useParams<{ handle: string }>();
1770
const { organization, setSelectedOrganization } = useAuth();

apps/web/src/pages/members-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { toast } from "sonner";
88
import { InsetError } from "@/components/inset-error";
99
import { InsetLoading } from "@/components/inset-loading";
1010
import { InsetLayout } from "@/components/layouts/inset-layout";
11-
import { usePageBreadcrumbs } from "@/hooks/use-page";
1211
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
1312
import {
1413
AlertDialog,
@@ -40,6 +39,7 @@ import {
4039
SelectTrigger,
4140
SelectValue,
4241
} from "@/components/ui/select";
42+
import { usePageBreadcrumbs } from "@/hooks/use-page";
4343
import {
4444
addMembership,
4545
removeMembership,

apps/web/src/routes.tsx

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
import {
2-
Building2,
3-
Database,
4-
KeyRound,
5-
LayoutDashboard,
6-
Lock,
7-
Logs,
8-
SquareTerminal,
9-
Target,
10-
User,
11-
Users,
12-
} from "lucide-react";
1+
import { Building2, User } from "lucide-react";
132
import React from "react";
143
import type { RouteObject, RouterState } from "react-router";
154
import { Navigate } from "react-router";
@@ -64,50 +53,6 @@ export type AppRouteObject = RouteObject & {
6453
handle?: RouteHandle;
6554
};
6655

67-
export const getDashboardSidebarItems = (orgHandle: string) => [
68-
{
69-
title: "Dashboard",
70-
url: `/org/${orgHandle}/dashboard`,
71-
icon: LayoutDashboard,
72-
},
73-
{
74-
title: "Workflows",
75-
url: `/org/${orgHandle}/workflows`,
76-
icon: SquareTerminal,
77-
},
78-
79-
{
80-
title: "Datasets",
81-
url: `/org/${orgHandle}/datasets`,
82-
icon: Database,
83-
},
84-
{
85-
title: "Secrets",
86-
url: `/org/${orgHandle}/secrets`,
87-
icon: Lock,
88-
},
89-
{
90-
title: "Deployments",
91-
url: `/org/${orgHandle}/deployments`,
92-
icon: Target,
93-
},
94-
{
95-
title: "Executions",
96-
url: `/org/${orgHandle}/executions`,
97-
icon: Logs,
98-
},
99-
{
100-
title: "API Keys",
101-
url: `/org/${orgHandle}/api-keys`,
102-
icon: KeyRound,
103-
},
104-
{
105-
title: "Members",
106-
url: `/org/${orgHandle}/members`,
107-
icon: Users,
108-
},
109-
];
110-
11156
const settingsSidebarItems = [
11257
{
11358
title: "Profile",

0 commit comments

Comments
 (0)