Skip to content

Commit

Permalink
cherry-pick(#27008): chore: polish ui mode for better mac appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman committed Sep 12, 2023
1 parent 5f78f27 commit 9981f14
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
1 change: 1 addition & 0 deletions packages/trace-viewer/src/ui/uiModeView.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@

.filter-list {
padding: 0 10px 10px 10px;
user-select: none;
}

.filter-title,
Expand Down
29 changes: 14 additions & 15 deletions packages/trace-viewer/src/ui/uiModeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,22 @@ export const UIModeView: React.FC<{}> = ({
}, [closeInstallDialog]);

return <div className='vbox ui-mode'>
{!hasBrowsers && <dialog ref={dialogRef}>
<div className='title'><span className='codicon codicon-lightbulb'></span>Install browsers</div>
<div className='body'>
Playwright did not find installed browsers.
<br></br>
Would you like to run `playwright install`?
<br></br>
<button className='button' onClick={installBrowsers}>Install</button>
<button className='button secondary' onClick={closeInstallDialog}>Dismiss</button>
</div>
</dialog>}
{isDisconnected && <div className='drop-target'>
<div className='title'>UI Mode disconnected</div>
<div><a href='#' onClick={() => window.location.reload()}>Reload the page</a> to reconnect</div>
</div>}
<SplitView sidebarSize={250} minSidebarSize={125} orientation='horizontal' sidebarIsFirst={true}>
<SplitView sidebarSize={250} minSidebarSize={150} orientation='horizontal' sidebarIsFirst={true} settingName='testListSidebar'>
<div className='vbox'>
<div className={'vbox' + (isShowingOutput ? '' : ' hidden')}>
<Toolbar>
Expand All @@ -216,19 +227,7 @@ export const UIModeView: React.FC<{}> = ({
<ToolbarButton icon='color-mode' title='Toggle color mode' onClick={() => toggleTheme()} />
<ToolbarButton icon='refresh' title='Reload' onClick={() => reloadTests()} disabled={isRunningTest || isLoading}></ToolbarButton>
<ToolbarButton icon='terminal' title='Toggle output' toggled={isShowingOutput} onClick={() => { setIsShowingOutput(!isShowingOutput); }} />
{!hasBrowsers && <ToolbarButton icon='lightbulb-autofix' style={{ color: 'var(--vscode-list-warningForeground)' }} title='Playwright browsers are missing' toggled={isShowingOutput} onClick={openInstallDialog}>
<dialog ref={dialogRef}>
<div className='title'><span className='codicon codicon-lightbulb'></span>Install browsers</div>
<div className='body'>
Playwright did not find installed browsers.
<br></br>
Would you like to run `playwright install`?
<br></br>
<button className='button' onClick={installBrowsers}>Yes</button>
<button className='button secondary' onClick={closeInstallDialog}>No</button>
</div>
</dialog>
</ToolbarButton>}
{!hasBrowsers && <ToolbarButton icon='lightbulb-autofix' style={{ color: 'var(--vscode-list-warningForeground)' }} title='Playwright browsers are missing' onClick={openInstallDialog} />}
</Toolbar>
<FiltersView
filterText={filterText}
Expand Down Expand Up @@ -335,7 +334,7 @@ const FiltersView: React.FC<{
if (configFile)
settings.setObject(configFile + ':projects', [...copy.entries()].filter(([_, v]) => v).map(([k]) => k));
}}/>
<div>{projectName}</div>
<div>{projectName || 'untitled'}</div>
</label>
</div>;
})}
Expand Down
2 changes: 1 addition & 1 deletion packages/trace-viewer/src/ui/workbench.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export const Workbench: React.FunctionComponent<{
selectedTime={selectedTime}
setSelectedTime={setSelectedTime}
/>
<SplitView sidebarSize={250} orientation='horizontal' sidebarIsFirst={true}>
<SplitView sidebarSize={250} orientation='horizontal' sidebarIsFirst={true} settingName='actionListSidebar'>
<SplitView sidebarSize={250} orientation={sidebarLocation === 'bottom' ? 'vertical' : 'horizontal'} settingName='propertiesSidebar'>
<SnapshotTab
action={activeAction}
Expand Down
2 changes: 2 additions & 0 deletions packages/web/src/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ dialog .title .codicon {

dialog .body {
padding: 10px;
text-align: center;
}

.button {
Expand All @@ -89,6 +90,7 @@ dialog .body {
height: 28px;
min-width: 40px;
cursor: pointer;
user-select: none;
}

.button:focus {
Expand Down
3 changes: 2 additions & 1 deletion packages/web/src/components/errorMessage.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
font-weight: var(--vscode-editor-font-weight);
font-size: var(--vscode-editor-font-size);
background-color: var(--vscode-inputValidation-errorBackground);
white-space: pre;
white-space: pre-wrap;
word-break: break-word;
padding: 10px;
}
4 changes: 2 additions & 2 deletions packages/web/src/components/splitView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export const SplitView: React.FC<SplitViewProps> = ({
settingName,
children
}) => {
const [hSize, setHSize] = useSetting<number>(settingName ? settingName + '.' + orientation + ':size' : undefined, Math.max(minSidebarSize, sidebarSize));
const [vSize, setVSize] = useSetting<number>(settingName ? settingName + '.' + orientation + ':size' : undefined, Math.max(minSidebarSize, sidebarSize));
const [hSize, setHSize] = useSetting<number>(settingName ? settingName + '.' + orientation + ':size' : undefined, Math.max(minSidebarSize, sidebarSize) * window.devicePixelRatio);
const [vSize, setVSize] = useSetting<number>(settingName ? settingName + '.' + orientation + ':size' : undefined, Math.max(minSidebarSize, sidebarSize) * window.devicePixelRatio);
const [resizing, setResizing] = React.useState<{ offset: number, size: number } | null>(null);
const [measure, ref] = useMeasure<HTMLDivElement>();

Expand Down

0 comments on commit 9981f14

Please sign in to comment.