mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
IssueResponse definition and implementation
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
import type { IssueRecord, ProjectRecord } from "@issue/shared";
|
||||
import type { IssueResponse, ProjectRecord } from "@issue/shared";
|
||||
import { X } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { issueID } from "@/lib/utils";
|
||||
|
||||
export function IssueDetailPane({
|
||||
project,
|
||||
issue,
|
||||
issueData,
|
||||
close,
|
||||
}: {
|
||||
project: ProjectRecord;
|
||||
issue: IssueRecord;
|
||||
issueData: IssueResponse;
|
||||
close: () => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-col">
|
||||
<div className="flex flex-row items-center justify-end border-b">
|
||||
<span className="w-full px-0.5">
|
||||
<p className="text-sm w-fit px-0.75">{issueID(project.blob, issue.number)}</p>
|
||||
<p className="text-sm w-fit px-0.75">{issueID(project.blob, issueData.Issue.number)}</p>
|
||||
</span>
|
||||
|
||||
<Button variant={"dummy"} onClick={close} className="px-0 py-0 w-6 h-6">
|
||||
@@ -25,8 +25,13 @@ export function IssueDetailPane({
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col w-full p-2 gap-2">
|
||||
<h1 className="text-md">{issue.title}</h1>
|
||||
<p className="text-sm">{issue.description}</p>
|
||||
<h1 className="text-md">{issueData.Issue.title}</h1>
|
||||
<p className="text-sm">{issueData.Issue.description}</p>
|
||||
|
||||
<p className="text-sm">
|
||||
Assignee:{" "}
|
||||
{issueData.User ? `${issueData.User.name} (${issueData.User.username})` : "Unassigned"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import type { IssueRecord, ProjectRecord } from "@issue/shared";
|
||||
import type { IssueResponse, ProjectRecord } from "@issue/shared";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { cn, issueID } from "@/lib/utils";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function IssuesTable({
|
||||
project,
|
||||
issues,
|
||||
issuesData,
|
||||
columns = {},
|
||||
issueSelectAction,
|
||||
className,
|
||||
}: {
|
||||
project: ProjectRecord;
|
||||
issues: IssueRecord[];
|
||||
issuesData: IssueResponse[];
|
||||
columns?: { id?: boolean; title?: boolean; description?: boolean; assignee?: boolean };
|
||||
issueSelectAction?: (issue: IssueRecord) => void;
|
||||
issueSelectAction?: (issue: IssueResponse) => void;
|
||||
className: string;
|
||||
}) {
|
||||
return (
|
||||
@@ -31,27 +31,27 @@ export function IssuesTable({
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{issues.map((issue) => (
|
||||
{issuesData.map((issueData) => (
|
||||
<TableRow
|
||||
key={issue.id}
|
||||
key={issueData.Issue.id}
|
||||
className="cursor-pointer"
|
||||
onClick={() => {
|
||||
issueSelectAction?.(issue);
|
||||
issueSelectAction?.(issueData);
|
||||
}}
|
||||
>
|
||||
{(columns.id == null || columns.id === true) && (
|
||||
<TableCell className="font-medium border-r text-right">
|
||||
{issue.number.toString().padStart(3, "0")}
|
||||
{issueData.Issue.number.toString().padStart(3, "0")}
|
||||
</TableCell>
|
||||
)}
|
||||
{(columns.title == null || columns.title === true) && (
|
||||
<TableCell>{issue.title}</TableCell>
|
||||
<TableCell>{issueData.Issue.title}</TableCell>
|
||||
)}
|
||||
{(columns.description == null || columns.description === true) && (
|
||||
<TableCell className="overflow-hide">{issue.description}</TableCell>
|
||||
<TableCell className="overflow-hide">{issueData.Issue.description}</TableCell>
|
||||
)}
|
||||
{(columns.assignee == null || columns.assignee === true) && (
|
||||
<TableCell className={"text-right"}>?</TableCell>
|
||||
<TableCell className={"text-right"}>{issueData.User?.id || "?"}</TableCell>
|
||||
)}
|
||||
</TableRow>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user