Skip to content

Commit 6590e49

Browse files
committed
feat: use codezero icons in actions
1 parent e6d369c commit 6590e49

7 files changed

Lines changed: 45 additions & 23 deletions

File tree

package-lock.json

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
"@c15t/nextjs": "^2.1.0",
2525
"@c15t/react": "^2.1.0",
2626
"@c15t/scripts": "^2.1.0",
27-
"@code0-tech/pictor": "^0.12.0",
27+
"@code0-tech/pictor": "^0.13.0",
2828
"@icons-pack/react-simple-icons": "^13.13.0",
2929
"@mvriu5/payload-ai": "^1.3.2",
30-
"@mvriu5/payload-icon-picker": "^1.0.2",
30+
"@mvriu5/payload-icon-picker": "^1.1.1",
3131
"@number-flow/react": "^0.6.1",
3232
"@openrouter/ai-sdk-provider": "^2.10.0",
3333
"@payloadcms/db-postgres": "3.86.0",

src/app/(landing)/[locale]/actions/[slug]/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ActionTriggerView } from "@/components/ActionTriggerView"
2+
import { ActionIcon } from "@/components/ActionIcon"
23
import { ActionCard } from "@/components/cards/ActionCard"
34
import { Aurora } from "@/components/ui/Aurora"
45
import { LandingContainer } from "@/components/ui/LandingContainer"
@@ -8,7 +9,6 @@ import { extractFlowTypesFromJson, extractFunctionDefinitionsFromJson, fetchMedi
89
import { getActionBySlug, getLandingPage } from "@/lib/cms"
910
import { findPageBlock } from "@/lib/pageBlocks"
1011
import { createMetadata } from "@/lib/siteConfig"
11-
import { getIcon } from "@/components/IconRenderer"
1212
import type { Media } from "@/payload-types"
1313
import { IconArrowLeft } from "@tabler/icons-react"
1414
import type { Metadata } from "next"
@@ -26,11 +26,11 @@ export default async function ActionDetailPage({ params }: { params: LocaleSlugP
2626
const extractedFunctionDefinitions = extractFunctionDefinitionsFromJson(moduleJson)
2727
const flowTypeItems = extractedFlowTypes.map((item) => ({
2828
item,
29-
icon: getIcon(item.displayIcon, 32),
29+
icon: item.displayIcon,
3030
}))
3131
const functionDefinitionItems = extractedFunctionDefinitions.map((item) => ({
3232
item,
33-
icon: getIcon(item.displayIcon ?? "function", 32),
33+
icon: item.displayIcon ?? "tabler:IconFunction",
3434
}))
3535
const references = (action.references ?? []).filter((reference): reference is Exclude<typeof reference, number> => typeof reference !== "number")
3636
const tags = (action.tags ?? []).filter((tag): tag is string => Boolean(tag))
@@ -58,7 +58,7 @@ export default async function ActionDetailPage({ params }: { params: LocaleSlugP
5858
<div className="flex flex-col gap-6 sm:flex-row sm:items-start">
5959
{action.icon && (
6060
<div className="flex size-20 shrink-0 items-center justify-center overflow-hidden rounded-3xl border border-white/10 bg-light text-white">
61-
{getIcon(action.icon, 40)}
61+
<ActionIcon icon={action.icon} size={40} />
6262
</div>
6363
)}
6464

src/components/ActionIcon.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"use client"
2+
3+
import { Icon } from "@code0-tech/pictor"
4+
5+
interface ActionIconProps {
6+
icon: string | null | undefined
7+
size?: number
8+
}
9+
10+
export function ActionIcon({ icon, size = 24 }: ActionIconProps) {
11+
if (!icon) return null
12+
13+
return <Icon icon={icon} size={size} />
14+
}

src/components/ActionTriggerCard.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
import { BaseAccordionItem } from "@/components/ui/Accordion"
44
import type { ExtractedFlowType, ExtractedFunctionDefinition } from "@/lib/actionExtraction"
5-
import { type ReactNode, useCallback, useMemo, useState } from "react"
5+
import { Icon } from "@code0-tech/pictor"
6+
import { useCallback, useMemo, useState } from "react"
67
import { Card } from "./ui/Card"
78

89
interface ActionTriggerCardProps {
910
type: "flowType" | "functionDefinition"
1011
item: ExtractedFlowType | ExtractedFunctionDefinition
11-
icon: ReactNode
12+
icon?: string
1213
}
1314

1415
export function ActionTriggerCard({ type, item, icon }: ActionTriggerCardProps) {
@@ -38,7 +39,9 @@ export function ActionTriggerCard({ type, item, icon }: ActionTriggerCardProps)
3839
<div className="relative z-10 flex h-full flex-col gap-2">
3940
<div className="flex items-start justify-between gap-3">
4041
<div className="flex min-w-0 items-center gap-2">
41-
<div className="flex size-10 shrink-0 items-center justify-center rounded-lg border border-white/5 bg-light text-brand">{icon}</div>
42+
<div className="flex size-10 shrink-0 items-center justify-center rounded-lg border border-white/5 bg-light text-brand">
43+
<Icon icon={icon ?? "tabler:IconFunction"} size={24} />
44+
</div>
4245
<div className="min-w-0">
4346
<p className="text-xs tracking-wide text-tertiary">{label}</p>
4447
<h3 className="truncate tracking-wide text-white">{item.name || item.identifier}</h3>

src/components/ActionTriggerView.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"use client"
22

3-
import { type ReactNode, useState } from "react"
3+
import { useState } from "react"
44
import { ActionTriggerCard } from "@/components/ActionTriggerCard"
55
import { Switch, type SwitchOption } from "@/components/ui/Switch"
66
import type { ExtractedFlowType, ExtractedFunctionDefinition } from "@/lib/actionExtraction"
77

88
interface ActionTriggerViewProps {
99
locale: string
10-
flowTypes: Array<{ item: ExtractedFlowType; icon: ReactNode }>
11-
functionDefinitions: Array<{ item: ExtractedFunctionDefinition; icon: ReactNode }>
10+
flowTypes: Array<{ item: ExtractedFlowType; icon?: string }>
11+
functionDefinitions: Array<{ item: ExtractedFunctionDefinition; icon?: string }>
1212
emptyLabels: {
1313
flowTypes: string
1414
functionDefinitions: string
@@ -21,7 +21,7 @@ type ViewMode = "both" | "flowTypes" | "functionDefinitions"
2121
interface DisplayItem {
2222
type: "flowType" | "functionDefinition"
2323
item: ExtractedFlowType | ExtractedFunctionDefinition
24-
icon: ReactNode
24+
icon?: string
2525
}
2626

2727
export function ActionTriggerView({ locale, flowTypes, functionDefinitions, emptyLabels }: ActionTriggerViewProps) {

src/components/cards/ActionCard.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { getIcon } from "@/components/IconRenderer"
1+
"use client"
2+
3+
import { ActionIcon } from "@/components/ActionIcon"
24
import type { ActionItem } from "@/lib/cms"
35
import type { AppLocale } from "@/lib/i18n"
46
import Link from "next/link"
@@ -11,7 +13,9 @@ export function ActionCard({ action, locale }: { action: ActionItem; locale: App
1113
<div className="relative z-10 flex flex-col gap-4">
1214
<div className="flex items-start gap-2">
1315
{action.icon && (
14-
<div className="flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl border border-white/5 bg-light text-white">{getIcon(action.icon, 28)}</div>
16+
<div className="flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl border border-white/5 bg-light text-white">
17+
<ActionIcon icon={action.icon} size={28} />
18+
</div>
1519
)}
1620

1721
<div className="min-w-0 flex flex-col justify-center mt-1">

0 commit comments

Comments
 (0)