feat: Change Beta Tag and UI Enhancements for Node Components (#4417)
📝 (NodeName/index.tsx): Add beta prop to NodeName component for better handling of beta features 📝 (NodeStatus/index.tsx): Import Badge component and add beta badge for beta nodes 📝 (GenericNode/index.tsx): Import Badge component and add beta badge for beta nodes 📝 (nodeToolbarComponent/index.tsx): Add border styling to nodeToolbarComponent for better visual separation 📝 (index.css): Update accent-pink and accent-pink-foreground colors for better contrast
This commit is contained in:
parent
9d4d41c5f5
commit
a0184369bb
5 changed files with 71 additions and 57 deletions
|
|
@ -13,6 +13,7 @@ export default function NodeName({
|
||||||
showNode,
|
showNode,
|
||||||
validationStatus,
|
validationStatus,
|
||||||
isOutdated,
|
isOutdated,
|
||||||
|
beta,
|
||||||
}: {
|
}: {
|
||||||
display_name?: string;
|
display_name?: string;
|
||||||
selected: boolean;
|
selected: boolean;
|
||||||
|
|
@ -20,6 +21,7 @@ export default function NodeName({
|
||||||
showNode: boolean;
|
showNode: boolean;
|
||||||
validationStatus: VertexBuildTypeAPI | null;
|
validationStatus: VertexBuildTypeAPI | null;
|
||||||
isOutdated: boolean;
|
isOutdated: boolean;
|
||||||
|
beta: boolean;
|
||||||
}) {
|
}) {
|
||||||
const [inputName, setInputName] = useState(false);
|
const [inputName, setInputName] = useState(false);
|
||||||
const [nodeName, setNodeName] = useState(display_name);
|
const [nodeName, setNodeName] = useState(display_name);
|
||||||
|
|
@ -88,6 +90,7 @@ export default function NodeName({
|
||||||
className={cn(
|
className={cn(
|
||||||
"max-w-44 truncate text-[14px]",
|
"max-w-44 truncate text-[14px]",
|
||||||
validationStatus?.data?.duration && "max-w-36",
|
validationStatus?.data?.duration && "max-w-36",
|
||||||
|
validationStatus?.data?.duration && beta && "max-w-20",
|
||||||
isOutdated && "max-w-40",
|
isOutdated && "max-w-40",
|
||||||
!showNode && "max-w-28",
|
!showNode && "max-w-28",
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import useIconStatus from "@/CustomNodes/hooks/use-icons-status";
|
||||||
import useUpdateValidationStatus from "@/CustomNodes/hooks/use-update-validation-status";
|
import useUpdateValidationStatus from "@/CustomNodes/hooks/use-update-validation-status";
|
||||||
import useValidationStatusString from "@/CustomNodes/hooks/use-validation-status-string";
|
import useValidationStatusString from "@/CustomNodes/hooks/use-validation-status-string";
|
||||||
import ShadTooltip from "@/components/shadTooltipComponent";
|
import ShadTooltip from "@/components/shadTooltipComponent";
|
||||||
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
ICON_STROKE_WIDTH,
|
ICON_STROKE_WIDTH,
|
||||||
|
|
@ -187,7 +188,7 @@ export default function NodeStatus({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex flex-shrink-0 items-center gap-1">
|
<div className="flex flex-shrink-0 items-center">
|
||||||
{isOutdated && !isUserEdited && (
|
{isOutdated && !isUserEdited && (
|
||||||
<ShadTooltip content={TOOLTIP_OUTDATED_NODE}>
|
<ShadTooltip content={TOOLTIP_OUTDATED_NODE}>
|
||||||
<Button
|
<Button
|
||||||
|
|
@ -203,53 +204,69 @@ export default function NodeStatus({
|
||||||
</Button>
|
</Button>
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
)}
|
)}
|
||||||
<ShadTooltip
|
|
||||||
content={
|
<div className="flex items-center gap-2 self-center">
|
||||||
buildStatus === BuildStatus.BUILDING ? (
|
<ShadTooltip
|
||||||
<span> {STATUS_BUILDING} </span>
|
content={
|
||||||
) : buildStatus === BuildStatus.INACTIVE ? (
|
buildStatus === BuildStatus.BUILDING ? (
|
||||||
<span> {STATUS_INACTIVE} </span>
|
<span> {STATUS_BUILDING} </span>
|
||||||
) : !validationStatus ? (
|
) : buildStatus === BuildStatus.INACTIVE ? (
|
||||||
<span className="flex">{STATUS_BUILD}</span>
|
<span> {STATUS_INACTIVE} </span>
|
||||||
) : (
|
) : !validationStatus ? (
|
||||||
<div className="max-h-100 p-2">
|
<span className="flex">{STATUS_BUILD}</span>
|
||||||
<div className="max-h-80 overflow-auto">
|
) : (
|
||||||
{validationString && (
|
<div className="max-h-100 p-2">
|
||||||
<div className="ml-1 pb-2 text-status-red">
|
<div className="max-h-80 overflow-auto">
|
||||||
{validationString}
|
{validationString && (
|
||||||
|
<div className="ml-1 pb-2 text-status-red">
|
||||||
|
{validationString}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{lastRunTime && (
|
||||||
|
<div className={runClass}>
|
||||||
|
<div>{RUN_TIMESTAMP_PREFIX}</div>
|
||||||
|
<div className="ml-1 text-status-blue">
|
||||||
|
{lastRunTime}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className={runClass}>
|
||||||
|
<div>Duration:</div>
|
||||||
|
<div className="ml-1 text-status-blue">
|
||||||
|
{validationStatus?.data.duration}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
{lastRunTime && (
|
|
||||||
<div className={runClass}>
|
|
||||||
<div>{RUN_TIMESTAMP_PREFIX}</div>
|
|
||||||
<div className="ml-1 text-status-blue">{lastRunTime}</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className={runClass}>
|
|
||||||
<div>Duration:</div>
|
|
||||||
<div className="ml-1 text-status-blue">
|
|
||||||
{validationStatus?.data.duration}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)
|
||||||
)
|
}
|
||||||
}
|
side="bottom"
|
||||||
side="bottom"
|
>
|
||||||
>
|
<div className="cursor-help">
|
||||||
<div className="cursor-help">
|
{conditionSuccess && validationStatus?.data?.duration ? (
|
||||||
{conditionSuccess && validationStatus?.data?.duration ? (
|
<div className="font-jetbrains mr-1 flex gap-1 rounded-sm bg-accent-emerald px-1 text-[11px] font-bold text-accent-emerald-foreground">
|
||||||
<div className="font-jetbrains mr-1 flex gap-1 rounded-sm bg-emerald-50 px-1 text-[11px] font-bold text-emerald-500">
|
<Check className="h-4 w-4 items-center self-center" />
|
||||||
<Check className="h-4 w-4 items-center self-center" />
|
<span>
|
||||||
<span>
|
{normalizeTimeString(validationStatus?.data?.duration)}
|
||||||
{normalizeTimeString(validationStatus?.data?.duration)}
|
</span>
|
||||||
</span>
|
</div>
|
||||||
</div>
|
) : (
|
||||||
) : (
|
<div className="flex items-center self-center">
|
||||||
iconStatus
|
{iconStatus}
|
||||||
)}
|
</div>
|
||||||
</div>
|
)}
|
||||||
</ShadTooltip>
|
</div>
|
||||||
|
</ShadTooltip>
|
||||||
|
|
||||||
|
{data.node?.beta && showNode && (
|
||||||
|
<Badge
|
||||||
|
size="sq"
|
||||||
|
className="pointer-events-none mr-1 flex h-[22px] w-10 justify-center rounded-[8px] bg-accent-pink text-accent-pink-foreground"
|
||||||
|
>
|
||||||
|
<span className="text-[11px]">BETA</span>
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
<ShadTooltip content={getTooltipContent()}>
|
<ShadTooltip content={getTooltipContent()}>
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { BorderBeam } from "@/components/ui/border-beams";
|
import { BorderBeam } from "@/components/ui/border-beams";
|
||||||
import { BuildStatus } from "@/constants/enums";
|
import { BuildStatus } from "@/constants/enums";
|
||||||
import { usePostValidateComponentCode } from "@/controllers/API/queries/nodes/use-post-validate-component-code";
|
import { usePostValidateComponentCode } from "@/controllers/API/queries/nodes/use-post-validate-component-code";
|
||||||
|
|
@ -287,7 +288,7 @@ export default function GenericNode({
|
||||||
className={cn(
|
className={cn(
|
||||||
borderColor,
|
borderColor,
|
||||||
showNode
|
showNode
|
||||||
? "w-80 rounded-xl"
|
? "w-80 rounded-xl shadow-sm hover:shadow-md"
|
||||||
: `h-[4.065rem] w-48 rounded-[0.75rem] ${!selected ? "border-[1px] border-border ring-[0.5px] ring-border" : ""}`,
|
: `h-[4.065rem] w-48 rounded-[0.75rem] ${!selected ? "border-[1px] border-border ring-[0.5px] ring-border" : ""}`,
|
||||||
"generic-node-div group/node relative",
|
"generic-node-div group/node relative",
|
||||||
!hasOutputs && "pb-4",
|
!hasOutputs && "pb-4",
|
||||||
|
|
@ -302,13 +303,6 @@ export default function GenericNode({
|
||||||
size={300}
|
size={300}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div>
|
|
||||||
{data.node?.beta && showNode && (
|
|
||||||
<div className="h-8 rounded-t-[12px] bg-accent-pink px-4 pt-2 text-[11px] font-medium text-accent-pink-foreground">
|
|
||||||
BETA
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
data-testid={`${data.id}-main-node`}
|
data-testid={`${data.id}-main-node`}
|
||||||
|
|
@ -343,6 +337,7 @@ export default function GenericNode({
|
||||||
showNode={showNode}
|
showNode={showNode}
|
||||||
validationStatus={validationStatus}
|
validationStatus={validationStatus}
|
||||||
isOutdated={isOutdated}
|
isOutdated={isOutdated}
|
||||||
|
beta={data.node?.beta || false}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ export default function NodeToolbarComponent({
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="noflow nowheel nopan nodelete nodrag">
|
<div className="noflow nowheel nopan nodelete nodrag">
|
||||||
<div className="flex items-center gap-1 rounded-lg bg-background p-1 shadow-sm">
|
<div className="flex items-center gap-1 rounded-lg border-[1px] border-border bg-background p-1 shadow-sm">
|
||||||
{hasCode && (
|
{hasCode && (
|
||||||
<ShadTooltip
|
<ShadTooltip
|
||||||
content={
|
content={
|
||||||
|
|
|
||||||
|
|
@ -263,13 +263,12 @@
|
||||||
--sidebar-border: 240 3.7% 15.9%;
|
--sidebar-border: 240 3.7% 15.9%;
|
||||||
--sidebar-ring: 217.2 91.2% 59.8%;
|
--sidebar-ring: 217.2 91.2% 59.8%;
|
||||||
--emerald-success: 160.1 84.1% 39.4%;
|
--emerald-success: 160.1 84.1% 39.4%;
|
||||||
--accent-emerald-foreground: 161.4 93.5% 30.4%;
|
|
||||||
--placeholder: 240 5% 64.9%;
|
--placeholder: 240 5% 64.9%;
|
||||||
--hard-zinc: 240 5.2% 33.9%;
|
--hard-zinc: 240 5.2% 33.9%;
|
||||||
--smooth-red: 0 93.3% 94.1%;
|
--smooth-red: 0 93.3% 94.1%;
|
||||||
|
|
||||||
--accent-pink: 327.3 73.3% 97.1%;
|
--accent-pink: 335.9 69% 30.4%;
|
||||||
--accent-pink-foreground: 333.3 71.4% 50.6%;
|
--accent-pink-foreground: 330.4 81.2% 60.4%;
|
||||||
|
|
||||||
--inner-yellow: 47.9 95.8% 53.1%;
|
--inner-yellow: 47.9 95.8% 53.1%;
|
||||||
--inner-yellow-foreground: 35.5 91.7% 32.9%;
|
--inner-yellow-foreground: 35.5 91.7% 32.9%;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue