From 9f05f03fc94ac9f691ada382fccee15349744bf4 Mon Sep 17 00:00:00 2001 From: Adam Gastineau Date: Mon, 6 Jan 2025 06:48:34 -0800 Subject: [PATCH] Add setting support to recorderView --- .../trace-viewer/src/ui/recorder/recorderView.tsx | 13 ++++++++----- packages/trace-viewer/src/ui/shared/dialog.tsx | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/trace-viewer/src/ui/recorder/recorderView.tsx b/packages/trace-viewer/src/ui/recorder/recorderView.tsx index 4feb934d2d..0314ebca1b 100644 --- a/packages/trace-viewer/src/ui/recorder/recorderView.tsx +++ b/packages/trace-viewer/src/ui/recorder/recorderView.tsx @@ -21,7 +21,6 @@ import type { TabbedPaneTabModel } from '@web/components/tabbedPane'; import { TabbedPane } from '@web/components/tabbedPane'; import { Toolbar } from '@web/components/toolbar'; import { ToolbarButton, ToolbarSeparator } from '@web/components/toolbarButton'; -import { toggleTheme } from '@web/theme'; import { copy, useSetting } from '@web/uiUtils'; import * as React from 'react'; import { ConsoleTab, useConsoleTabModel } from '../consoleTab'; @@ -37,6 +36,7 @@ import './recorderView.css'; import { ActionListView } from './actionListView'; import { BackendContext, BackendProvider } from './backendContext'; import type { Language } from '@isomorphic/locatorGenerators'; +import { SettingsToolbarButton } from '../settingsToolbarButton'; export const RecorderView: React.FunctionComponent = () => { const searchParams = new URLSearchParams(window.location.search); @@ -148,7 +148,7 @@ export const Workbench: React.FunctionComponent = () => { { setFileId(fileId); }} /> - toggleTheme()}> + ; const sidebarTabbedPane = ; @@ -271,6 +271,10 @@ const TraceView: React.FunctionComponent<{ setHighlightedLocator, }) => { const model = React.useContext(ModelContext); + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const [shouldPopulateCanvasFromScreenshot, _] = useSetting('shouldPopulateCanvasFromScreenshot', false); + const action = React.useMemo(() => { return model?.actions.find(a => a.callId === callId); }, [model, callId]); @@ -280,9 +284,8 @@ const TraceView: React.FunctionComponent<{ return snapshot.action || snapshot.after || snapshot.before; }, [action]); const snapshotUrls = React.useMemo(() => { - // TODO: Use actual setting. Requires settings UI to be wired up - return snapshot ? extendSnapshot(snapshot, false) : undefined; - }, [snapshot]); + return snapshot ? extendSnapshot(snapshot, shouldPopulateCanvasFromScreenshot) : undefined; + }, [snapshot, shouldPopulateCanvasFromScreenshot]); return > = ({ const bounds = anchor.current.getBoundingClientRect(); style = { + position: 'fixed', margin: 0, top: bounds.bottom + (verticalOffset ?? 0), left: buildTopLeftCoord(bounds, width),