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

feat: Enhance UI Consistency and Refactor Color Naming Conventions for Improved UX #4424

Merged
merged 22 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c7714a1
📝 (tailwind.config.mjs): refactor color classes from "inner-" to "acc…
Cristhianzl Nov 6, 2024
24a7b5d
🔧 (GenericNode/index.tsx): Remove unused imports and constants to cle…
Cristhianzl Nov 6, 2024
de016b8
🔧 (handleRenderComponent/index.tsx): rename innerColorName and innerF…
Cristhianzl Nov 6, 2024
75a4496
📝 (HandleTooltipComponent/index.tsx): Refactor HandleTooltipComponent…
Cristhianzl Nov 6, 2024
71eaadf
📝 (NodeStatus/index.tsx): update border and text color classes for be…
Cristhianzl Nov 6, 2024
004a19e
🐛 (get-class-from-build-status.ts): fix incorrect condition to return…
Cristhianzl Nov 6, 2024
3e00eec
✨ (nodeToolbarComponent/index.tsx): Add zoom functionality to NodeToo…
Cristhianzl Nov 6, 2024
f34443b
📝 (applies.css): add a new CSS class .toolbar-wrapper to style the to…
Cristhianzl Nov 6, 2024
d70572f
📝 (index.css): Update accent color variables to improve consistency a…
Cristhianzl Nov 6, 2024
ec6be75
merge fix
Cristhianzl Nov 6, 2024
c939e74
[autofix.ci] apply automated fixes
autofix-ci[bot] Nov 6, 2024
f6d0911
Update src/frontend/src/style/applies.css
Cristhianzl Nov 6, 2024
07e4d74
Update src/frontend/src/CustomNodes/GenericNode/components/HandleTool…
Cristhianzl Nov 6, 2024
7427695
✨ (NodeStatus/index.tsx): Improve border styling for selected and uns…
Cristhianzl Nov 6, 2024
d230ade
📝 (HandleTooltipComponent/index.tsx): Update class name to use 'round…
Cristhianzl Nov 6, 2024
71f89a9
Merge branch 'main' into cz/sweeps
Cristhianzl Nov 6, 2024
d9b3501
🔧 (PageComponent/index.tsx): Update innerColor variable to accentColo…
Cristhianzl Nov 6, 2024
4ec0031
Merge branch 'cz/sweeps' of github.com:langflow-ai/langflow into cz/s…
Cristhianzl Nov 6, 2024
61658f4
✨ (nodeToolbarComponent/index.tsx): Add styleClasses property to Shad…
Cristhianzl Nov 6, 2024
e6bcbd2
🔧 (nodeToolbarComponent/index.tsx): update button height class to imp…
Cristhianzl Nov 6, 2024
140243f
✅ (freeze-path.spec.ts): update test to click on the correct element …
Cristhianzl Nov 6, 2024
99308c8
Merge branch 'main' into cz/sweeps
Cristhianzl Nov 6, 2024
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
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
import { convertTestName } from "@/components/storeCardComponent/utils/convert-test-name";
import { Badge } from "@/components/ui/badge";

export default function HandleTooltipComponent({
isInput,
tooltipTitle,
colors,
isConnecting,
isCompatible,
isSameNode,
accentColorName,
accentForegroundColorName,
left,
}: {
isInput: boolean;
colors: string[];
tooltipTitle: string;
isConnecting: boolean;
isCompatible: boolean;
isSameNode: boolean;
accentColorName: string;
accentForegroundColorName: string;
left: boolean;
}) {
const tooltips = tooltipTitle.split("\n");
const plural = tooltips.length > 1 ? "s" : "";

return (
<div className="font-medium">
{isSameNode ? (
"Can't connect to the same node"
) : (
<div className="flex items-start gap-1.5">
<div className="flex items-center gap-1.5">
{isConnecting ? (
isCompatible ? (
<span>
Expand All @@ -40,22 +46,26 @@ export default function HandleTooltipComponent({
</span>
)}
{tooltips.map((word, index) => (
<div
className="rounded-sm px-1.5 text-xs font-medium"
<Badge
className="h-6 rounded-md p-1"
style={{
backgroundColor: `${colors[index]}40`, // Add 40 (25%) opacity to background
color: colors[index], // Keep text the same color but solid
backgroundColor: left
? `hsl(var(--${accentColorName}))`
: `hsl(var(--${accentColorName}-foreground))`,
color: left
? `hsl(var(--${accentForegroundColorName}))`
: `hsl(var(--${accentColorName}))`,
}}
data-testid={`${isInput ? "input" : "output"}-tooltip-${convertTestName(word)}`}
>
{word}
</div>
</Badge>
))}
{isConnecting && <span>{isInput ? `input` : `output`}</span>}
</div>
)}
{!isConnecting && (
<div className="mt-2 flex flex-col gap-0.5 text-xs">
<div className="mt-2 flex flex-col gap-0.5 text-xs leading-6">
<div>
<b>Drag</b> to connect compatible {!isInput ? "inputs" : "outputs"}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ export default function NodeStatus({
const getBaseBorderClass = (selected) => {
let className =
selected && !isBuilding
? " border-[1px] ring-[0.75px] ring-foreground border-foreground hover:shadow-node"
: "border-[1px] ring-[0.5px] hover:shadow-node ring-border";
? " border ring-[0.75px] ring-muted-foreground border-muted-foreground hover:shadow-node"
: "border ring-[0.5px] hover:shadow-node ring-border";
let frozenClass = selected ? "border-ring-frozen" : "border-frozen";
return frozen ? frozenClass : className;
};
Expand Down Expand Up @@ -218,7 +218,7 @@ export default function NodeStatus({
<div className="max-h-100 p-2">
<div className="max-h-80 overflow-auto">
{validationString && (
<div className="ml-1 pb-2 text-status-red">
<div className="ml-1 pb-2 text-accent-red-foreground">
{validationString}
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export default function HandleRenderComponent({
}) {
const handleColorName = colorName?.[0] ?? "";

const innerColorName = `inner-${handleColorName}`;
const innerForegroundColorName = `${innerColorName}-foreground`;
const accentColorName = `accent-${handleColorName}`;
const accentForegroundColorName = `${accentColorName}-foreground`;

const setHandleDragging = useFlowStore((state) => state.setHandleDragging);
const setFilterType = useFlowStore((state) => state.setFilterType);
Expand Down Expand Up @@ -174,14 +174,14 @@ export default function HandleRenderComponent({
() =>
isNullHandle
? dark
? "conic-gradient(hsl(var(--inner-gray)) 0deg 360deg)"
: "conic-gradient(hsl(var(--inner-gray-foreground)) 0deg 360deg)"
? "conic-gradient(hsl(var(--accent-gray)) 0deg 360deg)"
: "conic-gradient(hsl(var(--accent-gray-foreground)) 0deg 360deg)"
: "conic-gradient(" +
colorName!
.concat(colorName![0])
.map(
(color, index) =>
`hsl(var(--inner-${color}))` +
`hsl(var(--accent-${color}))` +
" " +
((360 / colors.length) * index - 360 / (colors.length * 4)) +
"deg " +
Expand All @@ -203,34 +203,34 @@ export default function HandleRenderComponent({
styleSheet.textContent = `
@keyframes pulseNeon {
0% {
box-shadow: 0 0 0 2px hsl(var(--border)),
0 0 2px hsl(var(--inner-${colorName![0]})),
0 0 4px hsl(var(--inner-${colorName![0]})),
0 0 6px hsl(var(--inner-${colorName![0]})),
0 0 8px hsl(var(--inner-${colorName![0]})),
0 0 10px hsl(var(--inner-${colorName![0]})),
0 0 15px hsl(var(--inner-${colorName![0]})),
0 0 20px hsl(var(--inner-${colorName![0]}));
box-shadow: 0 0 0 2px hsl(var(--node-ring)),
0 0 2px hsl(var(--accent-${colorName![0]})),
0 0 4px hsl(var(--accent-${colorName![0]})),
0 0 6px hsl(var(--accent-${colorName![0]})),
0 0 8px hsl(var(--accent-${colorName![0]})),
0 0 10px hsl(var(--accent-${colorName![0]})),
0 0 15px hsl(var(--accent-${colorName![0]})),
0 0 20px hsl(var(--accent-${colorName![0]}));
}
50% {
box-shadow: 0 0 0 2px hsl(var(--border)),
0 0 4px hsl(var(--inner-${colorName![0]})),
0 0 8px hsl(var(--inner-${colorName![0]})),
0 0 12px hsl(var(--inner-${colorName![0]})),
0 0 16px hsl(var(--inner-${colorName![0]})),
0 0 20px hsl(var(--inner-${colorName![0]})),
0 0 25px hsl(var(--inner-${colorName![0]})),
0 0 30px hsl(var(--inner-${colorName![0]}));
box-shadow: 0 0 0 2px hsl(var(--node-ring)),
0 0 4px hsl(var(--accent-${colorName![0]})),
0 0 8px hsl(var(--accent-${colorName![0]})),
0 0 12px hsl(var(--accent-${colorName![0]})),
0 0 16px hsl(var(--accent-${colorName![0]})),
0 0 20px hsl(var(--accent-${colorName![0]})),
0 0 25px hsl(var(--accent-${colorName![0]})),
0 0 30px hsl(var(--accent-${colorName![0]}));
}
100% {
box-shadow: 0 0 0 2px hsl(var(--border)),
0 0 2px hsl(var(--inner-${colorName![0]})),
0 0 4px hsl(var(--inner-${colorName![0]})),
0 0 6px hsl(var(--inner-${colorName![0]})),
0 0 8px hsl(var(--inner-${colorName![0]})),
0 0 10px hsl(var(--inner-${colorName![0]})),
0 0 15px hsl(var(--inner-${colorName![0]})),
0 0 20px hsl(var(--inner-${colorName![0]}));
box-shadow: 0 0 0 2px hsl(var(--node-ring)),
0 0 2px hsl(var(--accent-${colorName![0]})),
0 0 4px hsl(var(--accent-${colorName![0]})),
0 0 6px hsl(var(--accent-${colorName![0]})),
0 0 8px hsl(var(--accent-${colorName![0]})),
0 0 10px hsl(var(--accent-${colorName![0]})),
0 0 15px hsl(var(--accent-${colorName![0]})),
0 0 20px hsl(var(--accent-${colorName![0]}));
}
}
`;
Expand Down Expand Up @@ -302,11 +302,13 @@ export default function HandleRenderComponent({
content={
<HandleTooltipComponent
isInput={left}
colors={colors}
tooltipTitle={tooltipTitle}
isConnecting={!!filterPresent && !ownHandle}
isCompatible={openHandle}
isSameNode={sameNode && !ownHandle}
accentColorName={accentColorName}
accentForegroundColorName={accentForegroundColorName}
left={left}
/>
}
side={left ? "left" : "right"}
Expand Down Expand Up @@ -366,12 +368,12 @@ export default function HandleRenderComponent({
height: "10px",
transition: "all 0.2s",
boxShadow: getNeonShadow(
innerForegroundColorName,
accentForegroundColorName,
isHovered || openHandle,
),
animation:
(isHovered || openHandle) && !isNullHandle
? "pulseNeon 0.7s ease-in-out infinite"
? "pulseNeon 1.1s ease-in-out infinite"
: "none",
border: isNullHandle ? "2px solid hsl(var(--muted))" : "none",
}}
Expand Down
13 changes: 0 additions & 13 deletions src/frontend/src/CustomNodes/GenericNode/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { Badge } from "@/components/ui/badge";
import { BorderBeam } from "@/components/ui/border-beams";
import { BuildStatus } from "@/constants/enums";
import { usePostValidateComponentCode } from "@/controllers/API/queries/nodes/use-post-validate-component-code";
import { useEffect, useMemo, useState } from "react";
import { useHotkeys } from "react-hotkeys-hook";
Expand Down Expand Up @@ -291,16 +288,6 @@ export default function GenericNode({
!hasOutputs && "pb-4",
)}
>
{BuildStatus.BUILDING === buildStatus && (
<BorderBeam
colorFrom="hsl(var(--foreground))"
colorTo="hsl(var(--muted-foreground))"
className="z-10"
borderWidth={1.75}
size={300}
/>
)}

<div
data-testid={`${data.id}-main-node`}
className={cn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export const getSpecificClassFromBuildStatus = (
): string => {
let isInvalid = validationStatus && !validationStatus.valid;

if ((isInvalid || buildStatus === BuildStatus.ERROR) && !isBuilding) {
if (BuildStatus.BUILDING === buildStatus) {
return "border-foreground border-[1px] ring-[0.75px] ring-foreground";
} else if ((isInvalid || buildStatus === BuildStatus.ERROR) && !isBuilding) {
return "border-destructive border-[1px] ring-[0.75px] ring-destructive";
} else {
return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,8 @@ export default function Page({ view }: { view?: boolean }): JSX.Element {
nodeColorsName[edge?.data?.targetHandle?.inputTypes[0]] ||
"hsl(var(--foreground))";

console.log(edge?.data?.targetHandle);

const innerColor = `hsl(var(--inner-${color}-muted-foreground))`;
document.documentElement.style.setProperty("--selected", innerColor);
const accentColor = `hsl(var(--accent-${color}-foreground))`;
document.documentElement.style.setProperty("--selected", accentColor);
};

const { open } = useSidebar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function SidebarFilterComponent({
<div
className={`mb-0.5 flex w-full items-center justify-between rounded border p-2 text-sm text-foreground`}
style={{
backgroundColor: `hsl(var(--inner-${color}-foreground))`,
backgroundColor: `hsl(var(--accent-${color}-foreground))`,
}}
>
<div className="flex flex-1 items-center gap-1.5">
Expand Down
Loading
Loading