make it funky
This commit is contained in:
parent
b7b7c2d7e7
commit
3db114d96b
|
|
@ -31,3 +31,14 @@
|
||||||
.test-error-text {
|
.test-error-text {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fireworks-container {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
pointer-events: none;
|
||||||
|
background: url('https://media1.tenor.com/m/iUZk-FXUd6oAAAAC/fireworks-gifkaro.gif') center center / cover no-repeat;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,12 @@ export const TestErrorView: React.FC<{
|
||||||
}> = ({ error, testId, hidePrompt }) => {
|
}> = ({ error, testId, hidePrompt }) => {
|
||||||
const html = React.useMemo(() => ansiErrorToHtml(error), [error]);
|
const html = React.useMemo(() => ansiErrorToHtml(error), [error]);
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<div className='test-error-view test-error-text' data-testid={testId}>
|
<div className='test-error-view test-error-text' data-testid={testId}>
|
||||||
{!hidePrompt && <PromptButton error={error} />}
|
|
||||||
<div dangerouslySetInnerHTML={{ __html: html || '' }}></div>
|
<div dangerouslySetInnerHTML={{ __html: html || '' }}></div>
|
||||||
</div>
|
</div>
|
||||||
|
<PromptButton error={error} />
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -52,9 +54,31 @@ const PromptButton: React.FC<{
|
||||||
if (!diff)
|
if (!diff)
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
||||||
|
const showFireworks = () => {
|
||||||
|
const fireworksContainer = document.createElement('div');
|
||||||
|
fireworksContainer.className = 'fireworks-container';
|
||||||
|
document.body.appendChild(fireworksContainer);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
document.body.removeChild(fireworksContainer);
|
||||||
|
}, 2000);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
style={{ width: 200, padding: '10px', marginBottom: '10px', borderRadius: '5px', border: '1px solid #ccc', backgroundColor: copied ? '#4caf50' : '#f0f0f0', color: copied ? '#fff' : '#000', cursor: 'pointer' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '10px',
|
||||||
|
marginTop: '10px',
|
||||||
|
borderRadius: '10px',
|
||||||
|
border: '2px solid #4caf50',
|
||||||
|
backgroundColor: copied ? '#4caf50' : '#fff',
|
||||||
|
color: copied ? '#fff' : '#4caf50',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)',
|
||||||
|
transition: 'background-color 0.3s, color 0.3s, transform 0.3s'
|
||||||
|
}}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await navigator.clipboard.writeText([
|
await navigator.clipboard.writeText([
|
||||||
'You are a helpful assistant. Help me understand the error cause. Here is the error:',
|
'You are a helpful assistant. Help me understand the error cause. Here is the error:',
|
||||||
|
|
@ -63,8 +87,12 @@ const PromptButton: React.FC<{
|
||||||
diff
|
diff
|
||||||
].join('\n\n'));
|
].join('\n\n'));
|
||||||
setCopied(true);
|
setCopied(true);
|
||||||
|
showFireworks();
|
||||||
setTimeout(() => setCopied(false), 1000);
|
setTimeout(() => setCopied(false), 1000);
|
||||||
}}>
|
}}
|
||||||
|
onMouseEnter={e => e.currentTarget.style.transform = 'scale(1.05)'}
|
||||||
|
onMouseLeave={e => e.currentTarget.style.transform = 'scale(1)'}
|
||||||
|
>
|
||||||
{copied ? 'Copied!' : 'Copy prompt to fix with AI'}
|
{copied ? 'Copied!' : 'Copy prompt to fix with AI'}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue