({ text }: { text: string })
| 931 | } |
| 932 | |
| 933 | function PatchTextView({ text }: { text: string }) { |
| 934 | const lines = text.split(/\r?\n/); |
| 935 | |
| 936 | return ( |
| 937 | <div style={{ maxHeight: 520, overflowY: "auto", overflowX: "hidden", fontFamily: "var(--font-mono)", fontSize: 12, lineHeight: 1.55, minWidth: 0 }}> |
| 938 | {lines.map((line, i) => { |
| 939 | const kind = |
| 940 | line.startsWith("@@") ? "hunk" : |
| 941 | line.startsWith("+") && !line.startsWith("+++") ? "added" : |
| 942 | line.startsWith("-") && !line.startsWith("---") ? "removed" : |
| 943 | "context"; |
| 944 | const bg = |
| 945 | kind === "added" ? "rgba(34,197,94,0.12)" : |
| 946 | kind === "removed" ? "rgba(248,113,113,0.13)" : |
| 947 | kind === "hunk" ? "rgba(96,165,250,0.12)" : |
| 948 | "transparent"; |
| 949 | const color = |
| 950 | kind === "added" ? "#22c55e" : |
| 951 | kind === "removed" ? "#f87171" : |
| 952 | kind === "hunk" ? "var(--accent)" : |
| 953 | "var(--text)"; |
| 954 | |
| 955 | return ( |
| 956 | <div |
| 957 | key={i} |
| 958 | style={{ |
| 959 | display: "flex", |
| 960 | background: bg, |
| 961 | borderLeft: kind === "added" |
| 962 | ? "3px solid #22c55e" |
| 963 | : kind === "removed" |
| 964 | ? "3px solid #f87171" |
| 965 | : kind === "hunk" |
| 966 | ? "3px solid var(--accent)" |
| 967 | : "3px solid transparent", |
| 968 | }} |
| 969 | > |
| 970 | <span |
| 971 | style={{ |
| 972 | width: 48, |
| 973 | padding: "0 8px", |
| 974 | color: "var(--text-dim)", |
| 975 | background: "var(--bg-panel)", |
| 976 | borderRight: "1px solid var(--border)", |
| 977 | textAlign: "right", |
| 978 | userSelect: "none", |
| 979 | flexShrink: 0, |
| 980 | }} |
| 981 | > |
| 982 | {i + 1} |
| 983 | </span> |
| 984 | <span style={{ padding: "0 10px", whiteSpace: "pre-wrap", overflowWrap: "anywhere", color }}> |
| 985 | {line || "\u00a0"} |
| 986 | </span> |
| 987 | </div> |
| 988 | ); |
| 989 | })} |
| 990 | </div> |
nothing calls this directly
no outgoing calls
no test coverage detected