|
| 1 | +import type React from "react"; |
| 2 | +import { theme, fonts } from "./theme"; |
| 3 | + |
| 4 | +type ClaudeCodeShellProps = { |
| 5 | + children: React.ReactNode; |
| 6 | + scrollY?: number; |
| 7 | + inputText?: string; |
| 8 | + showInput?: boolean; |
| 9 | + frame?: number; |
| 10 | +}; |
| 11 | + |
| 12 | +export const ClaudeCodeShell: React.FC<ClaudeCodeShellProps> = ({ |
| 13 | + children, |
| 14 | + scrollY = 0, |
| 15 | + inputText = "", |
| 16 | + showInput = false, |
| 17 | + frame = 0, |
| 18 | +}) => { |
| 19 | + // Cost ticks up over time |
| 20 | + const cost = (0.0001 + frame * 0.000008).toFixed(4); |
| 21 | + return ( |
| 22 | + <div |
| 23 | + style={{ |
| 24 | + width: "100%", |
| 25 | + height: "100%", |
| 26 | + backgroundColor: theme.termBg, |
| 27 | + fontFamily: fonts.mono, |
| 28 | + fontSize: 18, |
| 29 | + lineHeight: 1.55, |
| 30 | + color: theme.fg, |
| 31 | + display: "flex", |
| 32 | + flexDirection: "column", |
| 33 | + overflow: "hidden", |
| 34 | + }} |
| 35 | + > |
| 36 | + {/* Terminal chrome title bar */} |
| 37 | + <div |
| 38 | + style={{ |
| 39 | + height: 48, |
| 40 | + flexShrink: 0, |
| 41 | + backgroundColor: theme.bg, |
| 42 | + display: "flex", |
| 43 | + alignItems: "center", |
| 44 | + paddingLeft: 16, |
| 45 | + paddingRight: 16, |
| 46 | + borderBottom: `1px solid ${theme.border}`, |
| 47 | + }} |
| 48 | + > |
| 49 | + {/* Traffic lights */} |
| 50 | + <div style={{ display: "flex", gap: 7 }}> |
| 51 | + <div style={{ width: 12, height: 12, borderRadius: "50%", backgroundColor: "#FF5F57" }} /> |
| 52 | + <div style={{ width: 12, height: 12, borderRadius: "50%", backgroundColor: "#FEBC2E" }} /> |
| 53 | + <div style={{ width: 12, height: 12, borderRadius: "50%", backgroundColor: "#28C840" }} /> |
| 54 | + </div> |
| 55 | + |
| 56 | + {/* Center title */} |
| 57 | + <div style={{ flex: 1, textAlign: "center", fontSize: 15, color: theme.comment }}> |
| 58 | + claude — ~/papertrail |
| 59 | + </div> |
| 60 | + |
| 61 | + {/* Watermark */} |
| 62 | + <div |
| 63 | + style={{ |
| 64 | + display: "flex", |
| 65 | + alignItems: "center", |
| 66 | + gap: 10, |
| 67 | + fontSize: 18, |
| 68 | + opacity: 0.8, |
| 69 | + }} |
| 70 | + > |
| 71 | + <span> |
| 72 | + <span style={{ color: theme.fgBright, fontWeight: "bold" }}>agent</span> |
| 73 | + <span style={{ color: theme.green, fontWeight: "bold" }}>crumbs</span> |
| 74 | + </span> |
| 75 | + <span style={{ color: theme.comment, fontSize: 15 }}>by</span> |
| 76 | + <span style={{ color: theme.comment, fontSize: 15, display: "flex", alignItems: "center", gap: 5 }}> |
| 77 | + <svg width="15" height="15" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 78 | + <path fillRule="evenodd" clipRule="evenodd" d="M41.6889 52.2795L60.4195 20L106.839 100H14L32.7305 67.7195L45.9801 75.3312L40.5003 84.7756H80.3387L60.4195 50.4478L54.9396 59.8922L41.6889 52.2795Z" fill="#A8FF53"/> |
| 79 | + </svg> |
| 80 | + Trigger.dev |
| 81 | + </span> |
| 82 | + </div> |
| 83 | + </div> |
| 84 | + |
| 85 | + {/* Scrollable content area — content pinned to bottom */} |
| 86 | + <div |
| 87 | + style={{ |
| 88 | + flex: 1, |
| 89 | + overflow: "hidden", |
| 90 | + display: "flex", |
| 91 | + flexDirection: "column", |
| 92 | + justifyContent: "flex-end", |
| 93 | + }} |
| 94 | + > |
| 95 | + <div |
| 96 | + style={{ |
| 97 | + padding: "0 24px 12px", |
| 98 | + transform: `translateY(${-scrollY}px)`, |
| 99 | + }} |
| 100 | + > |
| 101 | + {children} |
| 102 | + </div> |
| 103 | + </div> |
| 104 | + |
| 105 | + {/* Input bar */} |
| 106 | + {showInput && ( |
| 107 | + <div |
| 108 | + style={{ |
| 109 | + flexShrink: 0, |
| 110 | + borderTop: `1px solid ${theme.border}`, |
| 111 | + padding: "10px 20px", |
| 112 | + fontSize: 18, |
| 113 | + }} |
| 114 | + > |
| 115 | + <span style={{ color: theme.comment }}>{"› "}</span> |
| 116 | + <span style={{ color: theme.fgBright }}>{inputText}</span> |
| 117 | + <span |
| 118 | + style={{ |
| 119 | + backgroundColor: theme.fg, |
| 120 | + width: 10, |
| 121 | + height: 20, |
| 122 | + display: "inline-block", |
| 123 | + marginLeft: 1, |
| 124 | + verticalAlign: "text-bottom", |
| 125 | + }} |
| 126 | + /> |
| 127 | + </div> |
| 128 | + )} |
| 129 | + |
| 130 | + {/* Footer status bar */} |
| 131 | + <div |
| 132 | + style={{ |
| 133 | + height: 36, |
| 134 | + flexShrink: 0, |
| 135 | + borderTop: `1px solid ${theme.border}`, |
| 136 | + display: "flex", |
| 137 | + alignItems: "center", |
| 138 | + justifyContent: "space-between", |
| 139 | + paddingLeft: 20, |
| 140 | + paddingRight: 20, |
| 141 | + fontSize: 14, |
| 142 | + color: theme.comment, |
| 143 | + }} |
| 144 | + > |
| 145 | + <div> |
| 146 | + <span style={{ color: theme.green }}>{"▸▸ "}</span> |
| 147 | + <span style={{ color: theme.green }}>accept edits on</span> |
| 148 | + <span>{" (shift+tab to cycle)"}</span> |
| 149 | + </div> |
| 150 | + <div> |
| 151 | + papertrail | Opus 4.6 (1M context) | ${cost} |
| 152 | + </div> |
| 153 | + </div> |
| 154 | + </div> |
| 155 | + ); |
| 156 | +}; |
| 157 | + |
| 158 | +// Styled spans for Claude Code output |
| 159 | +export const Prompt: React.FC<{ children: React.ReactNode }> = ({ |
| 160 | + children, |
| 161 | +}) => <span style={{ color: theme.green }}>{"❯ "}</span>; |
| 162 | + |
| 163 | +export const ClaudeIcon: React.FC = () => ( |
| 164 | + <span style={{ color: "#D4A574" }}>{"⏺ "}</span> |
| 165 | +); |
| 166 | + |
| 167 | +export const Dim: React.FC<{ children: React.ReactNode }> = ({ children }) => ( |
| 168 | + <span style={{ color: theme.comment }}>{children}</span> |
| 169 | +); |
| 170 | + |
| 171 | +export const Bright: React.FC<{ children: React.ReactNode }> = ({ |
| 172 | + children, |
| 173 | +}) => <span style={{ color: theme.fgBright }}>{children}</span>; |
| 174 | + |
| 175 | +export const Keyword: React.FC<{ children: React.ReactNode }> = ({ |
| 176 | + children, |
| 177 | +}) => <span style={{ color: theme.keyword }}>{children}</span>; |
| 178 | + |
| 179 | +export const Str: React.FC<{ children: React.ReactNode }> = ({ children }) => ( |
| 180 | + <span style={{ color: theme.string }}>{children}</span> |
| 181 | +); |
| 182 | + |
| 183 | +export const Fn: React.FC<{ children: React.ReactNode }> = ({ children }) => ( |
| 184 | + <span style={{ color: theme.function }}>{children}</span> |
| 185 | +); |
| 186 | + |
| 187 | +export const Comment: React.FC<{ children: React.ReactNode }> = ({ |
| 188 | + children, |
| 189 | +}) => <span style={{ color: theme.comment }}>{children}</span>; |
| 190 | + |
| 191 | +export const Type: React.FC<{ children: React.ReactNode }> = ({ |
| 192 | + children, |
| 193 | +}) => <span style={{ color: theme.type }}>{children}</span>; |
| 194 | + |
| 195 | +export const Err: React.FC<{ children: React.ReactNode }> = ({ |
| 196 | + children, |
| 197 | +}) => <span style={{ color: theme.error }}>{children}</span>; |
0 commit comments