Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions src/frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ body {
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 {
overflow-y: auto !important;
max-height: 310px !important;
Expand Down Expand Up @@ -130,14 +123,6 @@ body {
); /* 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 */
.no-border.ag-cell:focus {
border: none !important;
Expand Down Expand Up @@ -165,10 +150,10 @@ body {
height: 100%;
}
.react-flow__resize-control.handle {
width: 0.75rem!important;
width: 0.75rem !important;
height: 0.75rem !important;
background-color: white !important;
border-color: var(--border) !important;
z-index: 1000 !important;
border-radius: 20% !important;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,15 @@ export default function NodeInputField({
<div
ref={ref}
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.includes("code") && proxy)
? " hidden"
: "")
}
>
<>
{displayHandle && Handle}
<div className="flex w-full flex-col gap-2">
<div className="flex w-full items-center truncate text-sm">
{proxy ? (
<ShadTooltip content={<span>{proxy.id}</span>}>
Expand Down Expand Up @@ -140,23 +141,20 @@ export default function NodeInputField({
</div>
</div>

{displayHandle && Handle}
{data.node?.template[name] !== undefined && (
<div className="mt-2 w-full">
<CustomParameterComponent
handleOnNewValue={handleOnNewValue}
name={name}
nodeId={data.id}
templateData={data.node?.template[name]!}
templateValue={data.node?.template[name].value ?? ""}
editNode={false}
handleNodeClass={handleNodeClass}
nodeClass={data.node!}
disabled={disabled}
/>
</div>
<CustomParameterComponent
handleOnNewValue={handleOnNewValue}
name={name}
nodeId={data.id}
templateData={data.node?.template[name]!}
templateValue={data.node?.template[name].value ?? ""}
editNode={false}
handleNodeClass={handleNodeClass}
nodeClass={data.node!}
disabled={disabled}
/>
)}
</>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default function NodeOutputField({
>
<>
<div className="flex w-full items-center justify-end truncate text-sm">
<div className="flex-1">
<div className="flex flex-1">
<Button
disabled={disabledOutput}
unstyled
Expand All @@ -150,7 +150,7 @@ export default function NodeOutputField({
<IconComponent className="h-5 w-5 text-ice" name={"Snowflake"} />
</div>
)}
<div className="flex gap-2">
<div className="flex items-center gap-2">
<span className={data.node?.frozen ? "text-ice" : ""}>
<OutputComponent
proxy={outputProxy}
Expand All @@ -175,7 +175,7 @@ export default function NodeOutputField({
: "Please build the component first"
}
>
<div>
<div className="flex">
<OutputModal
disabled={!displayOutputPreview || unknownOutput}
nodeId={flowPoolId}
Expand Down
25 changes: 14 additions & 11 deletions src/frontend/src/components/dictComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { useEffect } from "react";
import { DictComponentType } from "../../types/components";

import DictAreaModal from "../../modals/dictAreaModal";
import { classNames } from "../../utils/utils";
import { Input } from "../ui/input";
import { classNames, cn } from "../../utils/utils";
import ForwardedIconComponent from "../genericIconComponent";
import { Button } from "../ui/button";

export default function DictComponent({
value = [],
Expand Down Expand Up @@ -37,16 +38,18 @@ export default function DictComponent({
}}
disabled={disabled}
>
<Input
type="text"
className={
editNode
? "input-edit-node input-disable pointer-events-none cursor-pointer"
: "input-disable pointer-events-none cursor-pointer"
}
placeholder={disabled ? "" : "Click to edit your dictionary..."}
<Button
variant="primary"
size="sm"
className={cn(
"w-full font-normal",
editNode ? "h-fit px-3 py-0.5" : "",
)}
data-testid="dict-input"
/>
>
<ForwardedIconComponent name="BookMarked" className="h-4 w-4" />
Edit Dictionary
</Button>
</DictAreaModal>
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,22 @@ export function RefreshParameterComponent({
setErrorData,
);
return (
<div className="flex w-full items-center justify-between gap-2">
{children}
{templateData.refresh_button && (
<div className="shrink-0 flex-col">
<RefreshButton
isLoading={postTemplateValue.isPending}
disabled={disabled}
editNode={editNode}
button_text={templateData.refresh_button_text}
handleUpdateValues={handleRefreshButtonPress}
id={"refresh-button-" + name}
/>
</div>
)}
</div>
(children || templateData.refresh_button) && (
<div className="flex w-full items-center justify-between gap-2">
{children}
{templateData.refresh_button && (
<div className="shrink-0 flex-col">
<RefreshButton
isLoading={postTemplateValue.isPending}
disabled={disabled}
editNode={editNode}
button_text={templateData.refresh_button_text}
handleUpdateValues={handleRefreshButtonPress}
id={"refresh-button-" + name}
/>
</div>
)}
</div>
)
);
}
7 changes: 4 additions & 3 deletions src/frontend/src/modals/dictAreaModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ export default function DictAreaModal({
<BaseModal.Content>
<div className="flex h-full w-full flex-col transition-all">
<JsonView
dark
theme="vscode"
editable={!!onChange}
enableClipboard
onChange={handleJsonChange}
src={cloneDeep(componentValue)}
customizeCopy={customizeCopy}
theme="vscode"
/>
</div>
</BaseModal.Content>
Expand All @@ -85,7 +84,9 @@ export default function DictAreaModal({
setOpen={setOpen}
onSubmit={onChange ? handleSubmit : undefined}
>
<BaseModal.Trigger className="h-full">{children}</BaseModal.Trigger>
<BaseModal.Trigger className="h-full" asChild>
{children}
</BaseModal.Trigger>
{renderHeader()}
{renderContent()}
<BaseModal.Footer submit={onChange ? { label: "Save" } : undefined} />
Expand Down
14 changes: 12 additions & 2 deletions src/frontend/src/style/classes.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,18 @@ textarea[class^="ag-"]:focus {
height: fit-content !important;
}

.json-view.dark {
background-color: #161c28 !important;
.json-view {
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 * {
Expand Down
Loading