implemented issue identifiers (<project_blob>-<issue_number>)

This commit is contained in:
Oliver Bryan
2025-12-14 21:19:28 +00:00
parent 0e4e84fe45
commit 6c8cba1def
3 changed files with 49 additions and 24 deletions

View File

@@ -78,8 +78,11 @@ function Index() {
</div> </div>
{/* main body */} {/* main body */}
<div className="w-full h-full flex items-start justify-between pt-2 gap-2"> <div className="w-full h-full flex items-start justify-between pt-2 gap-2">
{selectedProject && issues.length > 0 && (
<>
{/* issues list (table) */} {/* issues list (table) */}
<IssuesTable <IssuesTable
project={selectedProject}
issues={issues} issues={issues}
columns={{ description: false }} columns={{ description: false }}
issueSelectAction={setSelectedIssue} issueSelectAction={setSelectedIssue}
@@ -88,9 +91,15 @@ function Index() {
{/* issue detail pane */} {/* issue detail pane */}
{selectedIssue && ( {selectedIssue && (
<div className="border w-2xl"> <div className="border w-2xl">
<IssueDetailPane issue={selectedIssue} close={() => setSelectedIssue(null)} /> <IssueDetailPane
project={selectedProject}
issue={selectedIssue}
close={() => setSelectedIssue(null)}
/>
</div> </div>
)} )}
</>
)}
</div> </div>
</main> </main>
); );

View File

@@ -1,13 +1,28 @@
import type { IssueRecord } from "@issue/shared"; import type { IssueRecord, ProjectRecord } from "@issue/shared";
import { X } from "lucide-react"; import { X } from "lucide-react";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { issueID } from "@/lib/utils";
export function IssueDetailPane({ issue, close }: { issue: IssueRecord; close: () => void }) { export function IssueDetailPane({
project,
issue,
close,
}: {
project: ProjectRecord;
issue: IssueRecord;
close: () => void;
}) {
return ( return (
<div className="flex flex-col items-end"> <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>
</span>
<Button variant={"dummy"} onClick={close} className="px-0 py-0 w-6 h-6"> <Button variant={"dummy"} onClick={close} className="px-0 py-0 w-6 h-6">
<X /> <X />
</Button> </Button>
</div>
<div className="flex flex-col w-full p-2 gap-2"> <div className="flex flex-col w-full p-2 gap-2">
<h1 className="text-md">{issue.title}</h1> <h1 className="text-md">{issue.title}</h1>

View File

@@ -1,25 +1,26 @@
import type { IssueRecord } from "@issue/shared"; import type { IssueRecord, ProjectRecord } from "@issue/shared";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import { cn } from "@/lib/utils"; import { cn, issueID } from "@/lib/utils";
export function IssuesTable({ export function IssuesTable({
project,
issues, issues,
columns = {}, columns = {},
issueSelectAction, issueSelectAction,
className, className,
}: { }: {
project: ProjectRecord;
issues: IssueRecord[]; issues: IssueRecord[];
columns?: { id?: boolean; title?: boolean; description?: boolean; assignee?: boolean }; columns?: { id?: boolean; title?: boolean; description?: boolean; assignee?: boolean };
issueSelectAction?: (issue: IssueRecord) => void; issueSelectAction?: (issue: IssueRecord) => void;
className: string; className: string;
}) { }) {
if (issues.length === 0) return;
return ( return (
<Table className={cn(className)}> <Table className={cn(className)}>
<TableHeader> <TableHeader>
<TableRow hoverEffect={false}> <TableRow hoverEffect={false}>
{(columns.id == null || columns.id === true) && ( {(columns.id == null || columns.id === true) && (
<TableHead className="w-[1px] border-r">ID</TableHead> <TableHead className="text-right w-[1px] border-r">ID</TableHead>
)} )}
{(columns.title == null || columns.title === true) && <TableHead>Title</TableHead>} {(columns.title == null || columns.title === true) && <TableHead>Title</TableHead>}
{(columns.description == null || columns.description === true) && ( {(columns.description == null || columns.description === true) && (
@@ -39,8 +40,8 @@ export function IssuesTable({
}} }}
> >
{(columns.id == null || columns.id === true) && ( {(columns.id == null || columns.id === true) && (
<TableCell className="font-medium border-r"> <TableCell className="font-medium border-r text-right">
{String(issue.id).padStart(3, "0")} {issue.number.toString().padStart(3, "0")}
</TableCell> </TableCell>
)} )}
{(columns.title == null || columns.title === true) && ( {(columns.title == null || columns.title === true) && (