Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion frontend/app/(dashboard)/invoices/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,13 @@ export default function InvoicePage() {
invoiceNumber: inv.invoiceNumber,
}));

const total = lineItemTotal(lineItem);
const hasBountyMismatch = prDetails?.bounty_cents != null && prDetails.bounty_cents !== total;

const showStatusDot =
user.roles.administrator &&
hasPR &&
(isVerified === false || paidInvoices.length > 0) &&
(isVerified === false || paidInvoices.length > 0 || hasBountyMismatch) &&
invoice.status !== "paid";

return (
Expand All @@ -378,6 +381,7 @@ export default function InvoicePage() {
pr={prDetails}
currentUserGitHubUsername={contractorGithubUsername}
paidInvoices={paidInvoices}
lineItemTotal={total}
>
<a
href={prDetails.url}
Expand Down
22 changes: 22 additions & 0 deletions frontend/components/GitHubPRHoverCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import React, { useCallback, useRef, useState } from "react";
import { Badge } from "@/components/ui/badge";
import { useCurrentUser } from "@/global";
import { cn } from "@/utils";
import { formatMoneyFromCents } from "@/utils/formatMoney";
import type { PRDetails, PRState } from "@/utils/github";

const LONG_PRESS_DURATION = 500;
Expand Down Expand Up @@ -39,6 +40,7 @@ export interface GitHubPRHoverCardProps {
pr: PRDetails;
currentUserGitHubUsername?: string | null | undefined;
paidInvoices?: PaidInvoiceInfo[];
lineItemTotal?: number | null;
children: React.ReactNode;
enabled?: boolean;
}
Expand All @@ -47,6 +49,7 @@ export function GitHubPRHoverCard({
pr,
currentUserGitHubUsername,
paidInvoices = [],
lineItemTotal,
children,
enabled = true,
}: GitHubPRHoverCardProps) {
Expand Down Expand Up @@ -84,6 +87,11 @@ export function GitHubPRHoverCard({
? pr.author.toLowerCase() === currentUserGitHubUsername.toLowerCase()
: null;

const bountyMismatch =
pr.bounty_cents != null && lineItemTotal != null && pr.bounty_cents !== lineItemTotal
? { bounty: pr.bounty_cents, lineTotal: lineItemTotal }
: null;

const badgeStyle = PR_STATE_BADGES[pr.state];

return (
Expand Down Expand Up @@ -169,6 +177,20 @@ export function GitHubPRHoverCard({
)}
</div>
) : null}

{bountyMismatch ? (
<div className="flex items-center gap-1.5 text-sm">
<BadgeDollarSign className="size-4 text-amber-500" />
<span>
<span className="font-medium text-amber-500">Bounty mismatch</span>
<span className="text-muted-foreground">
{" "}
— GitHub label is {formatMoneyFromCents(bountyMismatch.bounty)}, invoice line is{" "}
{formatMoneyFromCents(bountyMismatch.lineTotal)}.
</span>
</span>
</div>
) : null}
</div>
</div>
</HoverCardPrimitive.Content>
Expand Down