add service detail page

This commit is contained in:
Schneider Roland
2025-05-21 22:28:12 +02:00
committed by Roland Schneider
parent 4a0cf5762f
commit 22272e0a17
11 changed files with 118 additions and 30 deletions

View File

@@ -0,0 +1,25 @@
{
"fields": ["*"],
"populate": {
"subscribe": {
"fields": ["*"]
},
"footer": {
"fields": ["*"],
"populate": {
"links": {
"fields": ["*"]
},
"contactUsEmail": {
"fields": ["*"]
},
"contactUsLocation": {
"fields": ["*"]
},
"contactUsPhoneNumber": {
"fields": ["*"]
}
}
}
}
}

View File

@@ -4,6 +4,7 @@ import qs from "qs";
import aboutQuery from "@/api/strapi/query/about.json";
import homeQuery from "@/api/strapi/query/home.json";
import servicesQuery from "@/api/strapi/query/services.json";
import serviceQuery from "@/api/strapi/query/service.json";
import pricesQuery from "@/api/strapi/query/prices.json";
import faqQuery from "@/api/strapi/query/faq.json";
import contactQuery from "@/api/strapi/query/contact.json";
@@ -14,6 +15,7 @@ import {PricesPage_Plain} from "@/types/generated-strapi-interfaces/api/prices-p
import {FaqPage_Plain} from "@/types/generated-strapi-interfaces/api/faq-page";
import {ContactPage_Plain} from "@/types/generated-strapi-interfaces/api/contact-page";
import {YogaSingleService_Plain} from "@/types/generated-strapi-interfaces/api/yoga-single-service";
import {ServicePage_Plain} from "@/types/generated-strapi-interfaces/api/service-page";
class StrapiApi{
@@ -43,7 +45,11 @@ class StrapiApi{
return this.getJson("/api/services-page?",servicesQuery);
}
public getServicePage(name: string): Promise<YogaSingleService_Plain[]>{
public getServicePage(): Promise<ServicePage_Plain>{
return this.getJson("/api/service-page?",serviceQuery);
}
public getService(name: string): Promise<YogaSingleService_Plain[]>{
return this.getJson("/api/yoga-single-services?", {
filters: {
name: {

View File

@@ -1,9 +1,12 @@
import React from "react";
import strapiApi from "@/api/strapi/strapi-api";
import {BlocksContent, BlocksRenderer} from "@strapi/blocks-react-renderer";
export default async function ServiceArticlePage({params}: {
params: { slug: string}
params: Promise<{ slug: string}>
} ) {
const servicesByName = await strapiApi.getServicePage(params.slug);
const {slug} = await params
const {footer= undefined, subscribeNow = undefined} = await strapiApi.getServicePage();
const servicesByName = await strapiApi.getService(slug);
// return (
// <>
// {header && description && <SubHeaderComponent header1={header} description={description} />}
@@ -17,10 +20,19 @@ export default async function ServiceArticlePage({params}: {
// <AosComponent />
// </>
// );
console.info("slug", params.slug);
console.info("slug", slug);
console.info("servicesByName", servicesByName);
const selectedService = servicesByName[0];
const article = selectedService.article;
console.info("article", article);
selectedService.article
return (
<div>hello world {params.slug}</div>
<>
<BlocksRenderer content={article as BlocksContent} />
{ subscribeNow && <SubscribeComponent config={subscribeNow} /> }
{ footer && <FooterComponent config={footer} /> }
</>
);
}

View File

@@ -17,7 +17,7 @@ export interface Article {
cover?: { data: Media };
author?: { data: Author };
category?: { data: Category };
blocks?: object;
blocks?: any;
};
}
export interface Article_Plain {
@@ -28,7 +28,7 @@ export interface Article_Plain {
cover?: Media_Plain;
author?: Author_Plain;
category?: Category_Plain;
blocks?: object;
blocks?: any;
}
export interface Article_NoRelations {
@@ -39,7 +39,7 @@ export interface Article_NoRelations {
cover?: number;
author?: number;
category?: number;
blocks?: object;
blocks?: any;
}
export interface Article_AdminPanelLifeCycle {
@@ -50,5 +50,5 @@ export interface Article_AdminPanelLifeCycle {
cover?: AdminPanelRelationPropertyModification<Media_Plain>;
author?: AdminPanelRelationPropertyModification<Author_Plain>;
category?: AdminPanelRelationPropertyModification<Category_Plain>;
blocks?: object;
blocks?: any;
}

View File

@@ -13,7 +13,7 @@ export interface YogaSingleService {
image?: { data: Media };
imageAlt?: string;
name?: string;
article?: string;
article?: any;
locale: string;
localizations?: { data: YogaSingleService[] };
};
@@ -26,7 +26,7 @@ export interface YogaSingleService_Plain {
image?: Media_Plain;
imageAlt?: string;
name?: string;
article?: string;
article?: any;
locale: string;
localizations?: YogaSingleService_Plain[];
}
@@ -39,7 +39,7 @@ export interface YogaSingleService_NoRelations {
image?: number;
imageAlt?: string;
name?: string;
article?: string;
article?: any;
locale: string;
localizations?: YogaSingleService[];
}
@@ -52,7 +52,7 @@ export interface YogaSingleService_AdminPanelLifeCycle {
image?: AdminPanelRelationPropertyModification<Media_Plain>;
imageAlt?: string;
name?: string;
article?: string;
article?: any;
locale: string;
localizations?: YogaSingleService[];
}