Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/[locale]/desktops/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export default async function DesktopPage({
<main className="max-w-8xl mx-auto px-[var(--spacing-md)]">
<ProductHero
name={desktop.name}
manifestId={desktop.id}
description={desktop.description}
vendor={desktop.vendor}
category="DESKTOP"
Expand Down
1 change: 1 addition & 0 deletions src/app/[locale]/extensions/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default async function ExtensionPage({
<main className="max-w-8xl mx-auto px-[var(--spacing-md)]">
<ProductHero
name={extension.name}
manifestId={extension.id}
description={extension.description}
vendor={extension.vendor}
category="EXTENSION"
Expand Down
1 change: 1 addition & 0 deletions src/app/[locale]/ides/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default async function IDEPage({
<main className="max-w-8xl mx-auto px-[var(--spacing-md)]">
<ProductHero
name={ide.name}
manifestId={ide.id}
description={ide.description}
vendor={ide.vendor}
category="IDE"
Expand Down
1 change: 1 addition & 0 deletions src/app/[locale]/model-providers/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export default async function ProviderPage({
<main className="max-w-8xl mx-auto px-[var(--spacing-md)]">
<ProductHero
name={provider.name}
manifestId={provider.id}
description={provider.description}
category="PROVIDER"
categoryLabel={tShared('categories.singular.modelProvider')}
Expand Down
1 change: 1 addition & 0 deletions src/app/[locale]/models/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export default async function ModelPage({
<main className="max-w-8xl mx-auto px-[var(--spacing-md)]">
<ProductHero
name={model.name}
manifestId={model.id}
description={
<>
{tShared('terms.by')}{' '}
Expand Down
1 change: 1 addition & 0 deletions src/app/[locale]/vendors/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export default async function VendorPage({
<main className="max-w-8xl mx-auto px-[var(--spacing-md)]">
<ProductHero
name={vendor.name}
manifestId={vendor.id}
description={vendor.description}
category="VENDOR"
categoryLabel={tShared('categories.singular.vendor')}
Expand Down
10 changes: 7 additions & 3 deletions src/components/product/CLILandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { ReactNode } from 'react'
import { DeprecatedBadge } from '@/components/controls/DeprecatedBadge'
import { VerifiedBadge } from '@/components/controls/VerifiedBadge'
import { CLICommandPanel } from '@/components/product/CLICommandPanel'
import { ManifestEditLink } from '@/components/product/ManifestEditLink'
import { ProductPricing } from '@/components/product/ProductPricing'
import { RelatedProducts, type RelatedProductsProps } from '@/components/product/RelatedProducts'
import { Link } from '@/i18n/navigation'
Expand Down Expand Up @@ -120,9 +121,12 @@ export function CLILandingPage({
{cli.deprecated && <DeprecatedBadge size="sm" />}
</div>

<h1 className="text-5xl md:text-6xl font-semibold tracking-[-0.05em] detail-page-h1 mb-[var(--spacing-md)]">
{cli.name}
</h1>
<div className="flex items-center gap-[var(--spacing-xs)] mb-[var(--spacing-md)]">
<h1 className="text-5xl md:text-6xl font-semibold tracking-[-0.05em] detail-page-h1">
{cli.name}
</h1>
<ManifestEditLink category="CLI" manifestId={cli.id} />
</div>
<p className="text-xl leading-relaxed font-medium max-w-2xl mb-[var(--spacing-sm)]">
{content.answer}
</p>
Expand Down
26 changes: 26 additions & 0 deletions src/components/product/ManifestEditLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Github } from 'lucide-react'
import { useTranslations } from 'next-intl'
import { getManifestEditUrl, type ManifestCategory } from '@/lib/manifest-source'

export interface ManifestEditLinkProps {
category: ManifestCategory
manifestId: string
}

export function ManifestEditLink({ category, manifestId }: ManifestEditLinkProps) {
const tComponent = useTranslations('components.product')
const label = tComponent('productHero.editManifest')

return (
<a
href={getManifestEditUrl(category, manifestId)}
target="_blank"
rel="noopener noreferrer"
aria-label={label}
title={label}
className="inline-flex size-8 shrink-0 items-center justify-center text-[var(--color-text-muted)] hover:text-[var(--color-text)] transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-text)]"
>
<Github size={19} strokeWidth={1.6} aria-hidden="true" />
</a>
)
}
7 changes: 6 additions & 1 deletion src/components/product/ProductHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ import { useTranslations } from 'next-intl'
import React from 'react'
import { DeprecatedBadge } from '@/components/controls/DeprecatedBadge'
import { VerifiedBadge } from '@/components/controls/VerifiedBadge'
import { ManifestEditLink } from '@/components/product/ManifestEditLink'
import { Link } from '@/i18n/navigation'
import { renderLicense } from '@/lib/license'
import type { ManifestCategory } from '@/lib/manifest-source'

export interface ProductHeroProps {
// Product identity
name: string
description: React.ReactNode
vendor?: string
vendorHref?: string
category: 'CLI' | 'IDE' | 'DESKTOP' | 'EXTENSION' | 'PROVIDER' | 'MODEL' | 'VENDOR'
category: ManifestCategory
manifestId: string
categoryLabel?: string // Optional custom label for the badge
verified?: boolean // Whether the product is verified
deprecated?: boolean // Whether the entity has been superseded or is no longer recommended
Expand Down Expand Up @@ -63,6 +66,7 @@ export function ProductHero({
vendor,
vendorHref,
category,
manifestId,
categoryLabel,
verified = false,
deprecated = false,
Expand Down Expand Up @@ -103,6 +107,7 @@ export function ProductHero({
<h1 className="text-5xl font-semibold tracking-[-0.04em] detail-page-h1">{name}</h1>
{verified && <VerifiedBadge size="lg" />}
{deprecated && <DeprecatedBadge size="lg" />}
<ManifestEditLink category={category} manifestId={manifestId} />
</div>
<div className="absolute bottom-0 right-0 translate-x-[calc(100%+1rem)]">
<div className="px-[var(--spacing-xs)] py-[2px] text-xs text-[var(--color-text-muted)] border-[1.5px] border-double border-[var(--color-border-strong)] whitespace-nowrap">
Expand Down
23 changes: 23 additions & 0 deletions src/lib/manifest-source.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export type ManifestCategory =
| 'CLI'
| 'DESKTOP'
| 'EXTENSION'
| 'IDE'
| 'MODEL'
| 'PROVIDER'
| 'VENDOR'

const manifestDirectories: Record<ManifestCategory, string> = {
CLI: 'clis',
DESKTOP: 'desktops',
EXTENSION: 'extensions',
IDE: 'ides',
MODEL: 'models',
PROVIDER: 'providers',
VENDOR: 'vendors',
}

export function getManifestEditUrl(category: ManifestCategory, manifestId: string): string {
const directory = manifestDirectories[category]
return `https://github.com/aicodingstack/aicodingstack.io/edit/main/manifests/${directory}/${encodeURIComponent(manifestId)}.json`
}
34 changes: 34 additions & 0 deletions tests/manifest-source.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import fs from 'node:fs'
import path from 'node:path'
import { describe, expect, it } from 'vitest'
import { getManifestEditUrl, type ManifestCategory } from '@/lib/manifest-source'

const categories: Array<[ManifestCategory, string]> = [
['IDE', 'ides'],
['CLI', 'clis'],
['DESKTOP', 'desktops'],
['EXTENSION', 'extensions'],
['MODEL', 'models'],
['PROVIDER', 'providers'],
['VENDOR', 'vendors'],
]

describe('manifest source links', () => {
it.each(categories)(
'opens every %s manifest in the matching GitHub directory',
(category, directory) => {
const manifestFiles = fs
.readdirSync(path.join(process.cwd(), 'manifests', directory))
.filter(file => file.endsWith('.json'))

expect(manifestFiles.length).toBeGreaterThan(0)

for (const file of manifestFiles) {
const manifestId = path.basename(file, '.json')
expect(getManifestEditUrl(category, manifestId)).toBe(
`https://github.com/aicodingstack/aicodingstack.io/edit/main/manifests/${directory}/${manifestId}.json`
)
}
}
)
})
1 change: 1 addition & 0 deletions translations/de/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "Starten"
},
"productHero": {
"editManifest": "Diesen Eintrag auf GitHub bearbeiten",
"runtime": "Laufzeit"
},
"productPricing": {
Expand Down
1 change: 1 addition & 0 deletions translations/en/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "Launch"
},
"productHero": {
"editManifest": "Edit this entry on GitHub",
"runtime": "Runtime"
},
"productPricing": {
Expand Down
1 change: 1 addition & 0 deletions translations/es/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "Iniciar"
},
"productHero": {
"editManifest": "Editar esta entrada en GitHub",
"runtime": "Tiempo de ejecución"
},
"productPricing": {
Expand Down
1 change: 1 addition & 0 deletions translations/fr/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "Lancer"
},
"productHero": {
"editManifest": "Modifier cette fiche sur GitHub",
"runtime": "Exécution"
},
"productPricing": {
Expand Down
1 change: 1 addition & 0 deletions translations/id/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "Luncurkan"
},
"productHero": {
"editManifest": "Edit entri ini di GitHub",
"runtime": "Waktu proses"
},
"productPricing": {
Expand Down
1 change: 1 addition & 0 deletions translations/ja/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "起動"
},
"productHero": {
"editManifest": "この項目をGitHubで編集",
"runtime": "ランタイム"
},
"productPricing": {
Expand Down
1 change: 1 addition & 0 deletions translations/ko/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "실행"
},
"productHero": {
"editManifest": "GitHub에서 이 항목 수정",
"runtime": "런타임"
},
"productPricing": {
Expand Down
1 change: 1 addition & 0 deletions translations/pt/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "Iniciar"
},
"productHero": {
"editManifest": "Editar esta entrada no GitHub",
"runtime": "Ambiente de execução"
},
"productPricing": {
Expand Down
1 change: 1 addition & 0 deletions translations/ru/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "Запустить"
},
"productHero": {
"editManifest": "Изменить эту запись на GitHub",
"runtime": "Среда выполнения"
},
"productPricing": {
Expand Down
1 change: 1 addition & 0 deletions translations/tr/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "Başlat"
},
"productHero": {
"editManifest": "Bu kaydı GitHub'da düzenle",
"runtime": "Çalışma Zamanı"
},
"productPricing": {
Expand Down
1 change: 1 addition & 0 deletions translations/zh-Hans/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "启动"
},
"productHero": {
"editManifest": "在 GitHub 上编辑此条目",
"runtime": "运行时"
},
"productPricing": {
Expand Down
1 change: 1 addition & 0 deletions translations/zh-Hant/components/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"launch": "啟動"
},
"productHero": {
"editManifest": "在 GitHub 上編輯此項目",
"runtime": "執行期"
},
"productPricing": {
Expand Down
Loading