feat(trace-viewer): make upload button nice, add disclaimer (#10163)
This commit is contained in:
parent
1a7fb912e4
commit
3743fe1ef5
|
|
@ -21,9 +21,6 @@
|
||||||
box-shadow: var(--box-shadow);
|
box-shadow: var(--box-shadow);
|
||||||
flex: auto;
|
flex: auto;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
font-size: 24px;
|
|
||||||
color: #666;
|
|
||||||
font-weight: bold;
|
|
||||||
background-color: #fffb;
|
background-color: #fffb;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
@ -33,10 +30,25 @@
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.drop-target .title {
|
||||||
|
font-size: 24px;
|
||||||
|
color: #666;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.drop-target input {
|
.drop-target input {
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.drop-target button {
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
background-color: rgb(0, 122, 204);
|
||||||
|
padding: 6px 4px;
|
||||||
|
border: none;
|
||||||
|
margin: 40px 0;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.progress {
|
.progress {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
|
@ -85,7 +97,7 @@
|
||||||
margin-left: 16px;
|
margin-left: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.workbench .title {
|
.workbench .header .title {
|
||||||
margin-left: 16px;
|
margin-left: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ export const Workbench: React.FunctionComponent<{
|
||||||
processTraceFile(event.dataTransfer.files[0]);
|
processTraceFile(event.dataTransfer.files[0]);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFileInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleFileInputChange = (event: any) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (!event.target.files)
|
if (!event.target.files)
|
||||||
return;
|
return;
|
||||||
|
|
@ -139,8 +139,15 @@ export const Workbench: React.FunctionComponent<{
|
||||||
<div className='inner-progress' style={{ width: (100 * progress.done / progress.total) + '%' }}></div>
|
<div className='inner-progress' style={{ width: (100 * progress.done / progress.total) + '%' }}></div>
|
||||||
</div>}
|
</div>}
|
||||||
{!dragOver && !traceURL && <div className='drop-target'>
|
{!dragOver && !traceURL && <div className='drop-target'>
|
||||||
<div>Drop to upload a Playwright Trace</div>
|
<div className='title'>Drop Playwright Trace to load</div>
|
||||||
<input type='file' onChange={handleFileInputChange} />
|
<button onClick={() => {
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'file';
|
||||||
|
input.click();
|
||||||
|
input.addEventListener('change', e => handleFileInputChange(e));
|
||||||
|
}}>...or select file</button>
|
||||||
|
<div>Playwright Trace Viewer is a progressive web app, it does not send your trace anywhere,
|
||||||
|
it opens it locally instead.</div>
|
||||||
</div>}
|
</div>}
|
||||||
{dragOver && <div className='drop-target'
|
{dragOver && <div className='drop-target'
|
||||||
onDragLeave={() => { setDragOver(false); }}
|
onDragLeave={() => { setDragOver(false); }}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue