diff --git a/dashboard/src/app/page.tsx b/dashboard/src/app/page.tsx index 59f982c..41b48da 100644 --- a/dashboard/src/app/page.tsx +++ b/dashboard/src/app/page.tsx @@ -1,6 +1,5 @@ export const dynamic = 'error' -import ArticleFeed from '@components/home/ArticleFeed' import ProductMatrix from '@components/home/ProductMatrix' import Sidebar from '@components/home/Sidebar' import CommunityFeedServer from '@components/home/CommunityFeedServer' @@ -21,7 +20,6 @@ export default function HomePage() { -} diff --git a/dashboard/src/components/home/ArticleFeedClient.tsx b/dashboard/src/components/home/ArticleFeedClient.tsx deleted file mode 100644 index 9d3d709..0000000 --- a/dashboard/src/components/home/ArticleFeedClient.tsx +++ /dev/null @@ -1,112 +0,0 @@ -'use client' - -import Link from 'next/link' -import { useMemo } from 'react' - -import type { HomepagePost } from '@cms/content' -import { useLanguage } from '@i18n/LanguageProvider' -import { translations } from '@i18n/translations' - -type ArticleFeedClientProps = { - posts: HomepagePost[] -} - -function formatDate(value: string | undefined, locale: string) { - if (!value) return undefined - const date = new Date(value) - if (Number.isNaN(date.getTime())) { - return value - } - return new Intl.DateTimeFormat(locale, { - year: 'numeric', - month: 'short', - day: 'numeric', - }).format(date) -} - -export default function ArticleFeedClient({ posts }: ArticleFeedClientProps) { - const { language } = useLanguage() - const marketing = translations[language].marketing.home - const { articleFeed } = marketing - const articleOverrides = marketing.articleOverrides - - const mappedPosts = useMemo( - () => - posts.map((post) => { - const override = articleOverrides?.[post.slug] - return { - ...post, - title: override?.title ?? post.title, - author: override?.author ?? post.author, - readingTime: override?.readingTime ?? post.readingTime, - excerpt: override?.excerpt ?? post.excerpt, - tags: override?.tags ?? post.tags, - formattedDate: formatDate(post.date, articleFeed.dateLocale), - } - }), - [articleFeed.dateLocale, articleOverrides, posts], - ) - - return ( -
-
-
-

{articleFeed.eyebrow}

-

{articleFeed.title}

-
- - {articleFeed.viewAll} - -
-
- {!mappedPosts.length ? ( -

- {articleFeed.empty} -

- ) : null} - {mappedPosts.map((post) => ( -
-
- {post.formattedDate ? {post.formattedDate} : null} - {post.author ? ( - - - {post.author} - - ) : null} - {post.readingTime ? ( - - - {post.readingTime} - - ) : null} -
-

- {post.title} -

- {post.excerpt ?

{post.excerpt}

: null} - {post.tags.length ? ( -
- {post.tags.map((tag) => ( - - #{tag} - - ))} -
- ) : null} -
- ))} -
-
- ) -} - diff --git a/dashboard/src/lib/cms/templates/default/config.ts b/dashboard/src/lib/cms/templates/default/config.ts index 59bd9ab..19deb02 100644 --- a/dashboard/src/lib/cms/templates/default/config.ts +++ b/dashboard/src/lib/cms/templates/default/config.ts @@ -18,7 +18,6 @@ export const defaultHomeLayoutConfig: CommonHomeLayoutConfig = { contentClassName: 'mx-auto w-full max-w-6xl', gridClassName: 'grid gap-8 lg:grid-cols-[minmax(0,1fr)_360px] lg:items-start lg:gap-12', slots: [ - { key: 'ArticleFeed' }, { key: 'CommunityFeed' }, { key: 'Sidebar' }, ], diff --git a/dashboard/src/modules/templates/default/index.tsx b/dashboard/src/modules/templates/default/index.tsx index 858b059..eed8715 100644 --- a/dashboard/src/modules/templates/default/index.tsx +++ b/dashboard/src/modules/templates/default/index.tsx @@ -1,4 +1,3 @@ -import ArticleFeed from '@components/home/ArticleFeed' import ProductMatrix from '@components/home/ProductMatrix' import Sidebar from '@components/home/Sidebar' @@ -9,7 +8,6 @@ import type { TemplateDefinition } from '../types' const DefaultHomePageTemplate = createCommonHomeTemplate(defaultHomeLayoutConfig, { ProductMatrix, - ArticleFeed, Sidebar, }) diff --git a/dashboard/src/modules/templates/types.ts b/dashboard/src/modules/templates/types.ts index 559a50b..eb8f6e9 100644 --- a/dashboard/src/modules/templates/types.ts +++ b/dashboard/src/modules/templates/types.ts @@ -13,12 +13,11 @@ export type TemplateComponent = Co export interface HomePageTemplateSlots extends TemplateSlots { ProductMatrix: ComponentType - ArticleFeed: ComponentType CommunityFeed: ComponentType Sidebar: ComponentType } -export type HomePageSlotKey = 'ProductMatrix' | 'ArticleFeed' | 'CommunityFeed' | 'Sidebar' +export type HomePageSlotKey = 'ProductMatrix' | 'CommunityFeed' | 'Sidebar' export type HomePageTemplateProps = TemplateRenderProps