Open History to see the last commit
1import type { ScopedThreadRef } from "@t3tools/contracts";
2import { T, useGT, plural, part } from "gt-react";
3
4import { useOpenLink } from "~/browser/useOpenLink";
5
6import type { PullRequestReplyAvailability } from "./pullRequestDetail.logic";
7
8export function PullRequestMoreReplies({
9 moreReplies,
10 hasMoreReplies,
11 url,
12 threadRef,
13}: PullRequestReplyAvailability & { threadRef: ScopedThreadRef | null }) {
14 const gt = useGT();
15 const openLink = useOpenLink(threadRef);
16 if (!hasMoreReplies) return null;
17 return (
18 <div className="flex flex-wrap items-baseline gap-2 py-1 text-xs text-muted-foreground">
19 <span>
20 {moreReplies > 0
21 ? gt`${plural(
22 { count: moreReplies },
23 {
24 one: part`${{ formatted: moreReplies.toLocaleString() }} more reply`,
25 other: part`${{ formatted: moreReplies.toLocaleString() }} more replies`,
26 },
27 )}`
28 : gt`More replies`}
29 </span>
30 {url ? (
31 <a
32 href={url}
33 target="_blank"
34 rel="noopener noreferrer"
35 className="hover:text-foreground hover:underline"
36 onClick={(event) => {
37 event.preventDefault();
38 void openLink(url, { event }).catch(console.error);
39 }}
40 >
41 <T>View on host</T>
42 </a>
43 ) : null}
44 </div>
45 );
46}