diff --git a/packages/frontend/src/Index.tsx b/packages/frontend/src/Index.tsx index 9e75ecc..d532cc2 100644 --- a/packages/frontend/src/Index.tsx +++ b/packages/frontend/src/Index.tsx @@ -321,7 +321,7 @@ function Index() { setSelectedIssue(null)} onIssueUpdate={refetchIssues} /> diff --git a/packages/frontend/src/components/issue-detail-pane.tsx b/packages/frontend/src/components/issue-detail-pane.tsx index a7b32f2..c56f01b 100644 --- a/packages/frontend/src/components/issue-detail-pane.tsx +++ b/packages/frontend/src/components/issue-detail-pane.tsx @@ -1,47 +1,33 @@ -import type { IssueResponse, OrganisationMemberResponse, ProjectResponse } from "@issue/shared"; +import type { IssueResponse, ProjectResponse, UserRecord } from "@issue/shared"; import { X } from "lucide-react"; import { useEffect, useState } from "react"; import SmallUserDisplay from "@/components/small-user-display"; import { Button } from "@/components/ui/button"; -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; -import { issue, organisation } from "@/lib/server"; +import { UserSelect } from "@/components/user-select"; +import { issue } from "@/lib/server"; import { issueID } from "@/lib/utils"; export function IssueDetailPane({ project, issueData, - organisationId, + members, close, onIssueUpdate, }: { project: ProjectResponse; issueData: IssueResponse; - organisationId: number; + members: UserRecord[]; close: () => void; onIssueUpdate?: () => void; }) { - const [members, setMembers] = useState([]); const [assigneeId, setAssigneeId] = useState( issueData.Issue.assigneeId?.toString() ?? "unassigned", ); - const [assigneeSelectOpen, setAssigneeSelectOpen] = useState(false); useEffect(() => { setAssigneeId(issueData.Issue.assigneeId?.toString() ?? "unassigned"); }, [issueData.Issue.assigneeId]); - useEffect(() => { - organisation.members({ - organisationId, - onSuccess: (data) => { - setMembers(data); - }, - onError: (error) => { - console.error("error fetching members:", error); - }, - }); - }, [organisationId]); - const handleAssigneeChange = async (value: string) => { setAssigneeId(value); const newAssigneeId = value === "unassigned" ? null : Number(value); @@ -81,53 +67,12 @@ export function IssueDetailPane({
Assignee: - + onChange={handleAssigneeChange} + fallbackUser={issueData.Assignee} + />