From a8dfe545705eab162a62a333ed4d5bf3fc09df70 Mon Sep 17 00:00:00 2001 From: Oliver Bryan <04oliverbryan@gmail.com> Date: Wed, 31 Dec 2025 05:49:07 +0000 Subject: [PATCH] ProjectSelect component --- packages/frontend/src/Index.tsx | 77 ++++--------------- .../src/components/project-select.tsx | 74 ++++++++++++++++++ 2 files changed, 87 insertions(+), 64 deletions(-) create mode 100644 packages/frontend/src/components/project-select.tsx diff --git a/packages/frontend/src/Index.tsx b/packages/frontend/src/Index.tsx index edf3284..97dcaab 100644 --- a/packages/frontend/src/Index.tsx +++ b/packages/frontend/src/Index.tsx @@ -3,11 +3,11 @@ import type { IssueResponse, OrganisationResponse, ProjectResponse, UserRecord } import { useEffect, useRef, useState } from "react"; import { Link } from "react-router-dom"; import { CreateIssue } from "@/components/create-issue"; -import { CreateProject } from "@/components/create-project"; import { IssueDetailPane } from "@/components/issue-detail-pane"; import { IssuesTable } from "@/components/issues-table"; import LogOutButton from "@/components/log-out-button"; import { OrganisationSelect } from "@/components/organisation-select"; +import { ProjectSelect } from "@/components/project-select"; import SmallUserDisplay from "@/components/small-user-display"; import { DropdownMenu, @@ -17,16 +17,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; -import { - Select, - SelectContent, - SelectItem, - SelectSeparator, - SelectTrigger, - SelectValue, -} from "@/components/ui/select"; import { getAuthHeaders } from "@/lib/utils"; -import { Button } from "./components/ui/button"; import { ResizablePanel, ResizablePanelGroup, ResizableSeparator } from "./components/ui/resizable"; function Index() { @@ -39,7 +30,6 @@ function Index() { const [selectedOrganisation, setSelectedOrganisation] = useState(null); const [projects, setProjects] = useState([]); - const [projectSelectOpen, setProjectSelectOpen] = useState(false); const [selectedProject, setSelectedProject] = useState(null); const [issues, setIssues] = useState([]); @@ -171,62 +161,21 @@ function Index() { {/* project selection - only shown when organisation is selected */} {selectedOrganisation && ( - + onCreateProject={async (projectId) => { + if (!selectedOrganisation) return; + await refetchProjects(selectedOrganisation.Organisation.id, { + selectProjectId: projectId, + }); + }} + /> )} {selectedOrganisation && selectedProject && ( void; + onCreateProject?: (projectId: number) => void | Promise; + placeholder?: string; +}) { + const [open, setOpen] = useState(false); + + return ( + + ); +}