Skip to content

Commit 9ab6416

Browse files
committed
feat: remove feature collection & bind to block fields
1 parent dbb7c15 commit 9ab6416

22 files changed

Lines changed: 16801 additions & 338 deletions

src/blocks/BentoBlock.ts

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
import { sectionFields } from "@/fields/sectionFields"
2-
import type { Block } from "payload"
2+
import type { Block, Field } from "payload"
3+
4+
function cardContentFields(name: string, label: string): Field {
5+
return {
6+
name,
7+
label,
8+
type: "group",
9+
fields: [
10+
{
11+
name: "title",
12+
type: "text",
13+
localized: true,
14+
},
15+
{
16+
name: "description",
17+
type: "textarea",
18+
localized: true,
19+
},
20+
{
21+
name: "link",
22+
label: "Link",
23+
type: "group",
24+
fields: [
25+
{
26+
name: "label",
27+
type: "text",
28+
localized: true,
29+
},
30+
{
31+
name: "url",
32+
type: "text",
33+
},
34+
],
35+
},
36+
],
37+
}
38+
}
339

440
export const BentoBlock: Block = {
541
slug: "bento",
@@ -26,5 +62,33 @@ export const BentoBlock: Block = {
2662
},
2763
],
2864
},
65+
{
66+
name: "featureContent",
67+
label: "Feature cards",
68+
type: "group",
69+
admin: {
70+
condition: (_, siblingData) => siblingData?.variant === "feature",
71+
},
72+
fields: [
73+
cardContentFields("projects", "Projects"),
74+
cardContentFields("roleSystem", "Role System"),
75+
cardContentFields("organizations", "Organizations"),
76+
cardContentFields("memberManagement", "Member Management"),
77+
],
78+
},
79+
{
80+
name: "runtimeContent",
81+
label: "Runtime cards",
82+
type: "group",
83+
admin: {
84+
condition: (_, siblingData) => siblingData?.variant === "runtime",
85+
},
86+
fields: [
87+
cardContentFields("nodes", "Nodes"),
88+
cardContentFields("suggestionMenu", "Suggestion Menu"),
89+
cardContentFields("actionList", "Action List"),
90+
cardContentFields("runtimeTypes", "Runtime Types"),
91+
],
92+
},
2993
],
3094
}

src/collections/features.ts

Lines changed: 0 additions & 88 deletions
This file was deleted.

src/components/actions/ActionListCard.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
import { getFeatureBySlug } from "@/lib/cms"
2-
import { type AppLocale } from "@/lib/i18n"
31
import { SiDhl, SiDiscord, SiGithub, SiGitlab, SiGoogleanalytics, SiNotion, SiPaypal, SiSap, SiTelegram, SiX } from "@icons-pack/react-simple-icons"
42
import { OrbitingCircles } from "../animations/OrbitingCircles"
5-
import { FeatureCardText } from "../ui/FeatureCardText"
3+
import { FeatureCardText, type FeatureCardContent } from "../ui/FeatureCardText"
64
import { FeatureCard } from "../cards/FeatureCard"
75

86
interface ActionListCardProps {
9-
locale: AppLocale
7+
content?: FeatureCardContent
108
animationDelay?: number
119
}
1210

13-
export async function ActionListCard({ locale, animationDelay = 0 }: ActionListCardProps) {
14-
const content = await getFeatureBySlug("action-list", locale)
15-
11+
export function ActionListCard({ content, animationDelay = 0 }: ActionListCardProps) {
1612
return (
1713
<FeatureCard className="col-span-1 row-span-4" contentClassName="items-start justify-end" tone="aqua" animationDelay={animationDelay}>
1814
<div className="pointer-events-none absolute inset-x-0 top-[52%] z-0 flex -translate-y-1/2 justify-center">
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import { type AppLocale } from "@/lib/i18n"
1+
import type { BentoLayoutBlock } from "@/lib/cms"
22
import { BentoGrid } from "../ui/BentoGrid"
33
import { ProjectsCard } from "../cards/ProjectsCard"
44
import { RoleSystemCard } from "../cards/RoleSystemCard"
55
import { OrganizationCard } from "../cards/OrganizationCard"
66
import { MemberManagementCard } from "../cards/MemberManagementCard"
77

88
interface FeatureBentoProps {
9-
locale: AppLocale
9+
content?: BentoLayoutBlock["featureContent"]
1010
}
1111

12-
export function FeatureBento({ locale }: FeatureBentoProps) {
12+
export function FeatureBento({ content }: FeatureBentoProps) {
1313
return (
1414
<BentoGrid>
15-
<ProjectsCard locale={locale} animationDelay={0} />
16-
<RoleSystemCard locale={locale} animationDelay={120} />
17-
<OrganizationCard locale={locale} animationDelay={240} />
18-
<MemberManagementCard locale={locale} animationDelay={360} />
15+
<ProjectsCard content={content?.projects} animationDelay={0} />
16+
<RoleSystemCard content={content?.roleSystem} animationDelay={120} />
17+
<OrganizationCard content={content?.organizations} animationDelay={240} />
18+
<MemberManagementCard content={content?.memberManagement} animationDelay={360} />
1919
</BentoGrid>
2020
)
2121
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import { type AppLocale } from "@/lib/i18n"
1+
import type { BentoLayoutBlock } from "@/lib/cms"
22
import { ActionListCard } from "../actions/ActionListCard"
33
import { NodeCard } from "../cards/NodeCard"
44
import { RuntimeTypesCard } from "../cards/RuntimeTypesCard"
55
import { SuggestionMenuCard } from "../cards/SuggestionMenuCard"
66
import { BentoGrid } from "../ui/BentoGrid"
77

88
interface RuntimeFeatureSectionProps {
9-
locale: AppLocale
9+
content?: BentoLayoutBlock["runtimeContent"]
1010
}
1111

12-
export function RuntimeBento({ locale }: RuntimeFeatureSectionProps) {
12+
export function RuntimeBento({ content }: RuntimeFeatureSectionProps) {
1313
return (
1414
<BentoGrid columns={3}>
15-
<NodeCard locale={locale} animationDelay={0} />
16-
<SuggestionMenuCard locale={locale} animationDelay={120} />
17-
<ActionListCard locale={locale} animationDelay={240} />
18-
<RuntimeTypesCard locale={locale} animationDelay={360} />
15+
<NodeCard content={content?.nodes} animationDelay={0} />
16+
<SuggestionMenuCard content={content?.suggestionMenu} animationDelay={120} />
17+
<ActionListCard content={content?.actionList} animationDelay={240} />
18+
<RuntimeTypesCard content={content?.runtimeTypes} animationDelay={360} />
1919
</BentoGrid>
2020
)
2121
}

src/components/cards/MemberManagementCard.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import { getFeatureBySlug } from "@/lib/cms"
2-
import { type AppLocale } from "@/lib/i18n"
31
import { ClientMemberCard } from "./ClientMemberCard"
4-
import { FeatureCardText } from "../ui/FeatureCardText"
2+
import { FeatureCardText, type FeatureCardContent } from "../ui/FeatureCardText"
53
import { FeatureCard } from "./FeatureCard"
64

75
interface MemberMangementCardProps {
8-
locale: AppLocale
6+
content?: FeatureCardContent
97
animationDelay?: number
108
}
119

12-
export async function MemberManagementCard({ locale, animationDelay = 0 }: MemberMangementCardProps) {
13-
const content = await getFeatureBySlug("member-management", locale)
14-
10+
export function MemberManagementCard({ content, animationDelay = 0 }: MemberMangementCardProps) {
1511
return (
1612
<FeatureCard className="col-span-1 md:col-span-2 row-span-2" contentClassName="justify-between" animationDelay={animationDelay}>
1713
<div className="flex w-full flex-1 items-start justify-center min-h-0">

src/components/cards/NodeCard.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import { getFeatureBySlug } from "@/lib/cms"
2-
import { type AppLocale } from "@/lib/i18n"
3-
import { FeatureCardText } from "../ui/FeatureCardText"
1+
import { FeatureCardText, type FeatureCardContent } from "../ui/FeatureCardText"
42
import { FeatureCard } from "./FeatureCard"
53
import { NodesAnimation } from "../animations/NodesAnimation"
64

75
interface NodeTabsCardProps {
8-
locale: AppLocale
6+
content?: FeatureCardContent
97
animationDelay?: number
108
}
119

12-
export async function NodeCard({ locale, animationDelay = 0 }: NodeTabsCardProps) {
13-
const content = await getFeatureBySlug("nodes", locale)
14-
10+
export function NodeCard({ content, animationDelay = 0 }: NodeTabsCardProps) {
1511
return (
1612
<FeatureCard className="col-span-1 md:col-span-2 row-span-4 md:row-span-3" tone="pink" animationDelay={animationDelay}>
1713
<div aria-hidden="true" className="pointer-events-none absolute inset-x-0 top-4 z-0 flex items-start justify-center overflow-hidden lg:top-8 2xl:top-16">

src/components/cards/OrganizationCard.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import { type AppLocale } from "@/lib/i18n"
2-
import { getFeatureBySlug } from "@/lib/cms"
31
import { FeatureCard } from "./FeatureCard"
4-
import { FeatureCardText } from "../ui/FeatureCardText"
2+
import { FeatureCardText, type FeatureCardContent } from "../ui/FeatureCardText"
53
import { ClientOrganizationCard } from "./ClientOrganizationCard"
64

75
interface OrganizationCardProps {
8-
locale: AppLocale
6+
content?: FeatureCardContent
97
animationDelay?: number
108
}
119

12-
export async function OrganizationCard({ locale, animationDelay = 0 }: OrganizationCardProps) {
13-
const content = await getFeatureBySlug("organizations", locale)
14-
10+
export function OrganizationCard({ content, animationDelay = 0 }: OrganizationCardProps) {
1511
return (
1612
<FeatureCard className="col-span-1 md:col-span-3 row-span-3" tone="blue" animationDelay={animationDelay}>
1713
<div className="flex w-full flex-1 items-start justify-center min-h-0">

src/components/cards/ProjectsCard.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import { getFeatureBySlug } from "@/lib/cms"
2-
import { type AppLocale } from "@/lib/i18n"
3-
import { FeatureCardText } from "../ui/FeatureCardText"
1+
import { FeatureCardText, type FeatureCardContent } from "../ui/FeatureCardText"
42
import { ClientProjectCard } from "./ClientProjectCard"
53
import { FeatureCard } from "./FeatureCard"
64

75
interface ProjectsCardProps {
8-
locale: AppLocale
6+
content?: FeatureCardContent
97
animationDelay?: number
108
}
119

12-
export async function ProjectsCard({ locale, animationDelay = 0 }: ProjectsCardProps) {
13-
const content = await getFeatureBySlug("projects", locale)
14-
10+
export function ProjectsCard({ content, animationDelay = 0 }: ProjectsCardProps) {
1511
return (
1612
<FeatureCard className="col-span-1 md:col-span-2 row-span-3" tone="aqua" animationDelay={animationDelay}>
1713
<div className="flex w-full flex-1 items-start justify-center min-h-0">

src/components/cards/RoleSystemCard.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { getFeatureBySlug } from "@/lib/cms"
2-
import { type AppLocale } from "@/lib/i18n"
3-
import { FeatureCardText } from "../ui/FeatureCardText"
1+
import { FeatureCardText, type FeatureCardContent } from "../ui/FeatureCardText"
42
import { FeatureCard } from "./FeatureCard"
53
import { RoleSystemAnimation } from "../animations/RoleSystemAnimation"
64

75
interface RoleSystemCardProps {
8-
locale: AppLocale
6+
content?: FeatureCardContent
97
animationDelay?: number
108
}
119

@@ -40,9 +38,7 @@ const ROLES = [
4038
},
4139
]
4240

43-
export async function RoleSystemCard({ locale, animationDelay = 0 }: RoleSystemCardProps) {
44-
const content = await getFeatureBySlug("role-system", locale)
45-
41+
export function RoleSystemCard({ content, animationDelay = 0 }: RoleSystemCardProps) {
4642
return (
4743
<FeatureCard
4844
className="col-span-1 md:col-span-3 row-span-2"

0 commit comments

Comments
 (0)