fix: json dark mode colors and dict component button view (#3802)

* Fix dark mode colors on jsonView

* Fix dict component button view

* Changed style of dict component button

* Changed parameter render to remove space on the bottom of the inputs that are only handles

* Fixed space below nodes
This commit is contained in:
Lucas Oliveira 2024-09-13 13:34:58 -03:00 • committed by GitHub
commit 35c194e575
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 67 additions and 68 deletions

View file

@ -65,13 +65,6 @@ body {
src: url("assets/text-security-disc.woff") format("woff"); src: url("assets/text-security-disc.woff") format("woff");
} }
.json-view {
height: 370px !important;
background-color: #2c2c2c !important;
border-radius: 10px !important;
padding: 10px !important;
}
.jv-indent { .jv-indent {
overflow-y: auto !important; overflow-y: auto !important;
max-height: 310px !important; max-height: 310px !important;
@ -130,14 +123,6 @@ body {
); /* Medium indigo color with 20% opacity */ ); /* Medium indigo color with 20% opacity */
} }
.json-view-playground .json-view {
background-color: #fff !important;
}
.json-view-flow .json-view {
background-color: #bbb !important;
}
/* This CSS is to not apply the border for the column having 'no-border' class */ /* This CSS is to not apply the border for the column having 'no-border' class */
.no-border.ag-cell:focus { .no-border.ag-cell:focus {
border: none !important; border: none !important;

View file

@ -94,14 +94,15 @@ export default function NodeInputField({
<div <div
ref={ref} ref={ref}
className={ className={
"relative mt-1 flex w-full flex-wrap items-center justify-between bg-muted px-5 py-2" + "relative mt-1 flex min-h-10 w-full flex-wrap items-center justify-between bg-muted px-5 py-2" +
((name === "code" && type === "code") || ((name === "code" && type === "code") ||
(name.includes("code") && proxy) (name.includes("code") && proxy)
? " hidden" ? " hidden"
: "") : "")
} }
> >
<> {displayHandle && Handle}
<div className="flex w-full flex-col gap-2">
<div className="flex w-full items-center truncate text-sm"> <div className="flex w-full items-center truncate text-sm">
{proxy ? ( {proxy ? (
<ShadTooltip content={<span>{proxy.id}</span>}> <ShadTooltip content={<span>{proxy.id}</span>}>
@ -140,9 +141,7 @@ export default function NodeInputField({
</div> </div>
</div> </div>
{displayHandle && Handle}
{data.node?.template[name] !== undefined && ( {data.node?.template[name] !== undefined && (
<div className="mt-2 w-full">
<CustomParameterComponent <CustomParameterComponent
handleOnNewValue={handleOnNewValue} handleOnNewValue={handleOnNewValue}
name={name} name={name}
@ -154,9 +153,8 @@ export default function NodeInputField({
nodeClass={data.node!} nodeClass={data.node!}
disabled={disabled} disabled={disabled}
/> />
</div>
)} )}
</> </div>
</div> </div>
); );
} }

View file

@ -127,7 +127,7 @@ export default function NodeOutputField({
> >
<> <>
<div className="flex w-full items-center justify-end truncate text-sm"> <div className="flex w-full items-center justify-end truncate text-sm">
<div className="flex-1"> <div className="flex flex-1">
<Button <Button
disabled={disabledOutput} disabled={disabledOutput}
unstyled unstyled
@ -150,7 +150,7 @@ export default function NodeOutputField({
<IconComponent className="h-5 w-5 text-ice" name={"Snowflake"} /> <IconComponent className="h-5 w-5 text-ice" name={"Snowflake"} />
</div> </div>
)} )}
<div className="flex gap-2"> <div className="flex items-center gap-2">
<span className={data.node?.frozen ? "text-ice" : ""}> <span className={data.node?.frozen ? "text-ice" : ""}>
<OutputComponent <OutputComponent
proxy={outputProxy} proxy={outputProxy}
@ -175,7 +175,7 @@ export default function NodeOutputField({
: "Please build the component first" : "Please build the component first"
} }
> >
<div> <div className="flex">
<OutputModal <OutputModal
disabled={!displayOutputPreview || unknownOutput} disabled={!displayOutputPreview || unknownOutput}
nodeId={flowPoolId} nodeId={flowPoolId}

View file

@ -2,8 +2,9 @@ import { useEffect } from "react";
import { DictComponentType } from "../../types/components"; import { DictComponentType } from "../../types/components";
import DictAreaModal from "../../modals/dictAreaModal"; import DictAreaModal from "../../modals/dictAreaModal";
import { classNames } from "../../utils/utils"; import { classNames, cn } from "../../utils/utils";
import { Input } from "../ui/input"; import ForwardedIconComponent from "../genericIconComponent";
import { Button } from "../ui/button";
export default function DictComponent({ export default function DictComponent({
value = [], value = [],
@ -37,16 +38,18 @@ export default function DictComponent({
}} }}
disabled={disabled} disabled={disabled}
> >
<Input <Button
type="text" variant="primary"
className={ size="sm"
editNode className={cn(
? "input-edit-node input-disable pointer-events-none cursor-pointer" "w-full font-normal",
: "input-disable pointer-events-none cursor-pointer" editNode ? "h-fit px-3 py-0.5" : "",
} )}
placeholder={disabled ? "" : "Click to edit your dictionary..."}
data-testid="dict-input" data-testid="dict-input"
/> >
<ForwardedIconComponent name="BookMarked" className="h-4 w-4" />
Edit Dictionary
</Button>
</DictAreaModal> </DictAreaModal>
</div> </div>
} }

View file

@ -29,6 +29,7 @@ export function RefreshParameterComponent({
setErrorData, setErrorData,
); );
return ( return (
(children || templateData.refresh_button) && (
<div className="flex w-full items-center justify-between gap-2"> <div className="flex w-full items-center justify-between gap-2">
{children} {children}
{templateData.refresh_button && ( {templateData.refresh_button && (
@ -44,5 +45,6 @@ export function RefreshParameterComponent({
</div> </div>
)} )}
</div> </div>
)
); );
} }

View file

@ -65,13 +65,12 @@ export default function DictAreaModal({
<BaseModal.Content> <BaseModal.Content>
<div className="flex h-full w-full flex-col transition-all"> <div className="flex h-full w-full flex-col transition-all">
<JsonView <JsonView
dark theme="vscode"
editable={!!onChange} editable={!!onChange}
enableClipboard enableClipboard
onChange={handleJsonChange} onChange={handleJsonChange}
src={cloneDeep(componentValue)} src={cloneDeep(componentValue)}
customizeCopy={customizeCopy} customizeCopy={customizeCopy}
theme="vscode"
/> />
</div> </div>
</BaseModal.Content> </BaseModal.Content>
@ -85,7 +84,9 @@ export default function DictAreaModal({
setOpen={setOpen} setOpen={setOpen}
onSubmit={onChange ? handleSubmit : undefined} onSubmit={onChange ? handleSubmit : undefined}
> >
<BaseModal.Trigger className="h-full">{children}</BaseModal.Trigger> <BaseModal.Trigger className="h-full" asChild>
{children}
</BaseModal.Trigger>
{renderHeader()} {renderHeader()}
{renderContent()} {renderContent()}
<BaseModal.Footer submit={onChange ? { label: "Save" } : undefined} /> <BaseModal.Footer submit={onChange ? { label: "Save" } : undefined} />

View file

@ -151,8 +151,18 @@ textarea[class^="ag-"]:focus {
height: fit-content !important; height: fit-content !important;
} }
.json-view.dark { .json-view {
background-color: #161c28 !important; height: 370px !important;
border-radius: 10px !important;
padding: 10px !important;
}
.json-view {
background-color: #f8fafc !important;
}
.dark .json-view {
background-color: #141924 !important;
} }
.react-flow__node.dragging * { .react-flow__node.dragging * {