From a6233d2fc4366c88fd5d9d9978268236b58dae33 Mon Sep 17 00:00:00 2001 From: Kevin Zheng Date: Mon, 26 Feb 2024 02:13:46 +1100 Subject: [PATCH] Major improvements to layer workflow --- .../src/components/app-bar/FeaturePicker.tsx | 12 +- .../app-bar/FeaturePickerButton.tsx | 6 +- .../components/app-bar/FeaturePickerMulti.tsx | 2 +- client/src/components/app-bar/Input.tsx | 8 +- client/src/components/generic/ListEditor.tsx | 237 +++++++------- client/src/components/generic/Overline.tsx | 1 - client/src/components/generic/Scrollbars.tsx | 5 + client/src/components/generic/Select.tsx | 3 + .../components/inspector/TraceRenderer.tsx | 2 +- .../src/components/inspector/ViewControls.tsx | 6 +- client/src/components/inspector/ViewTree.tsx | 8 +- .../components/layer-editor/LayerEditor.tsx | 291 ++++++++++-------- .../layer-editor/LayerListEditor.tsx | 26 +- .../settings-editor/RendererEditor.tsx | 19 +- .../settings-editor/RendererListEditor.tsx | 15 +- .../settings-editor/ServerEditor.tsx | 21 +- .../settings-editor/ServerListEditor.tsx | 6 +- client/src/layers/layerHandlers.tsx | 2 +- client/src/layers/map/index.tsx | 3 - client/src/layers/query/index.tsx | 16 +- client/src/layers/trace/index.tsx | 8 +- client/src/pages/AboutPage.tsx | 1 - client/src/pages/DebugPage.tsx | 2 +- client/src/pages/LayersPage.tsx | 12 +- client/src/pages/SettingsPage.tsx | 2 +- client/src/pages/StepsPage.tsx | 146 ++++++--- client/src/pages/TreePage.tsx | 6 +- client/src/pages/ViewportPage.tsx | 2 +- client/src/public/manifest.json | 4 +- client/src/theme.tsx | 5 +- 30 files changed, 528 insertions(+), 349 deletions(-) diff --git a/client/src/components/app-bar/FeaturePicker.tsx b/client/src/components/app-bar/FeaturePicker.tsx index 13b9236f..6a175fa8 100644 --- a/client/src/components/app-bar/FeaturePicker.tsx +++ b/client/src/components/app-bar/FeaturePicker.tsx @@ -5,7 +5,7 @@ import { Space } from "components/generic/Space"; import { find, map, startCase, truncate } from "lodash"; import { FeatureDescriptor } from "protocol/FeatureQuery"; import { ReactElement, ReactNode, cloneElement } from "react"; -import { AccentColor, getShade } from "theme"; +import { AccentColor, getShade, usePaper } from "theme"; import { FeaturePickerButton } from "./FeaturePickerButton"; export type Props = { @@ -15,11 +15,12 @@ export type Props = { onChange?: (key: string) => void; items?: (FeatureDescriptor & { icon?: ReactNode; color?: AccentColor })[]; icon?: ReactNode; - showArrow?: boolean; + arrow?: boolean; disabled?: boolean; ButtonProps?: ButtonProps; itemOrientation?: "vertical" | "horizontal"; ellipsis?: number; + paper?: boolean; }; export function FeaturePicker({ @@ -28,13 +29,15 @@ export function FeaturePicker({ onChange, items, icon, - showArrow, + arrow, disabled, ButtonProps, showTooltip, itemOrientation = "horizontal", ellipsis = Infinity, + paper: _paper, }: Props) { + const paper = usePaper(); const { palette } = useTheme(); const getIcon = (icon: ReactNode, color?: AccentColor) => @@ -54,9 +57,10 @@ export function FeaturePicker({ {truncate(selected?.name ?? label, { length: ellipsis })} diff --git a/client/src/components/app-bar/FeaturePickerButton.tsx b/client/src/components/app-bar/FeaturePickerButton.tsx index 8eecd98e..2adb8eef 100644 --- a/client/src/components/app-bar/FeaturePickerButton.tsx +++ b/client/src/components/app-bar/FeaturePickerButton.tsx @@ -5,9 +5,9 @@ import { Props } from "./FeaturePicker"; export function FeaturePickerButton({ children, icon, - showArrow, + arrow, ...props -}: ButtonProps & Pick) { +}: ButtonProps & Pick) { return (