From 3b97eb944d9ed6d0c2ec37a09eff61ebc04185c1 Mon Sep 17 00:00:00 2001 From: Miyuru Gunarathna Date: Sun, 11 Aug 2024 21:09:04 +0530 Subject: [PATCH 1/2] Fix: few more ui issues --- src/components/controls/image.tsx | 2 +- src/components/controls/index.tsx | 4 +-- .../controls/select/polyline/index.tsx | 8 +++-- .../select/polyline/section-selector.tsx | 36 ++++++++++--------- .../controls/select/seats/categorizer.tsx | 2 +- src/components/core/input.tsx | 2 +- src/components/core/popover.tsx | 2 +- src/components/core/select.tsx | 4 +-- src/components/core/tooltip.tsx | 2 +- src/components/index.tsx | 2 +- src/components/operations/index.tsx | 2 +- src/components/toolbar/index.tsx | 4 +-- src/components/workspace/actions.tsx | 0 src/components/workspace/dock/index.tsx | 2 +- 14 files changed, 40 insertions(+), 32 deletions(-) delete mode 100644 src/components/workspace/actions.tsx diff --git a/src/components/controls/image.tsx b/src/components/controls/image.tsx index 9096f13..7e7b0bc 100644 --- a/src/components/controls/image.tsx +++ b/src/components/controls/image.tsx @@ -51,7 +51,7 @@ const ImageControls = ({ options: { maxImageSize = 1024000 } = {} }: IImageContr return (
{file ? ( diff --git a/src/components/controls/index.tsx b/src/components/controls/index.tsx index 39840a9..8ef8dae 100644 --- a/src/components/controls/index.tsx +++ b/src/components/controls/index.tsx @@ -59,13 +59,13 @@ const Controls = ({ options, styles }: IControlProps) => {
-
+
Settings
{ const firstElement = document.getElementById(selectedElementIds[0]); return ( -
+
-
+
{ d3Extended.selectById(id).style("stroke", e.target.value); }); }} + className="p-0 px-[.125rem]" /> +
+
{ d3Extended.selectById(id).style("color", e.target.value); }); }} + className="p-0 px-[.125rem]" />
diff --git a/src/components/controls/select/polyline/section-selector.tsx b/src/components/controls/select/polyline/section-selector.tsx index e6c1337..bfb4390 100644 --- a/src/components/controls/select/polyline/section-selector.tsx +++ b/src/components/controls/select/polyline/section-selector.tsx @@ -1,4 +1,4 @@ -import { DollarSign, Plus, X } from "lucide-react"; +import { DollarSign, Plus, Settings2, X } from "lucide-react"; import { useSelector } from "react-redux"; import { default as debounce } from "lodash/debounce"; import { twMerge } from "tailwind-merge"; @@ -7,7 +7,7 @@ import { dataAttributes } from "@/constants"; import { store } from "@/store"; import { addSection, deleteSection, updatePolylines, updateSection } from "@/store/reducers/editor"; import { ISTKProps } from "@/types"; -import { Callout, Caption, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../core"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../core"; const onAddSection = () => store.dispatch(addSection(undefined)); @@ -20,8 +20,8 @@ type IControlProps = Pick; export const SectionManager = ({ options }: IControlProps) => { const sections = useSelector((state: any) => state.editor.sections); return ( -
-
+
+
Sections
state.editor.sections); return ( <> -
- Sections - - - - Manage - - - - - - +
+
+
Sections
+ + + } + /> + + + + + +
span]:line-clamp-1", + "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-gray-200 bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className )} {...props} @@ -76,7 +76,7 @@ const SelectContent = React.forwardRef< = (props) => { <>
= ({
= (props) => { return (
-
+
{Object.entries(tools).map(([key, value]) => { diff --git a/src/components/workspace/actions.tsx b/src/components/workspace/actions.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/workspace/dock/index.tsx b/src/components/workspace/dock/index.tsx index 326c938..a4ae5b1 100644 --- a/src/components/workspace/dock/index.tsx +++ b/src/components/workspace/dock/index.tsx @@ -120,7 +120,7 @@ const Dock = (props: Pick) >
div]:shrink-0 gap-2 transition-all duration-500 ease-in-out opacity-100", + "border-t sm:border border-gray-200 w-full sm:w-fit bg-white p-3 sm:p-2 overflow-x-auto sm:rounded-lg flex justify-center [&>div]:shrink-0 gap-2 transition-all duration-500 ease-in-out opacity-100", panStyles?.root?.className, !dock && "translate-y-20 opacity-0" )} From 565a2d170fa2c0de79ec01c39dc81b9fa8416220 Mon Sep 17 00:00:00 2001 From: Miyuru Gunarathna Date: Sun, 11 Aug 2024 21:26:20 +0530 Subject: [PATCH 2/2] Feat: added extended styles for dock --- src/components/workspace/dock/index.tsx | 19 ++++++++++++------- src/types/styles.ts | 4 ++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/components/workspace/dock/index.tsx b/src/components/workspace/dock/index.tsx index a4ae5b1..10ab2cc 100644 --- a/src/components/workspace/dock/index.tsx +++ b/src/components/workspace/dock/index.tsx @@ -97,9 +97,11 @@ const Dock = (props: Pick) const zoomStyles = props.styles?.zoomControls; const panStyles = props.styles?.panControls; + const dockStyles = props.styles?.dock; + const isDesigner = props.mode === "designer"; const showZoomControls = props.options?.showZoomControls ?? true; - const showVisibilityControls = props.mode === "designer" && (props.options?.showVisibilityControls ?? true); + const showVisibilityControls = isDesigner && (props.options?.showVisibilityControls ?? true); const showReloadButton = props.options?.showReloadButton ?? false; const isUser = props.mode === "user"; @@ -110,21 +112,24 @@ const Dock = (props: Pick) {showReloadButton && ( )} - + {(showZoomControls || showVisibilityControls) && }
)} {(showZoomControls || showVisibilityControls) && (
div]:shrink-0 gap-2 transition-all duration-500 ease-in-out opacity-100", - panStyles?.root?.className, + "border border-gray-200 w-fit bg-white p-2 overflow-x-auto rounded-lg flex justify-center [&>div]:shrink-0 gap-2 transition-all duration-500 ease-in-out opacity-100 pointer-events-auto", + dockStyles?.container?.className, !dock && "translate-y-20 opacity-0" )} - style={panStyles?.root?.properties} + style={dockStyles?.container?.properties} > {showVisibilityControls && } {showZoomControls && ( diff --git a/src/types/styles.ts b/src/types/styles.ts index f23bac7..d850521 100644 --- a/src/types/styles.ts +++ b/src/types/styles.ts @@ -90,4 +90,8 @@ export interface IStyles { container?: IStyle; button?: IStyle; }; + dock?: { + container?: IStyle; + root?: IStyle; + }; }