Address PR comments
This commit is contained in:
parent
ddd2b8c828
commit
f55e427cfb
|
|
@ -7,5 +7,4 @@
|
||||||
../geometry.ts
|
../geometry.ts
|
||||||
../../../playwright/src/isomorphic/**
|
../../../playwright/src/isomorphic/**
|
||||||
../third_party/devtools.ts
|
../third_party/devtools.ts
|
||||||
./settings/**
|
|
||||||
./shared/**
|
./shared/**
|
||||||
|
|
@ -17,13 +17,16 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { SettingsView } from './settingsView';
|
import { SettingsView } from './settingsView';
|
||||||
import { useDarkModeSetting } from '@web/theme';
|
import { useDarkModeSetting } from '@web/theme';
|
||||||
import { useShouldPopulateCanvasFromScreenshot } from './settings/useShouldPopulateCanvasFromScreenshot';
|
import { useSetting } from '@web/uiUtils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A view of the collection of standard settings used between various applications
|
||||||
|
*/
|
||||||
export const DefaultSettingsView: React.FC<{}> = () => {
|
export const DefaultSettingsView: React.FC<{}> = () => {
|
||||||
const [
|
const [
|
||||||
shouldPopulateCanvasFromScreenshot,
|
shouldPopulateCanvasFromScreenshot,
|
||||||
setShouldPopulateCanvasFromScreenshot,
|
setShouldPopulateCanvasFromScreenshot,
|
||||||
] = useShouldPopulateCanvasFromScreenshot();
|
] = useSetting('shouldPopulateCanvasFromScreenshot', false);
|
||||||
const [darkMode, setDarkMode] = useDarkModeSetting();
|
const [darkMode, setDarkMode] = useDarkModeSetting();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Microsoft Corporation.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { useSetting } from '@web/uiUtils';
|
|
||||||
|
|
||||||
export const useShouldPopulateCanvasFromScreenshot = (): [
|
|
||||||
boolean,
|
|
||||||
(value: boolean) => void
|
|
||||||
] => useSetting('shouldPopulateCanvasFromScreenshot', false);
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) Microsoft Corporation.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.settings-toolbar-dialog {
|
|
||||||
background-color: var(--vscode-sideBar-background);
|
|
||||||
|
|
||||||
padding: 4px 8px;
|
|
||||||
}
|
|
||||||
|
|
@ -18,7 +18,6 @@ import * as React from 'react';
|
||||||
import { Dialog } from './shared/dialog';
|
import { Dialog } from './shared/dialog';
|
||||||
import { ToolbarButton } from '@web/components/toolbarButton';
|
import { ToolbarButton } from '@web/components/toolbarButton';
|
||||||
import { DefaultSettingsView } from './defaultSettingsView';
|
import { DefaultSettingsView } from './defaultSettingsView';
|
||||||
import './settingsToolbar.css';
|
|
||||||
|
|
||||||
export const SettingsToolbarButton: React.FC<{}> = () => {
|
export const SettingsToolbarButton: React.FC<{}> = () => {
|
||||||
const hostingRef = React.useRef<HTMLButtonElement>(null);
|
const hostingRef = React.useRef<HTMLButtonElement>(null);
|
||||||
|
|
@ -34,7 +33,10 @@ export const SettingsToolbarButton: React.FC<{}> = () => {
|
||||||
onClick={() => setOpen(current => !current)}
|
onClick={() => setOpen(current => !current)}
|
||||||
/>
|
/>
|
||||||
<Dialog
|
<Dialog
|
||||||
className='settings-toolbar-dialog'
|
style={{
|
||||||
|
backgroundColor: 'var(--vscode-sideBar-background)',
|
||||||
|
padding: '4px 8px'
|
||||||
|
}}
|
||||||
open={open}
|
open={open}
|
||||||
width={200}
|
width={200}
|
||||||
// TODO: Temporary spacing until design of toolbar buttons is revisited
|
// TODO: Temporary spacing until design of toolbar buttons is revisited
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import * as React from 'react';
|
||||||
|
|
||||||
export interface DialogProps {
|
export interface DialogProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
|
style?: React.CSSProperties;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
width: number;
|
width: number;
|
||||||
verticalOffset?: number;
|
verticalOffset?: number;
|
||||||
|
|
@ -27,6 +28,7 @@ export interface DialogProps {
|
||||||
|
|
||||||
export const Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({
|
export const Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({
|
||||||
className,
|
className,
|
||||||
|
style: externalStyle,
|
||||||
open,
|
open,
|
||||||
width,
|
width,
|
||||||
verticalOffset,
|
verticalOffset,
|
||||||
|
|
@ -39,7 +41,7 @@ export const Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const [_, setRecalculateDimensionsCount] = React.useState(0);
|
const [_, setRecalculateDimensionsCount] = React.useState(0);
|
||||||
|
|
||||||
let style: React.CSSProperties | undefined = undefined;
|
let style: React.CSSProperties | undefined = externalStyle;
|
||||||
|
|
||||||
if (anchor?.current) {
|
if (anchor?.current) {
|
||||||
const bounds = anchor.current.getBoundingClientRect();
|
const bounds = anchor.current.getBoundingClientRect();
|
||||||
|
|
@ -50,6 +52,7 @@ export const Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({
|
||||||
left: buildTopLeftCoord(bounds, width),
|
left: buildTopLeftCoord(bounds, width),
|
||||||
width,
|
width,
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
|
...externalStyle
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import type { ActionTraceEvent } from '@trace/trace';
|
||||||
import { context, type MultiTraceModel, prevInList } from './modelUtil';
|
import { context, type MultiTraceModel, prevInList } from './modelUtil';
|
||||||
import { Toolbar } from '@web/components/toolbar';
|
import { Toolbar } from '@web/components/toolbar';
|
||||||
import { ToolbarButton } from '@web/components/toolbarButton';
|
import { ToolbarButton } from '@web/components/toolbarButton';
|
||||||
import { clsx, useMeasure } from '@web/uiUtils';
|
import { clsx, useMeasure, useSetting } from '@web/uiUtils';
|
||||||
import { InjectedScript } from '@injected/injectedScript';
|
import { InjectedScript } from '@injected/injectedScript';
|
||||||
import { Recorder } from '@injected/recorder/recorder';
|
import { Recorder } from '@injected/recorder/recorder';
|
||||||
import ConsoleAPI from '@injected/consoleApi';
|
import ConsoleAPI from '@injected/consoleApi';
|
||||||
|
|
@ -30,7 +30,6 @@ import { locatorOrSelectorAsSelector } from '@isomorphic/locatorParser';
|
||||||
import { TabbedPaneTab } from '@web/components/tabbedPane';
|
import { TabbedPaneTab } from '@web/components/tabbedPane';
|
||||||
import { BrowserFrame } from './browserFrame';
|
import { BrowserFrame } from './browserFrame';
|
||||||
import type { ElementInfo } from '@recorder/recorderTypes';
|
import type { ElementInfo } from '@recorder/recorderTypes';
|
||||||
import { useShouldPopulateCanvasFromScreenshot } from './settings/useShouldPopulateCanvasFromScreenshot';
|
|
||||||
|
|
||||||
export const SnapshotTabsView: React.FunctionComponent<{
|
export const SnapshotTabsView: React.FunctionComponent<{
|
||||||
action: ActionTraceEvent | undefined,
|
action: ActionTraceEvent | undefined,
|
||||||
|
|
@ -45,7 +44,7 @@ export const SnapshotTabsView: React.FunctionComponent<{
|
||||||
const [snapshotTab, setSnapshotTab] = React.useState<'action'|'before'|'after'>('action');
|
const [snapshotTab, setSnapshotTab] = React.useState<'action'|'before'|'after'>('action');
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const [shouldPopulateCanvasFromScreenshot, _] = useShouldPopulateCanvasFromScreenshot();
|
const [shouldPopulateCanvasFromScreenshot, _] = useSetting('shouldPopulateCanvasFromScreenshot', false);
|
||||||
|
|
||||||
const snapshots = React.useMemo(() => {
|
const snapshots = React.useMemo(() => {
|
||||||
return collectSnapshots(action);
|
return collectSnapshots(action);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import { ToolbarButton } from '@web/components/toolbarButton';
|
||||||
import { Toolbar } from '@web/components/toolbar';
|
import { Toolbar } from '@web/components/toolbar';
|
||||||
import type { XtermDataSource } from '@web/components/xtermWrapper';
|
import type { XtermDataSource } from '@web/components/xtermWrapper';
|
||||||
import { XtermWrapper } from '@web/components/xtermWrapper';
|
import { XtermWrapper } from '@web/components/xtermWrapper';
|
||||||
import { useDarkModeSetting } from '@web/theme';
|
|
||||||
import { clsx, settings, useSetting } from '@web/uiUtils';
|
import { clsx, settings, useSetting } from '@web/uiUtils';
|
||||||
import { statusEx, TestTree } from '@testIsomorphic/testTree';
|
import { statusEx, TestTree } from '@testIsomorphic/testTree';
|
||||||
import type { TreeItem } from '@testIsomorphic/testTree';
|
import type { TreeItem } from '@testIsomorphic/testTree';
|
||||||
|
|
@ -105,7 +104,6 @@ export const UIModeView: React.FC<{}> = ({
|
||||||
const [singleWorker, setSingleWorker] = React.useState(false);
|
const [singleWorker, setSingleWorker] = React.useState(false);
|
||||||
const [showBrowser, setShowBrowser] = React.useState(false);
|
const [showBrowser, setShowBrowser] = React.useState(false);
|
||||||
const [updateSnapshots, setUpdateSnapshots] = React.useState(false);
|
const [updateSnapshots, setUpdateSnapshots] = React.useState(false);
|
||||||
const [darkMode, setDarkMode] = useDarkModeSetting();
|
|
||||||
|
|
||||||
const inputRef = React.useRef<HTMLInputElement>(null);
|
const inputRef = React.useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue