Skip to content

Commit

Permalink
[UI v2] feat: Starts page layout for concurrency page
Browse files Browse the repository at this point in the history
  • Loading branch information
devinvillarosa committed Dec 5, 2024
1 parent 6308207 commit 469a91f
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 4 deletions.
15 changes: 15 additions & 0 deletions ui-v2/src/components/concurrency/concurrency-page-title.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbList,
} from "@/components/ui/breadcrumb";

export const ConcurrencyPageTitle = () => (
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem className="text-xl font-semibold">
Concurrency
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
);
26 changes: 26 additions & 0 deletions ui-v2/src/components/concurrency/concurrency-page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useState } from "react";
import { ConcurrencyPageTitle } from "./concurrency-page-title";
import { ConcurrencyTabs } from "./concurrency-tabs";
import { GlobalConcurrencyView } from "./global-concurrency-view";
import { TaskRunConcurrencyView } from "./task-run-concurrenct-view";

type Tab = "Global" | "Task Run";

export const ConcurrencyPage = (): JSX.Element => {
// TODO: Use URL query instead
const [tab, setTab] = useState<Tab>("Global");

return (
<div className="flex flex-col gap-4">
<ConcurrencyPageTitle />
<div className="flex flex-col gap-6">
<ConcurrencyTabs
value={tab}
onValueChange={setTab}
globalView={<GlobalConcurrencyView />}
taskRunView={<TaskRunConcurrencyView />}
/>
</div>
</div>
);
};
35 changes: 35 additions & 0 deletions ui-v2/src/components/concurrency/concurrency-tabs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";

type Tabs = "Global" | "Task Run";

type Props = {
globalView: React.ReactNode;
onValueChange: (value: Tabs) => void;
taskRunView: React.ReactNode;
value: Tabs;
};

// TODO: Move Tabs for navigation to a generic styled component

export const ConcurrencyTabs = ({
globalView,
onValueChange,
taskRunView,
value,
}: Props): JSX.Element => {
return (
<Tabs
defaultValue="Global"
className="w-[400px]"
value={value}
onValueChange={(value) => onValueChange(value as Tabs)}
>
<TabsList className="grid w-full grid-cols-2">
<TabsTrigger value="Global">Global</TabsTrigger>
<TabsTrigger value="Task Run">Task Run</TabsTrigger>
</TabsList>
<TabsContent value="Global">{globalView}</TabsContent>
<TabsContent value="Task Run">{taskRunView}</TabsContent>
</Tabs>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const GlobalConcurrencyView = () => {
return <div>🚧🚧 Pardon our dust! 🚧🚧</div>;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const TaskRunConcurrencyView = () => {
return <div>🚧🚧 Pardon our dust! 🚧🚧</div>;
};
4 changes: 2 additions & 2 deletions ui-v2/src/components/layouts/MainLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { SidebarProvider } from "@/components/ui/sidebar";
import { AppSidebar } from "@/components/ui/app-sidebar";
import { SidebarProvider } from "@/components/ui/sidebar";
import { Toaster } from "../ui/toaster";

export function MainLayout({ children }: { children: React.ReactNode }) {
return (
<SidebarProvider>
<AppSidebar />
<main className="flex-1 overflow-auto">{children}</main>
<main className="flex-1 overflow-auto p-4">{children}</main>
<Toaster />
</SidebarProvider>
);
Expand Down
2 changes: 1 addition & 1 deletion ui-v2/src/components/variables/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const VariablesLayout = ({
children: React.ReactNode;
}) => {
return (
<div className="flex flex-col gap-4 p-4">
<div className="flex flex-col gap-4">
<div className="flex items-center gap-2">
<Breadcrumb>
<BreadcrumbList>
Expand Down
4 changes: 3 additions & 1 deletion ui-v2/src/routes/concurrency-limits.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { createFileRoute } from "@tanstack/react-router";

import { ConcurrencyPage } from "@/components/concurrency/concurrency-page";

export const Route = createFileRoute("/concurrency-limits")({
component: RouteComponent,
});

function RouteComponent() {
return "🚧🚧 Pardon our dust! 🚧🚧";
return <ConcurrencyPage />;
}

0 comments on commit 469a91f

Please sign in to comment.