Card design changed
This commit is contained in:
parent
e8ab9c73cc
commit
fc91140488
2 changed files with 22 additions and 70 deletions
|
|
@ -5,8 +5,7 @@ import { StoreContext } from "../../contexts/storeContext";
|
||||||
import { getComponent, postLikeComponent } from "../../controllers/API";
|
import { getComponent, postLikeComponent } from "../../controllers/API";
|
||||||
import { storeComponent } from "../../types/store";
|
import { storeComponent } from "../../types/store";
|
||||||
import cloneFLowWithParent from "../../utils/storeUtils";
|
import cloneFLowWithParent from "../../utils/storeUtils";
|
||||||
import { gradients } from "../../utils/styleUtils";
|
import { cn } from "../../utils/utils";
|
||||||
import { classNames } from "../../utils/utils";
|
|
||||||
import ShadTooltip from "../ShadTooltipComponent";
|
import ShadTooltip from "../ShadTooltipComponent";
|
||||||
import IconComponent from "../genericIconComponent";
|
import IconComponent from "../genericIconComponent";
|
||||||
import { Badge } from "../ui/badge";
|
import { Badge } from "../ui/badge";
|
||||||
|
|
@ -121,7 +120,7 @@ export default function CollectionCardComponent({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
className={classNames(
|
className={cn(
|
||||||
"group relative flex flex-col justify-between overflow-hidden transition-all hover:shadow-md",
|
"group relative flex flex-col justify-between overflow-hidden transition-all hover:shadow-md",
|
||||||
disabled ? "pointer-events-none opacity-50" : ""
|
disabled ? "pointer-events-none opacity-50" : ""
|
||||||
)}
|
)}
|
||||||
|
|
@ -130,66 +129,15 @@ export default function CollectionCardComponent({
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<div>
|
<div>
|
||||||
<CardTitle className="flex w-full items-center justify-between gap-3 text-xl">
|
<CardTitle className="flex w-full items-center justify-between gap-3 text-xl">
|
||||||
<div
|
<IconComponent
|
||||||
className={classNames(
|
className={cn(
|
||||||
"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-primary",
|
"flex-shrink-0",
|
||||||
gradients[
|
data.is_component
|
||||||
parseInt(data.id.slice(0, 12), 16) % gradients.length
|
? "mx-0.5 h-6 w-6 text-indigo-500"
|
||||||
]
|
: "h-7 w-7 flex-shrink-0 text-emerald-800"
|
||||||
)}
|
)}
|
||||||
>
|
name={data.is_component ? "ToyBrick" : "Group"}
|
||||||
<div
|
/>
|
||||||
className={classNames(
|
|
||||||
data.is_component ? "h-7 w-7 rounded-full bg-muted" : "",
|
|
||||||
"flex items-center justify-center"
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{data.is_component ? (
|
|
||||||
<svg className="h-5 w-5" viewBox="0 0 24 24">
|
|
||||||
<defs>
|
|
||||||
<linearGradient
|
|
||||||
id={data.id}
|
|
||||||
x1="0%"
|
|
||||||
y1="0%"
|
|
||||||
x2="100%"
|
|
||||||
y2="100%"
|
|
||||||
className={
|
|
||||||
gradients[
|
|
||||||
parseInt(data.id.slice(0, 12), 16) %
|
|
||||||
gradients.length
|
|
||||||
]
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<stop
|
|
||||||
offset="0%"
|
|
||||||
stopColor="var(--tw-gradient-from)"
|
|
||||||
/>
|
|
||||||
<stop
|
|
||||||
offset="100%"
|
|
||||||
stopColor="var(--tw-gradient-to)"
|
|
||||||
/>
|
|
||||||
</linearGradient>
|
|
||||||
</defs>
|
|
||||||
<IconComponent
|
|
||||||
className={classNames(
|
|
||||||
"h-4 w-4",
|
|
||||||
gradients[
|
|
||||||
parseInt(data.id.slice(0, 12), 16) %
|
|
||||||
gradients.length
|
|
||||||
]
|
|
||||||
)}
|
|
||||||
stroke={`url(#${data.id})`}
|
|
||||||
name="ToyBrick"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
) : (
|
|
||||||
<IconComponent
|
|
||||||
className="h-4 w-4 text-background"
|
|
||||||
name="Network"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<ShadTooltip content={data.name}>
|
<ShadTooltip content={data.name}>
|
||||||
<div className="w-full truncate">{data.name}</div>
|
<div className="w-full truncate">{data.name}</div>
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
|
|
@ -205,10 +153,7 @@ export default function CollectionCardComponent({
|
||||||
)}
|
)}
|
||||||
<ShadTooltip content="Likes">
|
<ShadTooltip content="Likes">
|
||||||
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||||
<IconComponent
|
<IconComponent name="Heart" className={cn("h-4 w-4 ")} />
|
||||||
name="Heart"
|
|
||||||
className={classNames("h-4 w-4 ")}
|
|
||||||
/>
|
|
||||||
{likes_count ?? 0}
|
{likes_count ?? 0}
|
||||||
</span>
|
</span>
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
|
|
@ -232,7 +177,7 @@ export default function CollectionCardComponent({
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
</div>
|
</div>
|
||||||
{data.user_created && data.user_created.username && (
|
{data.user_created && data.user_created.username && (
|
||||||
<span className="text-xs text-primary">
|
<span className="text-sm text-primary">
|
||||||
by <b>{data.user_created.username}</b>
|
by <b>{data.user_created.username}</b>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
@ -274,13 +219,16 @@ export default function CollectionCardComponent({
|
||||||
(!authorized ? " cursor-not-allowed" : "")
|
(!authorized ? " cursor-not-allowed" : "")
|
||||||
}
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
if (!authorized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
handleLike();
|
handleLike();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="Heart"
|
name="Heart"
|
||||||
className={classNames(
|
className={cn(
|
||||||
"h-6 w-6 p-0.5",
|
"h-5 w-5",
|
||||||
liked_by_user
|
liked_by_user
|
||||||
? "fill-destructive stroke-destructive"
|
? "fill-destructive stroke-destructive"
|
||||||
: "",
|
: "",
|
||||||
|
|
@ -314,7 +262,7 @@ export default function CollectionCardComponent({
|
||||||
>
|
>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name={loading ? "Loader2" : "Plus"}
|
name={loading ? "Loader2" : "Plus"}
|
||||||
className={classNames(
|
className={cn(
|
||||||
loading ? "h-5 w-5 animate-spin" : "h-6 w-6",
|
loading ? "h-5 w-5 animate-spin" : "h-6 w-6",
|
||||||
!authorized ? " text-ring" : ""
|
!authorized ? " text-ring" : ""
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import {
|
||||||
Bell,
|
Bell,
|
||||||
BookMarked,
|
BookMarked,
|
||||||
BookmarkPlus,
|
BookmarkPlus,
|
||||||
|
Boxes,
|
||||||
Check,
|
Check,
|
||||||
CheckCircle2,
|
CheckCircle2,
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
|
|
@ -92,6 +93,7 @@ import {
|
||||||
Users2,
|
Users2,
|
||||||
Variable,
|
Variable,
|
||||||
Wand2,
|
Wand2,
|
||||||
|
Workflow,
|
||||||
Wrench,
|
Wrench,
|
||||||
X,
|
X,
|
||||||
XCircle,
|
XCircle,
|
||||||
|
|
@ -244,6 +246,7 @@ export const nodeIconsLucide: iconsType = {
|
||||||
ChatVertexAI: VertexAIIcon,
|
ChatVertexAI: VertexAIIcon,
|
||||||
VertexAIEmbeddings: VertexAIIcon,
|
VertexAIEmbeddings: VertexAIIcon,
|
||||||
agents: Rocket,
|
agents: Rocket,
|
||||||
|
Workflow,
|
||||||
User,
|
User,
|
||||||
WikipediaAPIWrapper: SvgWikipedia,
|
WikipediaAPIWrapper: SvgWikipedia,
|
||||||
chains: Link,
|
chains: Link,
|
||||||
|
|
@ -269,6 +272,7 @@ export const nodeIconsLucide: iconsType = {
|
||||||
custom_components: GradientSparkles,
|
custom_components: GradientSparkles,
|
||||||
custom: Edit,
|
custom: Edit,
|
||||||
Trash2,
|
Trash2,
|
||||||
|
Boxes,
|
||||||
Network,
|
Network,
|
||||||
X,
|
X,
|
||||||
XCircle,
|
XCircle,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue