[yoga-12] add common section to home API and update related components for logo image
This commit is contained in:
parent
7133e43464
commit
1a7c5c5247
2
api.http
2
api.http
@ -29,7 +29,7 @@ GET {{domain}}/api/yoga-single-services?filters[name][$eq]=service4
|
||||
Accept: application/json
|
||||
|
||||
### 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
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
{
|
||||
"populate": {
|
||||
"common": {
|
||||
"fields": ["*"],
|
||||
"populate": {
|
||||
"logoImage": {
|
||||
"fields": ["name","mime","url"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"header": {
|
||||
"fields": ["*"],
|
||||
"populate": {
|
||||
@ -7,8 +15,12 @@
|
||||
"fields": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
"image": {
|
||||
"fields": ["name","mime","url"]
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
"footer": {
|
||||
"fields": ["*"],
|
||||
|
||||
@ -17,6 +17,7 @@ export default async function Home() {
|
||||
const pageData = await webApi.getHomePage();
|
||||
|
||||
const {
|
||||
common,
|
||||
header,
|
||||
ourServices,
|
||||
aboutUs,
|
||||
@ -28,9 +29,11 @@ export default async function Home() {
|
||||
footer,
|
||||
feedbacks
|
||||
} = pageData;
|
||||
|
||||
console.info("Home page data", pageData);
|
||||
return (
|
||||
<>
|
||||
{ header && <MainHeaderComponent config={header}/> }
|
||||
{ header && <MainHeaderComponent config={header} common={common} /> }
|
||||
{ aboutUs && <AboutUsComponent data={aboutUs} /> }
|
||||
{ ourServices && <OurServicesComponent config={ourServices}/> }
|
||||
{ ourSpecialities && <OurSpecialitiesComponent config={ourSpecialities} /> }
|
||||
|
||||
@ -4,8 +4,10 @@ import {MAIN_MENU} from "@/util/const";
|
||||
import Nav from "@/components/nav.component";
|
||||
import {StrapiFile} from "@/types/types";
|
||||
import strapiApi from "@/api/strapi/strapi-api";
|
||||
import { YogaCommon_Plain } from "@/types/generated-strapi-interfaces/api/yoga-common";
|
||||
export interface Props{
|
||||
config: YogaMainHeaderComponent_Plain
|
||||
config: YogaMainHeaderComponent_Plain,
|
||||
common?: YogaCommon_Plain
|
||||
}
|
||||
const MainHeaderComponent = ({ config: {
|
||||
title,
|
||||
@ -15,15 +17,20 @@ const MainHeaderComponent = ({ config: {
|
||||
headerIType,
|
||||
image
|
||||
|
||||
}}: Props) => {
|
||||
},common}: Props) => {
|
||||
|
||||
const imageFile: StrapiFile = image as StrapiFile;
|
||||
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 (
|
||||
<div className="banner-section-outer">
|
||||
<header>
|
||||
<Nav menuItems={MAIN_MENU} imageSrc={imageSrc} />
|
||||
<Nav menuItems={MAIN_MENU} imageSrc={logoImageSrc} />
|
||||
</header>
|
||||
{/*<!-- SOCIAL ICONS -->*/}
|
||||
<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="banner-section-image">
|
||||
<figure className="mb-0">
|
||||
<YogaImageComponent src="/assets/images/banner_right_image.png" alt="" />
|
||||
<YogaImageComponent src={imageSrc!} alt="" />
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -10,6 +10,7 @@ import { YogaBlogPostsComponent } from './yoga-blog-posts-component';
|
||||
import { YogaSubscribeNowComponent } from './yoga-subscribe-now-component';
|
||||
import { YogaFooter } from './yoga-footer';
|
||||
import { YogaMainHeaderComponent } from './yoga-main-header-component';
|
||||
import { YogaCommon } from './yoga-common';
|
||||
import { YogaOurServicesComponent_Plain } from './yoga-our-services-component';
|
||||
import { YogaAboutUsComponent_Plain } from './yoga-about-us-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 { YogaFooter_Plain } from './yoga-footer';
|
||||
import { YogaMainHeaderComponent_Plain } from './yoga-main-header-component';
|
||||
import { YogaCommon_Plain } from './yoga-common';
|
||||
import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification';
|
||||
|
||||
export interface Home {
|
||||
@ -35,6 +37,7 @@ export interface Home {
|
||||
subscribeNow?: { data: YogaSubscribeNowComponent };
|
||||
footer?: { data: YogaFooter };
|
||||
header?: { data: YogaMainHeaderComponent };
|
||||
common?: { data: YogaCommon };
|
||||
locale: string;
|
||||
localizations?: { data: Home[] };
|
||||
};
|
||||
@ -51,6 +54,7 @@ export interface Home_Plain {
|
||||
subscribeNow?: YogaSubscribeNowComponent_Plain;
|
||||
footer?: YogaFooter_Plain;
|
||||
header?: YogaMainHeaderComponent_Plain;
|
||||
common?: YogaCommon_Plain;
|
||||
locale: string;
|
||||
localizations?: Home_Plain[];
|
||||
}
|
||||
@ -67,6 +71,7 @@ export interface Home_NoRelations {
|
||||
subscribeNow?: number;
|
||||
footer?: number;
|
||||
header?: number;
|
||||
common?: number;
|
||||
locale: string;
|
||||
localizations?: Home[];
|
||||
}
|
||||
@ -83,6 +88,7 @@ export interface Home_AdminPanelLifeCycle {
|
||||
subscribeNow?: AdminPanelRelationPropertyModification<YogaSubscribeNowComponent_Plain>;
|
||||
footer?: AdminPanelRelationPropertyModification<YogaFooter_Plain>;
|
||||
header?: AdminPanelRelationPropertyModification<YogaMainHeaderComponent_Plain>;
|
||||
common?: AdminPanelRelationPropertyModification<YogaCommon_Plain>;
|
||||
locale: string;
|
||||
localizations?: Home[];
|
||||
}
|
||||
|
||||
@ -8,19 +8,23 @@ export interface YogaCommon {
|
||||
id: number;
|
||||
attributes: {
|
||||
createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: { data: Media };
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
export interface YogaCommon_Plain {
|
||||
id: number;
|
||||
createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: Media_Plain;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface YogaCommon_NoRelations {
|
||||
id: number;
|
||||
createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface YogaCommon_AdminPanelLifeCycle {
|
||||
id: number;
|
||||
createdAt: Date; updatedAt: Date; publishedAt?: Date; logoImage?: AdminPanelRelationPropertyModification<Media_Plain>;
|
||||
name: string;
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import { YogaBlogPostsComponent } from './yoga-blog-posts-component';
|
||||
import { YogaSubscribeNowComponent } from './yoga-subscribe-now-component';
|
||||
import { YogaFooter } from './yoga-footer';
|
||||
import { YogaMainHeaderComponent } from './yoga-main-header-component';
|
||||
import { YogaCommon } from './yoga-common';
|
||||
import { YogaOurServicesComponent_Plain } from './yoga-our-services-component';
|
||||
import { YogaAboutUsComponent_Plain } from './yoga-about-us-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 { YogaFooter_Plain } from './yoga-footer';
|
||||
import { YogaMainHeaderComponent_Plain } from './yoga-main-header-component';
|
||||
import { YogaCommon_Plain } from './yoga-common';
|
||||
import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification';
|
||||
|
||||
export interface Home {
|
||||
@ -35,6 +37,7 @@ export interface Home {
|
||||
subscribeNow?: { data: YogaSubscribeNowComponent };
|
||||
footer?: { data: YogaFooter };
|
||||
header?: { data: YogaMainHeaderComponent };
|
||||
common?: { data: YogaCommon };
|
||||
locale: string;
|
||||
localizations?: { data: Home[] };
|
||||
};
|
||||
@ -51,6 +54,7 @@ export interface Home_Plain {
|
||||
subscribeNow?: YogaSubscribeNowComponent_Plain;
|
||||
footer?: YogaFooter_Plain;
|
||||
header?: YogaMainHeaderComponent_Plain;
|
||||
common?: YogaCommon_Plain;
|
||||
locale: string;
|
||||
localizations?: Home_Plain[];
|
||||
}
|
||||
@ -67,6 +71,7 @@ export interface Home_NoRelations {
|
||||
subscribeNow?: number;
|
||||
footer?: number;
|
||||
header?: number;
|
||||
common?: number;
|
||||
locale: string;
|
||||
localizations?: Home[];
|
||||
}
|
||||
@ -83,6 +88,7 @@ export interface Home_AdminPanelLifeCycle {
|
||||
subscribeNow?: AdminPanelRelationPropertyModification<YogaSubscribeNowComponent_Plain>;
|
||||
footer?: AdminPanelRelationPropertyModification<YogaFooter_Plain>;
|
||||
header?: AdminPanelRelationPropertyModification<YogaMainHeaderComponent_Plain>;
|
||||
common?: AdminPanelRelationPropertyModification<YogaCommon_Plain>;
|
||||
locale: string;
|
||||
localizations?: Home[];
|
||||
}
|
||||
|
||||
@ -65,6 +65,11 @@
|
||||
"type": "relation",
|
||||
"relation": "oneToOne",
|
||||
"target": "api::yoga-main-header-component.yoga-main-header-component"
|
||||
},
|
||||
"common": {
|
||||
"type": "relation",
|
||||
"relation": "oneToOne",
|
||||
"target": "api::yoga-common.yoga-common"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
yoga-cms/types/generated/contentTypes.d.ts
vendored
4
yoga-cms/types/generated/contentTypes.d.ts
vendored
@ -710,6 +710,10 @@ export interface ApiHomeHome extends Struct.SingleTypeSchema {
|
||||
'oneToOne',
|
||||
'api::yoga-blog-posts-component.yoga-blog-posts-component'
|
||||
>;
|
||||
common: Schema.Attribute.Relation<
|
||||
'oneToOne',
|
||||
'api::yoga-common.yoga-common'
|
||||
>;
|
||||
contactUs: Schema.Attribute.Relation<
|
||||
'oneToOne',
|
||||
'api::yoga-contact-us.yoga-contact-us'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user