diff --git a/frontend/src/pages/dashboard/components/recently-viewed.tsx b/frontend/src/pages/dashboard/components/recently-viewed.tsx index 00f60b528..84111b57b 100644 --- a/frontend/src/pages/dashboard/components/recently-viewed.tsx +++ b/frontend/src/pages/dashboard/components/recently-viewed.tsx @@ -1,12 +1,67 @@ import { useGetRecentlyViewed } from "@hooks"; -import { Card, CardContent, CardHeader, CardTitle } from "@ui/card"; -import { BuildCard, DeploymentCard, ServerCard } from ".."; +import { BuildCard, DeploymentCard, NewDeployment, ServerCard } from ".."; +import { useState } from "react"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@ui/dropdown"; +import { Button } from "@ui/button"; +import { ChevronDown, PlusCircle } from "lucide-react"; + +const NewButton = () => { + const [open, set] = useState<"deployment" | "build" | "server" | boolean>( + false + ); + return ( + <> + + + + + + + Resource Type + + + + set("deployment")}> + Deployment + + set("build")}> + Build + + Server + + + + + {/* */} + + ); +}; export const RecentlyViewed = () => { const recents = useGetRecentlyViewed(); return (
-

Recently Viewed

+
+

Recently Viewed

+ +
{recents.map(({ type, id }) => { if (type === "Deployment") return ; diff --git a/frontend/src/pages/dashboard/index.tsx b/frontend/src/pages/dashboard/index.tsx index a45f68481..202978500 100644 --- a/frontend/src/pages/dashboard/index.tsx +++ b/frontend/src/pages/dashboard/index.tsx @@ -6,21 +6,11 @@ import { CardHeader, CardTitle, } from "@ui/card"; -import { readableVersion, version_to_string } from "@util/helpers"; +import { version_to_string } from "@util/helpers"; import { ServersChart } from "./components/servers-chart"; import { DeploymentsChart } from "./components/deployments-chart"; import { Input } from "@ui/input"; -import { ChevronDown, PlusCircle } from "lucide-react"; import { Link } from "react-router-dom"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuGroup, - DropdownMenuItem, - DropdownMenuLabel, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from "@ui/dropdown"; import { Button } from "@ui/button"; import { Dialog, @@ -33,7 +23,7 @@ import { useState } from "react"; import { RecentlyViewed } from "./components/recently-viewed"; import { ServerStats, ServerStatusIcon } from "@pages/server"; -const NewDeployment = ({ +export const NewDeployment = ({ open, set, }: { @@ -123,47 +113,6 @@ const NewBuild = ({ ); }; -const NewButton = () => { - const [open, set] = useState<"deployment" | "build" | "server" | boolean>( - false - ); - return ( - <> - - - - - - - Resource Type - - - - set("deployment")}> - Deployment - - set("build")}> - Build - - Server - - - - - - - ); -}; - export const DeploymentCard = ({ id }: { id: string }) => { const deployments = useRead({ type: "ListDeployments", params: {} }).data; const deployment = deployments?.find((d) => d.id === id); @@ -182,19 +131,6 @@ export const DeploymentCard = ({ id }: { id: string }) => { ); }; -const DeploymentsList = () => { - const deployments = useRead({ type: "ListDeployments", params: {} }).data; - - return ( -
-

Deployments

- {deployments?.map(({ id }) => ( - - ))} -
- ); -}; - export const ServerCard = ({ id }: { id: string }) => { const servers = useRead({ type: "ListServers", params: {} }).data; const server = servers?.find((server) => server.id === id); @@ -218,19 +154,6 @@ export const ServerCard = ({ id }: { id: string }) => { ); }; -const ServersList = () => { - const servers = useRead({ type: "ListServers", params: {} }).data; - - return ( -
-

Deployments

- {servers?.map((server) => ( - - ))} -
- ); -}; - export const BuildCard = ({ id }: { id: string }) => { const builds = useRead({ type: "ListBuilds", params: {} }).data; const build = builds?.find((server) => server.id === id); @@ -253,43 +176,19 @@ export const BuildCard = ({ id }: { id: string }) => { ); }; -const BuildsList = () => { - const builds = useRead({ type: "ListBuilds", params: {} }).data; - - return ( -
-

Builds

- {builds?.map((build) => ( - - ))} -
- ); -}; - export const Dashboard = () => { const user = useUser().data; return ( - <> -
-

Hello, {user?.username}.

-
- - -
-
-
+
+
+

Hello, {user?.username}.

-
- {/*
- - - -
*/} - + +
); }; diff --git a/frontend/src/pages/deployments/index.tsx b/frontend/src/pages/deployments/index.tsx index 9cd437b6d..e3c568281 100644 --- a/frontend/src/pages/deployments/index.tsx +++ b/frontend/src/pages/deployments/index.tsx @@ -30,7 +30,7 @@ export const Deployments = () => {
-
+
{deployments?.map( ({ id, name }) => (search.includes(name) || name.includes(search)) && ( diff --git a/frontend/src/pages/servers/index.tsx b/frontend/src/pages/servers/index.tsx index 231f7af4d..e1ae69c27 100644 --- a/frontend/src/pages/servers/index.tsx +++ b/frontend/src/pages/servers/index.tsx @@ -1,16 +1,42 @@ import { useRead } from "@hooks"; import { ServerCard } from "@pages/dashboard"; +import { Button } from "@ui/button"; +import { Input } from "@ui/input"; +import { PlusCircle } from "lucide-react"; +import { useState } from "react"; export const Servers = () => { const servers = useRead({ type: "ListServers", params: {} }).data; + const [search, set] = useState(""); return (
-

Servers

-
- {servers?.map(({ id }) => ( - - ))} +
+

Servers

+
+ set(e.target.value)} + /> + +
+
{" "} +
+ {servers?.map( + ({ id, name }) => + (search.includes(name) || name.includes(search)) && ( + + ) + )}
);