-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI v2] feat: Starts page layout for concurrency page
- Loading branch information
1 parent
41ec634
commit c849f82
Showing
13 changed files
with
119 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const TAB_OPTIONS = { | ||
Global: "Global", | ||
"Task Run": "Task Run", | ||
} as const; | ||
export type TabOptions = keyof typeof TAB_OPTIONS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useState } from "react"; | ||
|
||
import { Typography } from "@/components//ui/typography"; | ||
|
||
import { TAB_OPTIONS, TabOptions } from "./concurrency-constants"; | ||
import { ConcurrencyTabs } from "./concurrency-tabs"; | ||
import { GlobalConcurrencyView } from "./global-concurrency-view"; | ||
import { TaskRunConcurrencyView } from "./task-run-concurrenct-view"; | ||
|
||
export const ConcurrencyPage = (): JSX.Element => { | ||
// TODO: Use URL query instead | ||
const [tab, setTab] = useState<TabOptions>(TAB_OPTIONS.Global); | ||
|
||
return ( | ||
<div className="flex flex-col gap-4"> | ||
<Typography variant="h2">Concurrency</Typography> | ||
<div className="flex flex-col gap-6"> | ||
<ConcurrencyTabs | ||
value={tab} | ||
onValueChange={setTab} | ||
globalView={<GlobalConcurrencyView />} | ||
taskRunView={<TaskRunConcurrencyView />} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; | ||
import { TAB_OPTIONS, TabOptions } from "./concurrency-constants"; | ||
|
||
type Props = { | ||
globalView: React.ReactNode; | ||
onValueChange: (value: TabOptions) => void; | ||
taskRunView: React.ReactNode; | ||
value: TabOptions; | ||
}; | ||
|
||
// 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 TabOptions)} | ||
> | ||
<TabsList className="grid w-full grid-cols-2"> | ||
<TabsTrigger value="Global">{TAB_OPTIONS.Global}</TabsTrigger> | ||
<TabsTrigger value="Task Run">{TAB_OPTIONS["Task Run"]}</TabsTrigger> | ||
</TabsList> | ||
<TabsContent value={TAB_OPTIONS.Global}>{globalView}</TabsContent> | ||
<TabsContent value={TAB_OPTIONS["Task Run"]}>{taskRunView}</TabsContent> | ||
</Tabs> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...2/src/components/concurrency/global-concurrency-view/global-concurrency-limits-header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Button } from "@/components/ui/button"; | ||
import { Icon } from "@/components/ui/icons"; | ||
import { Typography } from "@/components/ui/typography"; | ||
|
||
type Props = { | ||
onAdd: () => void; | ||
}; | ||
|
||
export const GlobalConcurrencyLimitsHeader = ({ onAdd }: Props) => { | ||
return ( | ||
<div className="flex flex-row items-center gap-2"> | ||
<Typography variant="h4">Global Concurrency Limits</Typography> | ||
<Button onClick={onAdd} size="icon"> | ||
<Icon id="Plus" /> | ||
</Button> | ||
</div> | ||
); | ||
}; |
18 changes: 18 additions & 0 deletions
18
ui-v2/src/components/concurrency/global-concurrency-view/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useState } from "react"; | ||
import { GlobalConcurrencyLimitsHeader } from "./global-concurrency-limits-header"; | ||
|
||
export const GlobalConcurrencyView = () => { | ||
const [showAddDialog, setShowAddDialog] = useState(false); | ||
|
||
const openAddDialog = () => setShowAddDialog(true); | ||
const closeAddDialog = () => setShowAddDialog(false); | ||
|
||
return ( | ||
<> | ||
<div className="flex flex-col gap-2"> | ||
<GlobalConcurrencyLimitsHeader onAdd={openAddDialog} /> | ||
</div> | ||
{showAddDialog && <div onClick={closeAddDialog}>TODO: DIALOG</div>} | ||
</> | ||
); | ||
}; |
3 changes: 3 additions & 0 deletions
3
ui-v2/src/components/concurrency/task-run-concurrenct-view/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const TaskRunConcurrencyView = () => { | ||
return <div>🚧🚧 Pardon our dust! 🚧🚧</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 />; | ||
} |