11import { notFound } from 'next/navigation'
22import { getTranslations } from 'next-intl/server'
3- import { BackToNavigation } from '@/components/controls/BackToNavigation'
4- import { Breadcrumb } from '@/components/controls/Breadcrumb'
5- import Footer from '@/components/Footer'
6- import Header from '@/components/Header'
7- import { JsonLd } from '@/components/JsonLd'
8- import { ProductCommands , ProductHero , ProductLinks , ProductPricing } from '@/components/product'
93import type { Locale } from '@/i18n/config'
104import { getExtension } from '@/lib/data/fetchers'
115import { extensionsData as extensions } from '@/lib/generated'
12- import { getGithubStars } from '@/lib/generated/github-stars'
136import { translateLicenseText } from '@/lib/license'
147import { generateSoftwareDetailMetadata } from '@/lib/metadata'
15- import { getSchemaCurrency , getSchemaPrice } from '@/lib/pricing '
8+ import { ProductDetailTemplate } from '@/templates '
169
1710export const revalidate = 3600
1811
@@ -34,9 +27,13 @@ export async function generateMetadata({
3427 return { title : 'Extension Not Found | AI Coding Stack' }
3528 }
3629
37- const t = await getTranslations ( { locale } )
38- const licenseStr = extension . license ? translateLicenseText ( extension . license , t ) : ''
39- const platforms = extension . supportedIdes ?. map ( ideSupport => ( { os : ideSupport . ideId } ) )
30+ const tGlobal = await getTranslations ( { locale } )
31+ const licenseStr = extension . license ? translateLicenseText ( extension . license , tGlobal ) : ''
32+
33+ // Convert supportedIdes to platforms format for metadata generation
34+ const platforms = extension . supportedIdes ?. map ( ideSupport => ( {
35+ os : ideSupport . ideId ,
36+ } ) )
4037
4138 return await generateSoftwareDetailMetadata ( {
4239 locale : locale as Locale ,
@@ -50,7 +47,7 @@ export async function generateMetadata({
5047 pricing : extension . pricing ,
5148 license : licenseStr ,
5249 } ,
53- typeDescription : 'AI Coding Extension' ,
50+ typeDescription : 'AI Coding Assistant Extension' ,
5451 } )
5552}
5653
@@ -69,120 +66,30 @@ export default async function ExtensionPage({
6966 const t = await getTranslations ( { locale, namespace : 'pages.extensionDetail' } )
7067 const tGlobal = await getTranslations ( { locale } )
7168
72- const websiteUrl = extension . resourceUrls ?. download || extension . websiteUrl
73- const docsUrl = extension . docsUrl || undefined
74-
75- // Schema.org structured data
76- const softwareApplicationSchema = {
77- '@context' : 'https://schema.org' ,
78- '@type' : 'SoftwareApplication' ,
79- name : extension . name ,
80- applicationCategory : 'DeveloperApplication' ,
81- applicationSubCategory : 'AI Assistant' ,
82- operatingSystem : 'Cross-platform' ,
83- compatibleWith :
84- extension . supportedIdes ?. map ( ideSupport => ideSupport . ideId ) . join ( ', ' ) ||
85- 'VS Code, JetBrains IDEs' ,
86- softwareVersion : extension . latestVersion ,
87- description : extension . description ,
88- url : websiteUrl ,
89- downloadUrl :
90- extension . resourceUrls ?. download || extension . supportedIdes ?. [ 0 ] ?. marketplaceUrl || undefined ,
91- installUrl :
92- extension . resourceUrls ?. download || extension . supportedIdes ?. [ 0 ] ?. marketplaceUrl || undefined ,
93- author : {
94- '@type' : 'Organization' ,
95- name : extension . vendor ,
96- } ,
97- offers :
98- extension . pricing && extension . pricing . length > 0
99- ? extension . pricing . map ( tier => {
100- return {
101- '@type' : 'Offer' ,
102- name : tier . name ,
103- price : getSchemaPrice ( tier ) ,
104- priceCurrency : getSchemaCurrency ( tier ) ,
105- category : tier . category ,
106- }
107- } )
108- : {
109- '@type' : 'Offer' ,
110- price : '0' ,
111- priceCurrency : 'USD' ,
112- } ,
113- license : extension . license ? translateLicenseText ( extension . license , tGlobal ) : undefined ,
114- }
115-
11669 return (
117- < >
118- < JsonLd data = { softwareApplicationSchema } />
119- < Header />
120-
121- < Breadcrumb
122- items = { [
123- { name : tGlobal ( 'shared.common.aiCodingStack' ) , href : '/ai-coding-stack' } ,
124- { name : tGlobal ( 'shared.stacks.extensions' ) , href : 'extensions' } ,
125- { name : extension . name , href : `extensions/${ extension . id } ` } ,
126- ] }
127- />
128-
129- { /* Hero Section */ }
130- < ProductHero
131- name = { extension . name }
132- description = { extension . description }
133- vendor = { extension . vendor }
134- category = "IDE"
135- categoryLabel = { t ( 'categoryLabel' ) }
136- latestVersion = { extension . latestVersion }
137- license = { extension . license }
138- githubStars = { getGithubStars ( 'extensions' , extension . id ) }
139- additionalInfo = {
140- extension . supportedIdes && extension . supportedIdes . length > 0
141- ? [
142- {
143- label : t ( 'supportedIdes' ) ,
144- value : extension . supportedIdes . map ( ideSupport => ideSupport . ideId ) . join ( ', ' ) ,
145- } ,
146- ]
147- : undefined
148- }
149- websiteUrl = { websiteUrl }
150- docsUrl = { docsUrl }
151- downloadUrl = {
152- extension . resourceUrls ?. download ||
153- extension . supportedIdes ?. [ 0 ] ?. marketplaceUrl ||
154- undefined
155- }
156- labels = { {
70+ < ProductDetailTemplate
71+ product = { extension }
72+ productType = "extension"
73+ locale = { locale as Locale }
74+ category = "extensions"
75+ translations = { {
76+ categoryLabel : t ( 'categoryLabel' ) ,
77+ allProductsLabel : t ( 'allExtensions' ) ,
78+ breadcrumbs : {
79+ home : tGlobal ( 'shared.common.aiCodingStack' ) ,
80+ category : tGlobal ( 'shared.stacks.extensions' ) ,
81+ } ,
82+ productHero : {
15783 vendor : t ( 'vendor' ) ,
15884 version : t ( 'version' ) ,
15985 license : t ( 'license' ) ,
16086 stars : t ( 'stars' ) ,
87+ supportedIdes : t ( 'supportedIdes' ) ,
16188 visitWebsite : t ( 'visitWebsite' ) ,
16289 documentation : t ( 'documentation' ) ,
16390 download : t ( 'download' ) ,
164- } }
165- />
166-
167- { /* Pricing */ }
168- < ProductPricing
169- pricing = { extension . pricing }
170- pricingUrl = { extension . resourceUrls ?. pricing || undefined }
171- />
172-
173- { /* Additional Links */ }
174- < ProductLinks resourceUrls = { { } } communityUrls = { { } } />
175-
176- { /* Commands */ }
177- < ProductCommands
178- install = { extension . supportedIdes ?. [ 0 ] ?. installCommand || extension . install || undefined }
179- launch = { extension . launch || undefined }
180- />
181-
182- { /* Navigation */ }
183- < BackToNavigation href = "extensions" title = { t ( 'allExtensions' ) } />
184-
185- < Footer />
186- </ >
91+ } ,
92+ } }
93+ />
18794 )
18895}
0 commit comments