| 1 | import { |
| 2 | CircleCheck, |
| 3 | CircleDot, |
| 4 | GitMerge, |
| 5 | GitPullRequest, |
| 6 | GitPullRequestClosed, |
| 7 | } from "lucide-react"; |
| 8 | |
| 9 | import { cn } |
| 10 | |
| 11 | const STYLES = { |
| 12 | issue: { |
| 13 | open: { |
| 14 | Icon: CircleDot, |
| 15 | text: "text-emerald-600", |
| 16 | badge: "bg-emerald-600 text-white", |
| 17 | }, |
| 18 | closed: { |
| 19 | Icon: CircleCheck, |
| 20 | text: "text-red-600", |
| 21 | badge: "bg-red-600 text-white", |
| 22 | }, |
| 23 | merged: { |
| 24 | Icon: CircleCheck, |
| 25 | text: "text-red-600", |
| 26 | badge: "bg-red-600 text-white", |
| 27 | }, |
| 28 | }, |
| 29 | pull: { |
| 30 | open: { |
| 31 | Icon: GitPullRequest, |
| 32 | text: "text-emerald-600", |
| 33 | badge: "bg-emerald-600 text-white", |
| 34 | }, |
| 35 | closed: { |
| 36 | Icon: GitPullRequestClosed, |
| 37 | text: "text-red-600", |
| 38 | badge: "bg-red-600 text-white", |
| 39 | }, |
| 40 | merged: { |
| 41 | Icon: GitMerge, |
| 42 | text: "text-violet-600", |
| 43 | badge: "bg-violet-600 text-white", |
| 44 | }, |
| 45 | }, |
| 46 | }; |
| 47 | |
| 48 | /** The icon and colours that mark an issue or pull request as open, closed or merged. */ |
| 49 | export function threadStateStyle( |
| 50 | isPullRequest: boolean, |
| 51 | state: "open |
| 52 | ) { |
| 53 | return STYLES[isPullRequest |
| 54 | } |
| 55 | |
| 56 | export function ThreadStateIcon({ |
| 57 | isPullRequest, |
| 58 | state, |
| 59 | className, |
| 60 | }: { |
| 61 | isPullRequest: boolean |
| 62 | state: "open |
| 63 | className?: string |
| 64 | }) { |
| 65 | const { Icon, |
| 66 | return <Icon className |
| 67 | } |