fix: make code button flash, fix mcp icon color (#7848)

* Added new animation

* Use animation on code button and make it appear just once

* fix tests

* Fix Mcp Icon

* Fix fill on white mode

* fixed tests

* Fixed mcp color on dark mode
This commit is contained in:
Lucas Oliveira 2025-04-29 16:37:09 -03:00 committed by GitHub
commit fce1a5887d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 23 additions and 13 deletions

View file

@ -132,7 +132,7 @@ export default function PublishDropdown() {
>
<IconComponent
name="Mcp"
className={`${groupStyle} icon-size mr-2 fill-muted-foreground group-hover:fill-white`}
className={`${groupStyle} icon-size mr-2 fill-muted-foreground group-hover:fill-foreground`}
/>
<span>MCP Server</span>
<IconComponent

View file

@ -5,7 +5,7 @@ const SvgMcpIcon = (props) => {
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
fill={props.isdark ? "white" : "black"}
{...props}
>
<g clip-path="url(#clip0_93_974)">

View file

@ -1,8 +1,10 @@
import { useDarkStore } from "@/stores/darkStore";
import React, { forwardRef } from "react";
import SvgMcpIcon from "./McpIcon";
export const McpIcon = forwardRef<SVGSVGElement, React.PropsWithChildren<{}>>(
(props, ref) => {
return <SvgMcpIcon ref={ref} {...props} />;
const isdark = useDarkStore((state) => state.dark);
return <SvgMcpIcon ref={ref} isdark={isdark} {...props} />;
},
);

View file

@ -436,15 +436,19 @@ const NodeToolbarComponent = memo(
};
const isCustomComponent = useMemo(() => {
return data.type === "CustomComponent" && !data.node?.edited;
}, [data.type, data.node?.edited]);
const isCustom = data.type === "CustomComponent" && !data.node?.edited;
if (isCustom) {
data.node.edited = true;
}
return isCustom;
}, [data.type, data.node]);
const renderToolbarButtons = useMemo(
() => (
<>
{hasCode && (
<ToolbarButton
className={isCustomComponent ? "!bg-accent-pink" : ""}
className={isCustomComponent ? "animate-pulse-pink" : ""}
icon="Code"
label="Code"
onClick={() => setOpenModal(true)}

View file

@ -42,7 +42,7 @@
--accent-indigo: 226 100% 94%; /* hsl(226, 100%, 94%) */
--accent-indigo-foreground: 243 75% 59%; /* hsl(243, 75%, 59%) */
--accent-pink: 326 78% 95%; /* hsl(326, 78%, 95%) */
--accent-pink: 326, 78%, 95%; /* hsl(326, 78%, 95%) */
--accent-pink-foreground: 333 71% 51%; /* hsl(333, 71%, 51%) */
--tooltip: 0 0% 0%; /* hsl(0, 0%, 0%) */
--tooltip-foreground: 0 0% 100%; /* hsl(0, 0%, 100%) */
@ -229,7 +229,7 @@
--accent-emerald-hover: 163.1 88.1% 19.8%; /* hsl(163.1, 88.1%, 19.8%) */
--accent-indigo: 242 25% 34%; /* hsl(242, 25%, 34%) */
--accent-indigo-foreground: 234 89% 74%; /* hsl(234, 89%, 74%) */
--accent-pink: 336 69% 30%; /* hsl(336, 69%, 30%) */
--accent-pink: 336, 69%, 30%; /* hsl(336, 69%, 30%) */
--accent-pink-foreground: 329 86% 70%; /* hsl(329, 86%, 70%) */
--tooltip: 0 0% 100%; /* hsl(0, 0%, 100%) */
@ -348,7 +348,6 @@
--selected: #0369a1;
--discord-color: #5765f2;
--filter-foreground: #eef2ff;
--filter-background: #4e46e599;

View file

@ -91,6 +91,10 @@ const config = {
"offset-distance": "100%",
},
},
"pulse-pink": {
"0%, 100%": { backgroundColor: "hsla(var(--accent-pink), 1)" },
"50%": { backgroundColor: "hsla(var(--accent-pink), 0.4)" },
},
},
animation: {
// Animation definitions
@ -99,6 +103,7 @@ const config = {
contentShow: "contentShow 400ms cubic-bezier(0.16, 1, 0.3, 1)",
contentHide: "contentHide 500ms cubic-bezier(0.16, 1, 0.3, 1)",
wiggle: "wiggle 150ms ease-in-out 1",
"pulse-pink": "pulse-pink 2s linear infinite",
"slow-wiggle": "wiggle 500ms ease-in-out 1",
"border-beam": "border-beam calc(var(--duration)*1s) infinite linear",
},
@ -343,8 +348,8 @@ const config = {
999: "999",
},
fontSize: {
"xxs": "11px",
"mmd": "13px",
xxs: "11px",
mmd: "13px",
},
},
},

View file

@ -25,7 +25,7 @@ test(
});
await expect(page.getByTestId("code-button-modal")).toHaveClass(
/!bg-accent-pink/,
/animate-pulse-pink/,
);
await page.getByTestId("code-button-modal").last().click();
@ -66,7 +66,7 @@ class CustomComponent(Component):
await page.getByText("Check & Save").last().click();
await expect(page.getByTestId("code-button-modal")).not.toHaveClass(
/!bg-accent-pink/,
/animate-pulse-pink/,
{ timeout: 3000 },
);
},