feat(trace-viewer) apply updates as per code review

https://github.com/microsoft/playwright/pull/31394
This commit is contained in:
Ryan Rosello 2024-07-02 20:25:48 +10:00
parent 22b008c433
commit e0e4ca6d15
2 changed files with 9 additions and 9 deletions

View file

@ -32,7 +32,7 @@
z-index: 10;
}
.copy-icon.codicon {
.source-tab-file-name .copy-icon.codicon {
display: block;
cursor: pointer;
}

View file

@ -81,14 +81,6 @@ export const SourceTab: React.FunctionComponent<{
const showStackFrames = (stack?.length ?? 0) > 1;
const getFileName = (fullPath?: string, lineNum?: number) => {
if (!fullPath)
return '';
const pathSep = fullPath?.includes('/') ? '/' : '\\';
const fileName = fullPath?.split(pathSep).pop() ?? '';
return lineNum ? `${fileName}:${lineNum}` : fileName;
};
return <SplitView sidebarSize={200} orientation={stackFrameLocation === 'bottom' ? 'vertical' : 'horizontal'} sidebarHidden={!showStackFrames}>
<div className='vbox' data-testid='source-code'>
{fileName && (
@ -116,3 +108,11 @@ export async function calculateSha1(text: string): Promise<string> {
}
return hexCodes.join('');
}
function getFileName(fullPath?: string, lineNum?: number): string {
if (!fullPath)
return '';
const pathSep = fullPath?.includes('/') ? '/' : '\\';
const fileName = fullPath?.split(pathSep).pop() ?? '';
return lineNum ? `${fileName}:${lineNum}` : fileName;
}