[yoga-12] add common section to home API and update related components for logo image

This commit is contained in:
Roland Schneider 2025-07-09 16:13:13 +02:00
parent 7133e43464
commit 1a7c5c5247
9 changed files with 54 additions and 7 deletions

View File

@ -29,7 +29,7 @@ GET {{domain}}/api/yoga-single-services?filters[name][$eq]=service4
Accept: application/json Accept: application/json
### GET service page ### GET service page
GET {{domain}}/api/contact-page?fields[0]=*&populate[contactUs][fields][0]=*&populate[google_maps][fields][0]=*&populate[subscribe][fields][0]=*&populate[footer][fields][0]=*&populate[footer][populate][links][fields][0]=*&populate[footer][populate][contactUsEmail][fields][0]=*&populate[footer][populate][contactUsLocation][fields][0]=*&populate[footer][populate][contactUsPhoneNumber][fields][0]=* GET {{domain}}/api/home?populate[common][fields][0]=*&populate[common][populate][logoImage][fields][0]=name&populate[common][populate][logoImage][fields][1]=mime&populate[common][populate][logoImage][fields][2]=url&populate[header][fields][0]=*&populate[header][populate][button][fields][0]=*&populate[header][populate][button][image][fields][0]=name&populate[header][populate][button][image][fields][1]=mime&populate[header][populate][button][image][fields][2]=url&populate[footer][fields][0]=*&populate[footer][populate][links][fields][0]=*&populate[footer][populate][contactUsEmail][fields][0]=*&populate[footer][populate][contactUsLocation][fields][0]=*&populate[footer][populate][contactUsPhoneNumber][fields][0]=*&populate[subscribeNow][fields][0]=*&populate[blogs][fields][0]=*&populate[blogs][populate][button][fields][0]=*&populate[blogs][populate][posts][fields][0]=name&populate[blogs][populate][posts][fields][1]=id&populate[blogs][populate][posts][fields][2]=header&populate[blogs][populate][posts][fields][3]=documentId&populate[blogs][populate][posts][populate][tags][fields][0]=*&populate[blogs][populate][posts][populate][teaserImage][fields][0]=name&populate[blogs][populate][posts][populate][teaserImage][fields][1]=mime&populate[blogs][populate][posts][populate][teaserImage][fields][2]=url&populate[feedbacks][fields][0]=*&populate[feedbacks][populate][feedbacks][fields][0]=*&populate[feedbacks][populate][feedbacks][populate][customerImage][fields][0]=name&populate[feedbacks][populate][feedbacks][populate][customerImage][fields][1]=mime&populate[feedbacks][populate][feedbacks][populate][customerImage][fields][2]=url&populate[ourServices][fields][0]=*&populate[ourServices][populate][services][fields][0]=*&populate[ourServices][populate][services][populate][image][fields][0]=name&populate[ourServices][populate][services][populate][image][fields][1]=mime&populate[ourServices][populate][services][populate][image][fields][2]=url&populate[aboutUs][fields][0]=*&populate[aboutUs][populate][image][fields][0]=name&populate[aboutUs][populate][image][fields][1]=mime&populate[aboutUs][populate][image][fields][2]=url&populate[contactUs][fields][0]=*&populate[prices][fields][0]=*&populate[prices][populate][prices][fields][0]=*&populate[prices][populate][prices][populate][icon][fields][0]=name&populate[prices][populate][prices][populate][icon][fields][1]=mime&populate[prices][populate][prices][populate][icon][fields][2]=url&populate[prices][populate][prices][populate][image][fields][0]=name&populate[prices][populate][prices][populate][image][fields][1]=mime&populate[prices][populate][prices][populate][image][fields][2]=url&populate[ourSpecialities][fields][0]=*&populate[ourSpecialities][populate][left1][fields][0]=*&populate[ourSpecialities][populate][left2][fields][0]=*&populate[ourSpecialities][populate][left3][fields][0]=*&populate[ourSpecialities][populate][left4][fields][0]=*&populate[ourSpecialities][populate][right1][fields][0]=*&populate[ourSpecialities][populate][right2][fields][0]=*&populate[ourSpecialities][populate][right3][fields][0]=*&populate[ourSpecialities][populate][right4][fields][0]=*
Accept: application/json Accept: application/json

View File

@ -1,5 +1,13 @@
{ {
"populate": { "populate": {
"common": {
"fields": ["*"],
"populate": {
"logoImage": {
"fields": ["name","mime","url"]
}
}
},
"header": { "header": {
"fields": ["*"], "fields": ["*"],
"populate": { "populate": {
@ -7,8 +15,12 @@
"fields": [ "fields": [
"*" "*"
] ]
} },
"image": {
"fields": ["name","mime","url"]
}
} }
}, },
"footer": { "footer": {
"fields": ["*"], "fields": ["*"],

View File

@ -17,6 +17,7 @@ export default async function Home() {
const pageData = await webApi.getHomePage(); const pageData = await webApi.getHomePage();
const { const {
common,
header, header,
ourServices, ourServices,
aboutUs, aboutUs,
@ -28,9 +29,11 @@ export default async function Home() {
footer, footer,
feedbacks feedbacks
} = pageData; } = pageData;
console.info("Home page data", pageData);
return ( return (
<> <>
{ header && <MainHeaderComponent config={header}/> } { header && <MainHeaderComponent config={header} common={common} /> }
{ aboutUs && <AboutUsComponent data={aboutUs} /> } { aboutUs && <AboutUsComponent data={aboutUs} /> }
{ ourServices && <OurServicesComponent config={ourServices}/> } { ourServices && <OurServicesComponent config={ourServices}/> }
{ ourSpecialities && <OurSpecialitiesComponent config={ourSpecialities} /> } { ourSpecialities && <OurSpecialitiesComponent config={ourSpecialities} /> }

View File

@ -4,8 +4,10 @@ import {MAIN_MENU} from "@/util/const";
import Nav from "@/components/nav.component"; import Nav from "@/components/nav.component";
import {StrapiFile} from "@/types/types"; import {StrapiFile} from "@/types/types";
import strapiApi from "@/api/strapi/strapi-api"; import strapiApi from "@/api/strapi/strapi-api";
import { YogaCommon_Plain } from "@/types/generated-strapi-interfaces/api/yoga-common";
export interface Props{ export interface Props{
config: YogaMainHeaderComponent_Plain config: YogaMainHeaderComponent_Plain,
common?: YogaCommon_Plain
} }
const MainHeaderComponent = ({ config: { const MainHeaderComponent = ({ config: {
title, title,
@ -15,15 +17,20 @@ const MainHeaderComponent = ({ config: {
headerIType, headerIType,
image image
}}: Props) => { },common}: Props) => {
const imageFile: StrapiFile = image as StrapiFile; const imageFile: StrapiFile = image as StrapiFile;
const imageSrc = imageFile ? strapiApi.getImageUrl(imageFile?.url): undefined; const imageSrc = imageFile ? strapiApi.getImageUrl(imageFile?.url): undefined;
const logoImageFile: StrapiFile = (common?.logoImage) as StrapiFile;
const logoImageSrc = logoImageFile ? strapiApi.getImageUrl(logoImageFile.url) : undefined;
console.info("MainHeaderComponent imageSrc",image, imageSrc);
// console.info("MainHeaderComponent logoImgSrc",image, logoImageSrc);
return ( return (
<div className="banner-section-outer"> <div className="banner-section-outer">
<header> <header>
<Nav menuItems={MAIN_MENU} imageSrc={imageSrc} /> <Nav menuItems={MAIN_MENU} imageSrc={logoImageSrc} />
</header> </header>
{/*<!-- SOCIAL ICONS -->*/} {/*<!-- SOCIAL ICONS -->*/}
<div className="social-icons left_icons float-left d-table" data-aos="fade-down"> <div className="social-icons left_icons float-left d-table" data-aos="fade-down">
@ -60,7 +67,7 @@ const MainHeaderComponent = ({ config: {
<div className="col-lg-6 col-md-6 col-sm-12 col-xs-12"> <div className="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div className="banner-section-image"> <div className="banner-section-image">
<figure className="mb-0"> <figure className="mb-0">
<YogaImageComponent src="/assets/images/banner_right_image.png" alt="" /> <YogaImageComponent src={imageSrc!} alt="" />
</figure> </figure>
</div> </div>
</div> </div>

View File

@ -10,6 +10,7 @@ import { YogaBlogPostsComponent } from './yoga-blog-posts-component';
import { YogaSubscribeNowComponent } from './yoga-subscribe-now-component'; import { YogaSubscribeNowComponent } from './yoga-subscribe-now-component';
import { YogaFooter } from './yoga-footer'; import { YogaFooter } from './yoga-footer';
import { YogaMainHeaderComponent } from './yoga-main-header-component'; import { YogaMainHeaderComponent } from './yoga-main-header-component';
import { YogaCommon } from './yoga-common';
import { YogaOurServicesComponent_Plain } from './yoga-our-services-component'; import { YogaOurServicesComponent_Plain } from './yoga-our-services-component';
import { YogaAboutUsComponent_Plain } from './yoga-about-us-component'; import { YogaAboutUsComponent_Plain } from './yoga-about-us-component';
import { YogaSpecialitiesComponent_Plain } from './yoga-specialities-component'; import { YogaSpecialitiesComponent_Plain } from './yoga-specialities-component';
@ -20,6 +21,7 @@ import { YogaBlogPostsComponent_Plain } from './yoga-blog-posts-component';
import { YogaSubscribeNowComponent_Plain } from './yoga-subscribe-now-component'; import { YogaSubscribeNowComponent_Plain } from './yoga-subscribe-now-component';
import { YogaFooter_Plain } from './yoga-footer'; import { YogaFooter_Plain } from './yoga-footer';
import { YogaMainHeaderComponent_Plain } from './yoga-main-header-component'; import { YogaMainHeaderComponent_Plain } from './yoga-main-header-component';
import { YogaCommon_Plain } from './yoga-common';
import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification'; import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification';
export interface Home { export interface Home {
@ -35,6 +37,7 @@ export interface Home {
subscribeNow?: { data: YogaSubscribeNowComponent }; subscribeNow?: { data: YogaSubscribeNowComponent };
footer?: { data: YogaFooter }; footer?: { data: YogaFooter };
header?: { data: YogaMainHeaderComponent }; header?: { data: YogaMainHeaderComponent };
common?: { data: YogaCommon };
locale: string; locale: string;
localizations?: { data: Home[] }; localizations?: { data: Home[] };
}; };
@ -51,6 +54,7 @@ export interface Home_Plain {
subscribeNow?: YogaSubscribeNowComponent_Plain; subscribeNow?: YogaSubscribeNowComponent_Plain;
footer?: YogaFooter_Plain; footer?: YogaFooter_Plain;
header?: YogaMainHeaderComponent_Plain; header?: YogaMainHeaderComponent_Plain;
common?: YogaCommon_Plain;
locale: string; locale: string;
localizations?: Home_Plain[]; localizations?: Home_Plain[];
} }
@ -67,6 +71,7 @@ export interface Home_NoRelations {
subscribeNow?: number; subscribeNow?: number;
footer?: number; footer?: number;
header?: number; header?: number;
common?: number;
locale: string; locale: string;
localizations?: Home[]; localizations?: Home[];
} }
@ -83,6 +88,7 @@ export interface Home_AdminPanelLifeCycle {
subscribeNow?: AdminPanelRelationPropertyModification<YogaSubscribeNowComponent_Plain>; subscribeNow?: AdminPanelRelationPropertyModification<YogaSubscribeNowComponent_Plain>;
footer?: AdminPanelRelationPropertyModification<YogaFooter_Plain>; footer?: AdminPanelRelationPropertyModification<YogaFooter_Plain>;
header?: AdminPanelRelationPropertyModification<YogaMainHeaderComponent_Plain>; header?: AdminPanelRelationPropertyModification<YogaMainHeaderComponent_Plain>;
common?: AdminPanelRelationPropertyModification<YogaCommon_Plain>;
locale: string; locale: string;
localizations?: Home[]; localizations?: Home[];
} }

View File

@ -8,19 +8,23 @@ export interface YogaCommon {
id: number; id: number;
attributes: { attributes: {
createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: { data: Media }; createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: { data: Media };
name: string;
}; };
} }
export interface YogaCommon_Plain { export interface YogaCommon_Plain {
id: number; id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: Media_Plain; createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: Media_Plain;
name: string;
} }
export interface YogaCommon_NoRelations { export interface YogaCommon_NoRelations {
id: number; id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: number; createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: number;
name: string;
} }
export interface YogaCommon_AdminPanelLifeCycle { export interface YogaCommon_AdminPanelLifeCycle {
id: number; id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: AdminPanelRelationPropertyModification<Media_Plain>; createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: AdminPanelRelationPropertyModification<Media_Plain>;
name: string;
} }

View File

@ -10,6 +10,7 @@ import { YogaBlogPostsComponent } from './yoga-blog-posts-component';
import { YogaSubscribeNowComponent } from './yoga-subscribe-now-component'; import { YogaSubscribeNowComponent } from './yoga-subscribe-now-component';
import { YogaFooter } from './yoga-footer'; import { YogaFooter } from './yoga-footer';
import { YogaMainHeaderComponent } from './yoga-main-header-component'; import { YogaMainHeaderComponent } from './yoga-main-header-component';
import { YogaCommon } from './yoga-common';
import { YogaOurServicesComponent_Plain } from './yoga-our-services-component'; import { YogaOurServicesComponent_Plain } from './yoga-our-services-component';
import { YogaAboutUsComponent_Plain } from './yoga-about-us-component'; import { YogaAboutUsComponent_Plain } from './yoga-about-us-component';
import { YogaSpecialitiesComponent_Plain } from './yoga-specialities-component'; import { YogaSpecialitiesComponent_Plain } from './yoga-specialities-component';
@ -20,6 +21,7 @@ import { YogaBlogPostsComponent_Plain } from './yoga-blog-posts-component';
import { YogaSubscribeNowComponent_Plain } from './yoga-subscribe-now-component'; import { YogaSubscribeNowComponent_Plain } from './yoga-subscribe-now-component';
import { YogaFooter_Plain } from './yoga-footer'; import { YogaFooter_Plain } from './yoga-footer';
import { YogaMainHeaderComponent_Plain } from './yoga-main-header-component'; import { YogaMainHeaderComponent_Plain } from './yoga-main-header-component';
import { YogaCommon_Plain } from './yoga-common';
import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification'; import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification';
export interface Home { export interface Home {
@ -35,6 +37,7 @@ export interface Home {
subscribeNow?: { data: YogaSubscribeNowComponent }; subscribeNow?: { data: YogaSubscribeNowComponent };
footer?: { data: YogaFooter }; footer?: { data: YogaFooter };
header?: { data: YogaMainHeaderComponent }; header?: { data: YogaMainHeaderComponent };
common?: { data: YogaCommon };
locale: string; locale: string;
localizations?: { data: Home[] }; localizations?: { data: Home[] };
}; };
@ -51,6 +54,7 @@ export interface Home_Plain {
subscribeNow?: YogaSubscribeNowComponent_Plain; subscribeNow?: YogaSubscribeNowComponent_Plain;
footer?: YogaFooter_Plain; footer?: YogaFooter_Plain;
header?: YogaMainHeaderComponent_Plain; header?: YogaMainHeaderComponent_Plain;
common?: YogaCommon_Plain;
locale: string; locale: string;
localizations?: Home_Plain[]; localizations?: Home_Plain[];
} }
@ -67,6 +71,7 @@ export interface Home_NoRelations {
subscribeNow?: number; subscribeNow?: number;
footer?: number; footer?: number;
header?: number; header?: number;
common?: number;
locale: string; locale: string;
localizations?: Home[]; localizations?: Home[];
} }
@ -83,6 +88,7 @@ export interface Home_AdminPanelLifeCycle {
subscribeNow?: AdminPanelRelationPropertyModification<YogaSubscribeNowComponent_Plain>; subscribeNow?: AdminPanelRelationPropertyModification<YogaSubscribeNowComponent_Plain>;
footer?: AdminPanelRelationPropertyModification<YogaFooter_Plain>; footer?: AdminPanelRelationPropertyModification<YogaFooter_Plain>;
header?: AdminPanelRelationPropertyModification<YogaMainHeaderComponent_Plain>; header?: AdminPanelRelationPropertyModification<YogaMainHeaderComponent_Plain>;
common?: AdminPanelRelationPropertyModification<YogaCommon_Plain>;
locale: string; locale: string;
localizations?: Home[]; localizations?: Home[];
} }

View File

@ -65,6 +65,11 @@
"type": "relation", "type": "relation",
"relation": "oneToOne", "relation": "oneToOne",
"target": "api::yoga-main-header-component.yoga-main-header-component" "target": "api::yoga-main-header-component.yoga-main-header-component"
},
"common": {
"type": "relation",
"relation": "oneToOne",
"target": "api::yoga-common.yoga-common"
} }
} }
} }

View File

@ -710,6 +710,10 @@ export interface ApiHomeHome extends Struct.SingleTypeSchema {
'oneToOne', 'oneToOne',
'api::yoga-blog-posts-component.yoga-blog-posts-component' 'api::yoga-blog-posts-component.yoga-blog-posts-component'
>; >;
common: Schema.Attribute.Relation<
'oneToOne',
'api::yoga-common.yoga-common'
>;
contactUs: Schema.Attribute.Relation< contactUs: Schema.Attribute.Relation<
'oneToOne', 'oneToOne',
'api::yoga-contact-us.yoga-contact-us' 'api::yoga-contact-us.yoga-contact-us'