diff --git a/packages/backend/src/routes/project/all.ts b/packages/backend/src/routes/project/all.ts index 8d0de39..24aa525 100644 --- a/packages/backend/src/routes/project/all.ts +++ b/packages/backend/src/routes/project/all.ts @@ -1,9 +1,9 @@ import type { BunRequest } from "bun"; -import { getAllProjects } from "../../db/queries"; +import { getProjectsWithOwners } from "../../db/queries"; // /projects/all export default async function projectsAll(req: BunRequest) { - const projects = await getAllProjects(); + const projects = await getProjectsWithOwners(); return Response.json(projects); } diff --git a/packages/frontend/src/Index.tsx b/packages/frontend/src/Index.tsx index 7443e0d..8b5a9e3 100644 --- a/packages/frontend/src/Index.tsx +++ b/packages/frontend/src/Index.tsx @@ -1,12 +1,13 @@ -import type { IssueResponse, ProjectRecord } from "@issue/shared"; +import type { IssueResponse, ProjectResponse } from "@issue/shared"; import { useEffect, useRef, useState } from "react"; import { IssueDetailPane } from "@/components/issue-detail-pane"; import { IssuesTable } from "@/components/issues-table"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; +import SmallUserDisplay from "./components/small-user-display"; function Index() { - const [selectedProject, setSelectedProject] = useState(null); - const [projects, setProjects] = useState([]); + const [selectedProject, setSelectedProject] = useState(null); + const [projects, setProjects] = useState([]); const projectsRef = useRef(false); useEffect(() => { @@ -15,7 +16,7 @@ function Index() { fetch("http://localhost:3000/projects/all") .then((res) => res.json()) - .then((data: ProjectRecord[]) => { + .then((data: ProjectResponse[]) => { setProjects(data); }) .catch((err) => { @@ -31,11 +32,10 @@ function Index() { useEffect(() => { if (!selectedProject) return; - fetch(`${serverURL}/issues/${selectedProject.blob}`) + fetch(`${serverURL}/issues/${selectedProject.Project.blob}`) .then((res) => res.json()) .then((data: IssueResponse[]) => { setIssues(data); - console.log(data); }) .catch((err) => { console.error("error fetching issues:", err); @@ -45,7 +45,7 @@ function Index() { return (
{/* header area */} -
+
+ {selectedProject && ( +
+ Owner: +
+ )}
{/* main body */} -
+
{selectedProject && issuesData.length > 0 && ( <> {/* issues list (table) */} diff --git a/packages/frontend/src/components/issue-detail-pane.tsx b/packages/frontend/src/components/issue-detail-pane.tsx index adca5db..db01ee0 100644 --- a/packages/frontend/src/components/issue-detail-pane.tsx +++ b/packages/frontend/src/components/issue-detail-pane.tsx @@ -1,14 +1,15 @@ -import type { IssueResponse, ProjectRecord } from "@issue/shared"; +import type { IssueResponse, ProjectResponse } from "@issue/shared"; import { X } from "lucide-react"; import { Button } from "@/components/ui/button"; import { issueID } from "@/lib/utils"; +import SmallUserDisplay from "./small-user-display"; export function IssueDetailPane({ project, issueData, close, }: { - project: ProjectRecord; + project: ProjectResponse; issueData: IssueResponse; close: () => void; }) { @@ -16,7 +17,9 @@ export function IssueDetailPane({
-

{issueID(project.blob, issueData.Issue.number)}

+

+ {issueID(project.Project.blob, issueData.Issue.number)} +

); diff --git a/packages/frontend/src/components/issues-table.tsx b/packages/frontend/src/components/issues-table.tsx index 9c62867..a642261 100644 --- a/packages/frontend/src/components/issues-table.tsx +++ b/packages/frontend/src/components/issues-table.tsx @@ -1,4 +1,4 @@ -import type { IssueResponse, ProjectRecord } from "@issue/shared"; +import type { IssueResponse, ProjectResponse } from "@issue/shared"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { cn } from "@/lib/utils"; @@ -9,7 +9,7 @@ export function IssuesTable({ issueSelectAction, className, }: { - project: ProjectRecord; + project: ProjectResponse; issuesData: IssueResponse[]; columns?: { id?: boolean; title?: boolean; description?: boolean; assignee?: boolean }; issueSelectAction?: (issue: IssueResponse) => void; diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index a45f87b..686755d 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -22,6 +22,7 @@ export { } from "./schema"; // Responses -export { +export type { IssueResponse, + ProjectResponse, } from "./schema" \ No newline at end of file diff --git a/packages/shared/src/schema.ts b/packages/shared/src/schema.ts index 18fb6a6..c6d0880 100644 --- a/packages/shared/src/schema.ts +++ b/packages/shared/src/schema.ts @@ -65,3 +65,8 @@ export type IssueResponse = { Issue: IssueRecord; User?: UserRecord; }; + +export type ProjectResponse = { + Project: ProjectRecord; + User: UserRecord; +};