1- import { ActionTriggerView } from "@/components/ActionTriggerView"
21import { ActionIcon } from "@/components/ActionIcon"
2+ import { ActionTriggerCard } from "@/components/ActionTriggerCard"
33import { ActionCard } from "@/components/cards/ActionCard"
44import { Aurora } from "@/components/ui/Aurora"
55import { LandingContainer } from "@/components/ui/LandingContainer"
@@ -13,6 +13,7 @@ import type { Media } from "@/payload-types"
1313import { IconArrowLeft } from "@tabler/icons-react"
1414import type { Metadata } from "next"
1515import { notFound } from "next/navigation"
16+ import type { ReactNode } from "react"
1617
1718export default async function ActionDetailPage ( { params } : { params : LocaleSlugPageParams } ) {
1819 const { locale, slug } = await getPageLocaleAndSlug ( params )
@@ -24,18 +25,12 @@ export default async function ActionDetailPage({ params }: { params: LocaleSlugP
2425 const moduleJson = await fetchMediaJson ( module ) . catch ( ( ) => null )
2526 const extractedFlowTypes = extractFlowTypesFromJson ( moduleJson )
2627 const extractedFunctionDefinitions = extractFunctionDefinitionsFromJson ( moduleJson )
27- const flowTypeItems = extractedFlowTypes . map ( ( item ) => ( {
28- item,
29- icon : item . displayIcon ,
30- } ) )
31- const functionDefinitionItems = extractedFunctionDefinitions . map ( ( item ) => ( {
32- item,
33- icon : item . displayIcon ?? "tabler:IconFunction" ,
34- } ) )
3528 const references = ( action . references ?? [ ] ) . filter ( ( reference ) : reference is Exclude < typeof reference , number > => typeof reference !== "number" )
3629 const tags = ( action . tags ?? [ ] ) . filter ( ( tag ) : tag is string => Boolean ( tag ) )
3730 const actionsBlock = findPageBlock ( actionsPage , "actions" )
3831 const referencesLabel = actionsBlock ?. referencesLabel ?? ( locale === "de" ? "Referenzen" : "References" )
32+ const flowTypesLabel = actionsBlock ?. flowTypesLabel ?? "FlowTypes"
33+ const functionDefinitionsLabel = actionsBlock ?. functionDefinitionsLabel ?? "FunctionDefinitions"
3934 const emptyDefinitionLabels = {
4035 flowTypes : actionsBlock ?. noFlowTypesFoundLabel ?? ( locale === "de" ? "Keine FlowTypes gefunden." : "No flow types found." ) ,
4136 functionDefinitions : actionsBlock ?. noFunctionDefinitionsFoundLabel ?? ( locale === "de" ? "Keine FunctionDefinitions gefunden." : "No function definitions found." ) ,
@@ -78,7 +73,27 @@ export default async function ActionDetailPage({ params }: { params: LocaleSlugP
7873 </ div >
7974 { action . description && < div className = "max-w-3xl whitespace-pre-line text-sm leading-6 text-secondary" > { action . description } </ div > }
8075
81- < ActionTriggerView locale = { locale } flowTypes = { flowTypeItems } functionDefinitions = { functionDefinitionItems } emptyLabels = { emptyDefinitionLabels } />
76+ { extractedFlowTypes . length > 0 || extractedFunctionDefinitions . length > 0 ? (
77+ < div className = "space-y-8" >
78+ < ActionDefinitionGroup label = { flowTypesLabel } >
79+ { extractedFlowTypes . length > 0 ? (
80+ extractedFlowTypes . map ( ( item ) => < ActionTriggerCard key = { item . id } type = "flowType" item = { item } /> )
81+ ) : (
82+ < p className = "px-2 text-sm text-tertiary" > { emptyDefinitionLabels . flowTypes } </ p >
83+ ) }
84+ </ ActionDefinitionGroup >
85+
86+ < ActionDefinitionGroup label = { functionDefinitionsLabel } >
87+ { extractedFunctionDefinitions . length > 0 ? (
88+ extractedFunctionDefinitions . map ( ( item ) => < ActionTriggerCard key = { item . id } type = "functionDefinition" item = { item } /> )
89+ ) : (
90+ < p className = "px-2 text-sm text-tertiary" > { emptyDefinitionLabels . functionDefinitions } </ p >
91+ ) }
92+ </ ActionDefinitionGroup >
93+ </ div >
94+ ) : (
95+ < p className = "px-2 text-sm text-tertiary" > { emptyDefinitionLabels . both } </ p >
96+ ) }
8297
8398 { references . length > 0 && (
8499 < div className = "space-y-3" >
@@ -98,6 +113,19 @@ export default async function ActionDetailPage({ params }: { params: LocaleSlugP
98113 )
99114}
100115
116+ function ActionDefinitionGroup ( { label, children } : { label : string ; children : ReactNode } ) {
117+ return (
118+ < div className = "space-y-4" >
119+ < div className = "flex items-center gap-3" >
120+ < div className = "h-px flex-1 bg-white/10" />
121+ < p className = "shrink-0 text-xs font-medium tracking-wider text-tertiary" > { label } </ p >
122+ < div className = "h-px flex-1 bg-white/10" />
123+ </ div >
124+ < div className = "flex flex-col gap-3" > { children } </ div >
125+ </ div >
126+ )
127+ }
128+
101129export async function generateMetadata ( { params } : { params : LocaleSlugPageParams } ) : Promise < Metadata > {
102130 const { locale, slug } = await params
103131 if ( ! slug ?. trim ( ) ) return createMetadata ( )
0 commit comments