fix(web): mobile view
This commit is contained in:
parent
87a25eb262
commit
f2c9362a8a
@ -1,4 +1,4 @@
|
|||||||
import Main from '@/components/Main';
|
import Main from "@/components/Main";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return <Main />;
|
return <Main />;
|
||||||
|
@ -30,7 +30,7 @@ export default async function Page({
|
|||||||
return (
|
return (
|
||||||
<div className="mt-4 w-full flex flex-col lg:flex-row gap-4 max-h-[calc(100dvh-100px)]">
|
<div className="mt-4 w-full flex flex-col lg:flex-row gap-4 max-h-[calc(100dvh-100px)]">
|
||||||
<div className="flex gap-4 flex-col">
|
<div className="flex gap-4 flex-col">
|
||||||
<Card className="w-full lg:w-fit lg:min-w-[500px] h-fit">
|
<Card className="w-full lg:w-fit lg:min-w-[600px] h-fit">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>{workflow?.name}</CardTitle>
|
<CardTitle>{workflow?.name}</CardTitle>
|
||||||
<CardDescription suppressHydrationWarning={true}>
|
<CardDescription suppressHydrationWarning={true}>
|
||||||
@ -39,7 +39,7 @@ export default async function Page({
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
|
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="flex gap-2 ">
|
<div className="flex gap-2 flex-wrap">
|
||||||
<VersionSelect workflow={workflow} />
|
<VersionSelect workflow={workflow} />
|
||||||
<MachineSelect machines={machines} />
|
<MachineSelect machines={machines} />
|
||||||
<RunWorkflowButton workflow={workflow} machines={machines} />
|
<RunWorkflowButton workflow={workflow} machines={machines} />
|
||||||
|
@ -245,7 +245,7 @@ export function APIKeyList({ data }: { data: APIKey[] }) {
|
|||||||
</DropdownMenu> */}
|
</DropdownMenu> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="rounded-md border">
|
<div className="rounded-md border overflow-x-auto w-full">
|
||||||
<Table>
|
<Table>
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
{table.getHeaderGroups().map((headerGroup) => (
|
{table.getHeaderGroups().map((headerGroup) => (
|
||||||
|
@ -11,7 +11,7 @@ import { TableCell, TableRow } from "@/components/ui/table";
|
|||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import { getRelativeTime } from "@/lib/getRelativeTime";
|
import { getRelativeTime } from "@/lib/getRelativeTime";
|
||||||
import type { findAllDeployments } from "@/server/findAllRuns";
|
import type { findAllDeployments } from "@/server/findAllRuns";
|
||||||
import { headers } from 'next/headers';
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
const curlTemplate = `
|
const curlTemplate = `
|
||||||
curl --request POST \
|
curl --request POST \
|
||||||
@ -59,7 +59,7 @@ export function DeploymentDisplay({
|
|||||||
deployment: Awaited<ReturnType<typeof findAllDeployments>>[0];
|
deployment: Awaited<ReturnType<typeof findAllDeployments>>[0];
|
||||||
}) {
|
}) {
|
||||||
const headersList = headers();
|
const headersList = headers();
|
||||||
const host = headersList.get('host') || "";
|
const host = headersList.get("host") || "";
|
||||||
const protocol = headersList.get("x-forwarded-proto") || "";
|
const protocol = headersList.get("x-forwarded-proto") || "";
|
||||||
const domain = `${protocol}://${host}`;
|
const domain = `${protocol}://${host}`;
|
||||||
|
|
||||||
@ -93,7 +93,10 @@ export function DeploymentDisplay({
|
|||||||
</TabsList>
|
</TabsList>
|
||||||
<TabsContent className="flex flex-col gap-2" value="js">
|
<TabsContent className="flex flex-col gap-2" value="js">
|
||||||
Trigger the workflow
|
Trigger the workflow
|
||||||
<CodeBlock lang="js" code={formatCode(jsTemplate, deployment, domain)} />
|
<CodeBlock
|
||||||
|
lang="js"
|
||||||
|
code={formatCode(jsTemplate, deployment, domain)}
|
||||||
|
/>
|
||||||
Check the status of the run, and retrieve the outputs
|
Check the status of the run, and retrieve the outputs
|
||||||
<CodeBlock
|
<CodeBlock
|
||||||
lang="js"
|
lang="js"
|
||||||
@ -122,9 +125,6 @@ function formatCode(
|
|||||||
domain: string
|
domain: string
|
||||||
) {
|
) {
|
||||||
return codeTemplate
|
return codeTemplate
|
||||||
.replace(
|
.replace("<URL>", `${domain ?? "http://localhost:3000"}/api/run`)
|
||||||
"<URL>",
|
|
||||||
`${domain ?? "http://localhost:3000"}/api/run`
|
|
||||||
)
|
|
||||||
.replace("<ID>", deployment.id);
|
.replace("<ID>", deployment.id);
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ export function MachineList({ data }: { data: Machine[] }) {
|
|||||||
</DropdownMenu> */}
|
</DropdownMenu> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="rounded-md border">
|
<div className="rounded-md border overflow-x-auto w-full">
|
||||||
<Table>
|
<Table>
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
{table.getHeaderGroups().map((headerGroup) => (
|
{table.getHeaderGroups().map((headerGroup) => (
|
||||||
|
@ -1,39 +1,81 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectGroup,
|
||||||
|
SelectItem,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from "@/components/ui/select";
|
||||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
export function NavbarRight() {
|
export function NavbarRight() {
|
||||||
const pathname = usePathname();
|
const pathnames = usePathname();
|
||||||
|
const pathname = `/${pathnames.split("/")[1]}`;
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
const pages = [
|
||||||
|
{
|
||||||
|
name: "Workflows",
|
||||||
|
path: "/workflows",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Machines",
|
||||||
|
path: "/machines",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "API Keys",
|
||||||
|
path: "/api-keys",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<div>
|
||||||
<Tabs
|
<Tabs
|
||||||
defaultValue={
|
defaultValue={pathname}
|
||||||
pathname.startsWith("/machines")
|
className="w-[300px] hidden lg:flex"
|
||||||
? "machines"
|
|
||||||
: pathname.startsWith("/api-keys")
|
|
||||||
? "api-keys"
|
|
||||||
: pathname.startsWith("/workflows")
|
|
||||||
? "workflows" : ""
|
|
||||||
}
|
|
||||||
className="w-[300px]"
|
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
if (value === "machines") {
|
router.push(value);
|
||||||
router.push("/machines");
|
|
||||||
} else if (value === "api-keys") {
|
|
||||||
router.push("/api-keys");
|
|
||||||
} else {
|
|
||||||
router.push("/workflows");
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TabsList className="grid w-full grid-cols-3">
|
<TabsList className="grid w-full grid-cols-3">
|
||||||
<TabsTrigger value="workflows">Workflows</TabsTrigger>
|
{pages.map((page) => (
|
||||||
<TabsTrigger value="machines">Machines</TabsTrigger>
|
<TabsTrigger key={page.name} value={page.path}>
|
||||||
<TabsTrigger value="api-keys">API Keys</TabsTrigger>
|
{page.name}
|
||||||
|
</TabsTrigger>
|
||||||
|
))}
|
||||||
</TabsList>
|
</TabsList>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
|
<div className="w-[100px] flex lg:hidden">
|
||||||
|
<Select
|
||||||
|
defaultValue={pathname == "/" ? "" : pathname}
|
||||||
|
onValueChange={(v) => {
|
||||||
|
router.push(v);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="w-[180px]">
|
||||||
|
<SelectValue placeholder="Menu" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectGroup>
|
||||||
|
{pages.map((page, i) => (
|
||||||
|
<SelectItem
|
||||||
|
key={page.name}
|
||||||
|
value={page.path}
|
||||||
|
defaultChecked={i == 0}
|
||||||
|
>
|
||||||
|
{page.name}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectGroup>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ export function VersionSelect({
|
|||||||
setVersion(v);
|
setVersion(v);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="w-[180px]">
|
<SelectTrigger className="w-[100px]">
|
||||||
<SelectValue placeholder="Select a version" />
|
<SelectValue placeholder="Select a version" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
@ -155,7 +155,7 @@ export function CreateDeploymentButton({
|
|||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button className="gap-2" disabled={isLoading} variant="outline">
|
<Button className="gap-2" disabled={isLoading} variant="outline">
|
||||||
Deploy {isLoading ? <LoadingIcon /> : <MoreVertical size={14} /> }
|
Deploy {isLoading ? <LoadingIcon /> : <MoreVertical size={14} />}
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent className="w-56">
|
<DropdownMenuContent className="w-56">
|
||||||
|
@ -229,7 +229,7 @@ export function WorkflowList({ data }: { data: Payment[] }) {
|
|||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</div>
|
</div>
|
||||||
<div className="rounded-md border">
|
<div className="rounded-md border overflow-x-auto w-full">
|
||||||
<Table>
|
<Table>
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
{table.getHeaderGroups().map((headerGroup) => (
|
{table.getHeaderGroups().map((headerGroup) => (
|
||||||
|
@ -5,7 +5,7 @@ const Table = React.forwardRef<
|
|||||||
HTMLTableElement,
|
HTMLTableElement,
|
||||||
React.HTMLAttributes<HTMLTableElement>
|
React.HTMLAttributes<HTMLTableElement>
|
||||||
>(({ className, ...props }, ref) => (
|
>(({ className, ...props }, ref) => (
|
||||||
// <div className="relative w-full overflow-auto">
|
// <div className="relative w-full overflow-x-auto">
|
||||||
<table
|
<table
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn("w-full caption-bottom text-sm", className)}
|
className={cn("w-full caption-bottom text-sm", className)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user