diff --git a/frontend/components/dashboard/index.tsx b/frontend/components/dashboard/index.tsx
index 25ff64e..8c36712 100644
--- a/frontend/components/dashboard/index.tsx
+++ b/frontend/components/dashboard/index.tsx
@@ -15,6 +15,8 @@ import { Sandbox } from "@/lib/types"
import DashboardProjects from "./projects"
import DashboardSharedWithMe from "./shared"
import NewProjectModal from "./newProject"
+import Link from "next/link"
+import { useSearchParams } from "next/navigation"
type TScreen = "projects" | "shared" | "settings" | "search"
@@ -40,6 +42,9 @@ export default function Dashboard({
else return "justify-start font-normal text-muted-foreground"
}
+ const searchParams = useSearchParams()
+ const q = searchParams.get("q")
+
return (
<>
Shared With Me
-
+ */}
-
+
+
+
{screen === "projects" ? (
-
+
) : screen === "shared" ? (
) : screen === "settings" ? null : null}
diff --git a/frontend/components/dashboard/projects.tsx b/frontend/components/dashboard/projects.tsx
index aae9cfa..80dd558 100644
--- a/frontend/components/dashboard/projects.tsx
+++ b/frontend/components/dashboard/projects.tsx
@@ -12,18 +12,20 @@ import { toast } from "sonner"
export default function DashboardProjects({
sandboxes,
+ q,
}: {
sandboxes: Sandbox[]
+ q: string | null
}) {
const onDelete = async (sandbox: Sandbox) => {
toast(`Project ${sandbox.name} deleted.`)
- const res = await deleteSandbox(sandbox.id)
+ await deleteSandbox(sandbox.id)
}
const onVisibilityChange = async (sandbox: Sandbox) => {
const newVisibility = sandbox.visibility === "public" ? "private" : "public"
toast(`Project ${sandbox.name} is now ${newVisibility}.`)
- const res = await updateSandbox({
+ await updateSandbox({
id: sandbox.id,
visibility: newVisibility,
})
@@ -31,57 +33,66 @@ export default function DashboardProjects({
return (
-
My Projects
+
+ {q && q.length > 0 ? `Showing search results for: ${q}` : "My Projects"}
+
- {sandboxes.map((sandbox) => (
-
-
- {/* */}
-
-
-
- {sandbox.name}
+ {sandboxes.map((sandbox) => {
+ if (q && q.length > 0) {
+ if (!sandbox.name.toLowerCase().includes(q.toLowerCase())) {
+ return null
+ }
+ }
+ return (
+
+
+ {/* */}
+
-
-
-
-
- {sandbox.visibility === "private" ? (
- <>
-
Private
- >
- ) : (
- <>
-
Public
- >
- )}
+
+
+ {sandbox.visibility === "private" ? (
+ <>
+ Private
+ >
+ ) : (
+ <>
+ Public
+ >
+ )}
+
+
+ 3d ago
+
-
- 3d ago
-
-
- {/* */}
-
-
- ))}
+ {/* */}
+
+
+ )
+ })}