4b6817381b
Benchmark image — build + push to ECR (any adapter) / build + push (push) Waiting to run
CI / quality (ubuntu-latest) (push) Waiting to run
CI / test (tools-runtime) (push) Waiting to run
CI / test (e2e-general) (push) Waiting to run
CI / test (cli-runtime) (push) Waiting to run
CI / test (e2e-provider-and-openclaw) (push) Waiting to run
CI / test (integrations-and-misc) (push) Waiting to run
CI / coverage-report (push) Blocked by required conditions
CI / test-kubernetes (push) Waiting to run
CI / should-run-thorough (push) Waiting to run
CI / test-thorough (cloudwatch-demo) (push) Blocked by required conditions
CI / test-thorough (flink-ecs) (push) Blocked by required conditions
CI / test-thorough (upstream-lambda) (push) Blocked by required conditions
CI / test-thorough (prefect-ecs-fargate) (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Blocked by required conditions
Release / publish-release (push) Blocked by required conditions
Release / publish-main-release (push) Blocked by required conditions
Release / prepare (push) Waiting to run
Release / verify (push) Blocked by required conditions
Release / build-python-dist (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Blocked by required conditions
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Waiting to run
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
147 lines
4.5 KiB
Plaintext
147 lines
4.5 KiB
Plaintext
export const CodePreview = ({ filename, language, code, totalLines, githubUrl }) => {
|
|
const [copied, setCopied] = React.useState(false);
|
|
|
|
const handleCopy = () => {
|
|
navigator.clipboard.writeText(code);
|
|
setCopied(true);
|
|
setTimeout(() => setCopied(false), 2000);
|
|
};
|
|
|
|
return (
|
|
<div style={{
|
|
backgroundColor: '#1a1a1a',
|
|
border: '1px solid #333',
|
|
borderRadius: '0.125rem',
|
|
overflow: 'hidden',
|
|
marginTop: '1rem',
|
|
marginBottom: '1rem'
|
|
}}>
|
|
<div style={{
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'space-between',
|
|
padding: '12px 16px',
|
|
backgroundColor: '#1a1a1a',
|
|
borderBottom: '1px solid #333'
|
|
}}>
|
|
<span style={{
|
|
fontFamily: 'Monaco, Menlo, Ubuntu Mono, Consolas, source-code-pro, monospace',
|
|
fontSize: '13px',
|
|
color: '#c9d1d9',
|
|
fontWeight: '400'
|
|
}}>
|
|
{filename}
|
|
</span>
|
|
<button
|
|
onClick={handleCopy}
|
|
style={{
|
|
background: 'transparent',
|
|
border: 'none',
|
|
cursor: 'pointer',
|
|
padding: '6px',
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center'
|
|
}}
|
|
aria-label="Copy code"
|
|
>
|
|
<svg
|
|
width="18"
|
|
height="18"
|
|
viewBox="0 0 18 18"
|
|
fill="none"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
style={{
|
|
color: copied ? '#22c55e' : 'rgba(255, 255, 255, 0.4)',
|
|
stroke: copied ? '#22c55e' : 'currentColor',
|
|
fill: 'none',
|
|
transition: 'color 0.2s ease'
|
|
}}
|
|
>
|
|
{copied ? (
|
|
<path d="M15 5L7 13L3 9" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
) : (
|
|
<>
|
|
<path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
<path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
</>
|
|
)}
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<div style={{
|
|
position: 'relative',
|
|
maxHeight: '200px',
|
|
overflow: 'hidden',
|
|
backgroundColor: '#1a1a1a'
|
|
}}>
|
|
<div style={{
|
|
padding: '16px',
|
|
fontFamily: 'Monaco, Menlo, Ubuntu Mono, Consolas, source-code-pro, monospace',
|
|
fontSize: '14px',
|
|
lineHeight: '1.6',
|
|
color: '#c9d1d9',
|
|
backgroundColor: '#1a1a1a'
|
|
}}>
|
|
<pre style={{
|
|
margin: 0,
|
|
padding: 0,
|
|
background: 'transparent',
|
|
border: 'none',
|
|
whiteSpace: 'pre',
|
|
overflow: 'visible'
|
|
}}>
|
|
<code className={`language-${language}`} style={{
|
|
background: 'transparent',
|
|
padding: 0,
|
|
fontSize: '14px'
|
|
}}>
|
|
{code}
|
|
</code>
|
|
</pre>
|
|
</div>
|
|
<div style={{
|
|
position: 'absolute',
|
|
bottom: 0,
|
|
left: 0,
|
|
right: 0,
|
|
height: '80px',
|
|
background: 'linear-gradient(to bottom, transparent, #1a1a1a)',
|
|
pointerEvents: 'none'
|
|
}}></div>
|
|
</div>
|
|
<a
|
|
href={githubUrl}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
style={{
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
gap: '6px',
|
|
padding: '10px 16px',
|
|
backgroundColor: '#1a1a1a',
|
|
borderTop: '1px solid #333',
|
|
color: '#8b949e',
|
|
fontSize: '13px',
|
|
textDecoration: 'none',
|
|
transition: 'background-color 0.2s ease',
|
|
boxSizing: 'border-box',
|
|
height: '41px'
|
|
}}
|
|
onMouseEnter={(e) => {
|
|
e.currentTarget.style.backgroundColor = '#161b22';
|
|
e.currentTarget.style.textDecoration = 'none';
|
|
}}
|
|
onMouseLeave={(e) => {
|
|
e.currentTarget.style.backgroundColor = '#1a1a1a';
|
|
e.currentTarget.style.textDecoration = 'none';
|
|
}}
|
|
>
|
|
<span style={{ textDecoration: 'none' }}>...</span>
|
|
<span style={{ textDecoration: 'none' }}>See all {totalLines} lines</span>
|
|
</a>
|
|
</div>
|
|
);
|
|
};
|
|
|