Removed ability to clone component and flow from store
This commit is contained in:
parent
03106a3dad
commit
00c7ff8cd3
2 changed files with 15 additions and 40 deletions
|
|
@ -40,7 +40,6 @@ export const MarketCardComponent = ({
|
|||
const flowData = useRef<FlowType>();
|
||||
const [liked_by_user, setLiked_by_user] = useState(data.liked_by_user);
|
||||
const [likes_count, setLikes_count] = useState(data.liked_by_count ?? 0);
|
||||
const [hovering, setHovering] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setAdded(savedFlows.has(data.id) ? true : false);
|
||||
|
|
@ -105,33 +104,12 @@ export const MarketCardComponent = ({
|
|||
}
|
||||
}
|
||||
|
||||
function handleInstall() {
|
||||
if (flowData.current) {
|
||||
addFlow(true, flowData.current!).then(() => {
|
||||
setSuccessData({ title: "Flow Installed" });
|
||||
});
|
||||
} else {
|
||||
getComponent(data.id).then((res) => {
|
||||
const newFLow = cloneFLowWithParent(res, res.id, data.is_component);
|
||||
flowData.current = newFLow;
|
||||
addFlow(true, newFLow);
|
||||
setSuccessData({ title: "Flow Installed" });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const totalComponentsMetadata = () => {
|
||||
return data?.metadata ? data.metadata["total"] : 0;
|
||||
};
|
||||
|
||||
return (
|
||||
<Card
|
||||
onMouseEnter={() => {
|
||||
setHovering(true);
|
||||
}}
|
||||
onMouseLeave={() => {
|
||||
setHovering(false);
|
||||
}}
|
||||
className={classNames(
|
||||
"group relative flex flex-col justify-between overflow-hidden transition-all hover:shadow-md",
|
||||
disabled ? "pointer-events-none opacity-50" : ""
|
||||
|
|
@ -145,12 +123,14 @@ export const MarketCardComponent = ({
|
|||
{data.name}
|
||||
</span>
|
||||
<div className="flex gap-3">
|
||||
<ShadTooltip content="Components">
|
||||
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<IconComponent name="ToyBrick" className="h-4 w-4" />
|
||||
{totalComponentsMetadata()}
|
||||
</span>
|
||||
</ShadTooltip>
|
||||
{!data.is_component && (
|
||||
<ShadTooltip content="Components">
|
||||
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<IconComponent name="ToyBrick" className="h-4 w-4" />
|
||||
{totalComponentsMetadata()}
|
||||
</span>
|
||||
</ShadTooltip>
|
||||
)}
|
||||
<ShadTooltip content="Likes">
|
||||
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<IconComponent
|
||||
|
|
@ -222,7 +202,7 @@ export const MarketCardComponent = ({
|
|||
content={
|
||||
authorized
|
||||
? added
|
||||
? "Clone"
|
||||
? "Added to Account"
|
||||
: "Add to Account"
|
||||
: "Please review your API key."
|
||||
}
|
||||
|
|
@ -240,23 +220,14 @@ export const MarketCardComponent = ({
|
|||
}
|
||||
if (!added) {
|
||||
handleAdd();
|
||||
} else {
|
||||
handleInstall();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<IconComponent
|
||||
name={
|
||||
loading
|
||||
? "Loader2"
|
||||
: added
|
||||
? hovering
|
||||
? "GitBranchPlus"
|
||||
: "Check"
|
||||
: "Plus"
|
||||
}
|
||||
name={loading ? "Loader2" : added ? "Check" : "Plus"}
|
||||
className={classNames(
|
||||
"h-6 w-6",
|
||||
added ? "text-chat-send" : "",
|
||||
loading ? " animate-spin" : "",
|
||||
!authorized ? " text-ring" : ""
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ import {
|
|||
Link,
|
||||
Loader2,
|
||||
Lock,
|
||||
LogIn,
|
||||
LucideSend,
|
||||
Maximize2,
|
||||
Menu,
|
||||
|
|
@ -60,6 +61,7 @@ import {
|
|||
Minus,
|
||||
MoonIcon,
|
||||
MoreHorizontal,
|
||||
Network,
|
||||
Paperclip,
|
||||
Pencil,
|
||||
Plus,
|
||||
|
|
@ -265,6 +267,7 @@ export const nodeIconsLucide: iconsType = {
|
|||
custom_components: GradientSparkles,
|
||||
custom: Edit,
|
||||
Trash2,
|
||||
Network,
|
||||
X,
|
||||
XCircle,
|
||||
Info,
|
||||
|
|
@ -326,6 +329,7 @@ export const nodeIconsLucide: iconsType = {
|
|||
Key,
|
||||
Unplug,
|
||||
Group,
|
||||
LogIn,
|
||||
ChevronUp,
|
||||
Ungroup,
|
||||
BookMarked,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue