import type { IssueRow, LabelRow, RepositoryRow } from "../../db/index.ts"; import { formatDate } from "../../lib/formatDate.ts"; import { labelTextColor } from "../../lib/labelColor.ts"; import { displayName } from "../../lib/users.ts"; import type { SessionUser } from "../../middleware/session.ts"; import { Avatar } from "../Avatar.tsx"; import { Layout } from "../layout.tsx"; import { Pagination, type PaginationInfo } from "../Pagination.tsx"; import { RepoHeader } from "../repos/RepoHeader.tsx"; import { RepoNav } from "../repos/RepoNav.tsx"; interface IssueListProps { user: SessionUser | null; repo: RepositoryRow; issues: (IssueRow & { author_username: string; author_avatar_version: number | null; })[]; status: "open" | "closed" | "completed"; counts: Record; pagination: PaginationInfo; repoLabels: LabelRow[]; selectedLabelIds: number[]; labelsByIssueId: Map; } export function IssueList({ user, repo, issues, status, counts, pagination, repoLabels, selectedLabelIds, labelsByIssueId, }: IssueListProps) { const labelsParam = selectedLabelIds.length > 0 ? `&labels=${selectedLabelIds.map(String).join(",")}` : ""; return (
{repoLabels.length > 0 && (
Filter by label {selectedLabelIds.length > 0 && ( {selectedLabelIds.length} )}
{repoLabels.map((label) => ( ))}
Clear
)} {!!user && ( New issue )}
{issues.length === 0 ? (

No {status} issues.

) : (
    {issues.map((issue) => { const labels = labelsByIssueId.get(issue.id) ?? []; const unsafeAuthor = displayName( issue.author_username, ); return (
  • {issue.title} #{issue.number}
    {labels.length > 0 && (
    {labels.map((label) => ( {label.name} ))}
    )}
    opened by {unsafeAuthor}
  • ); })}
)}
); }