home and about page
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import React from "react";
|
||||
import AosComponent from "@/components/aos.component";
|
||||
import OurServicesComponent from "@/components/our.services.component";
|
||||
import AboutUsComponent from "@/components/about.us.component";
|
||||
import OurSpecialitiesComponent from "@/components/our.specialities.component";
|
||||
import ContactUsComponent from "@/components/contact.us.component";
|
||||
import PricingComponent from "@/components/pricing.component";
|
||||
@@ -11,35 +10,46 @@ import FooterComponent from "@/components/footer.component";
|
||||
import SubscribeComponent from "@/components/subscribe.component";
|
||||
import SubHeaderComponent from "@/components/subHeader.component";
|
||||
import BootstrapComponent from "@/components/bootstrap.component";
|
||||
import webApi from "@/app/api/web-client/web-api";
|
||||
import webApi from "@/api/web-client/web-api";
|
||||
import AboutUsWithBoxesComponent from "@/components/about.us.with.boxes.component";
|
||||
import YogaDiscountComponent from "@/components/yogaDiscountComponent";
|
||||
import TextWithImageComponent from "@/components/text.with.image.component";
|
||||
import AchievementsComponent from "@/components/achievements.component";
|
||||
|
||||
export default async function About() {
|
||||
const pageData = await webApi.getAboutPage();
|
||||
|
||||
const {header,
|
||||
ourServices,
|
||||
aboutUs,
|
||||
contactUs,
|
||||
ourSpecialities,
|
||||
prices,
|
||||
discount,
|
||||
ourMission,
|
||||
ourVision,
|
||||
achievements,
|
||||
|
||||
blogs,
|
||||
subscribeNow,
|
||||
footer,
|
||||
feedbacks
|
||||
} = pageData;
|
||||
|
||||
|
||||
console.info("about us", JSON.stringify(aboutUs))
|
||||
return (
|
||||
<>
|
||||
{ header && <SubHeaderComponent header1={header?.header1} header2={header?.header2} description={header?.description}/> }
|
||||
{ ourServices && <OurServicesComponent title={ourServices?.title!} header={ourServices?.header!} description={ourServices?.description!} /> }
|
||||
{ aboutUs && <AboutUsComponent data={aboutUs}/>}
|
||||
{ ourSpecialities && <OurSpecialitiesComponent config={ourSpecialities} /> }
|
||||
{ contactUs && <ContactUsComponent contactUs={contactUs}/>}
|
||||
{ prices && <PricingComponent config={prices} /> }
|
||||
{ feedbacks && <FeedbackComponent config={feedbacks} /> }
|
||||
|
||||
{ aboutUs && <AboutUsWithBoxesComponent config={aboutUs}/>}
|
||||
{ discount && <YogaDiscountComponent config={discount}/>}
|
||||
{ ourMission && <TextWithImageComponent config={ourMission} />}
|
||||
{ ourVision && <TextWithImageComponent config={ourVision} />}
|
||||
{ achievements && <AchievementsComponent config={achievements}/>}
|
||||
|
||||
{/*{ ourServices && <OurServicesComponent title={ourServices?.title!} header={ourServices?.header!} description={ourServices?.description!} /> }*/}
|
||||
{/*{ ourSpecialities && <OurSpecialitiesComponent config={ourSpecialities} /> }*/}
|
||||
{/*{ contactUs && <ContactUsComponent contactUs={contactUs}/>}*/}
|
||||
{/*{ prices && <PricingComponent config={prices} /> }*/}
|
||||
{/*{ feedbacks && <FeedbackComponent config={feedbacks} /> }*/}
|
||||
{ blogs && <BlogPostsComponent config={blogs} />}
|
||||
{subscribeNow && <SubscribeComponent config={subscribeNow} /> }
|
||||
{ subscribeNow && <SubscribeComponent config={subscribeNow} /> }
|
||||
{ footer && <FooterComponent config={footer} />}
|
||||
<AosComponent />
|
||||
<BootstrapComponent />
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
|
||||
class HttpClient{
|
||||
|
||||
public async httpGet(url: string):Promise<Response>{
|
||||
const response = await fetch(url,{
|
||||
headers: {
|
||||
'Content-type': 'application-json'
|
||||
}
|
||||
});
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
const client: HttpClient = new HttpClient();
|
||||
|
||||
export default client;
|
||||
@@ -1,128 +0,0 @@
|
||||
{
|
||||
"populate": {
|
||||
"header": {
|
||||
"fields": ["header1","description"]
|
||||
},
|
||||
"footer": {
|
||||
"fields": ["*"],
|
||||
"populate": {
|
||||
"links": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"contactUsEmail": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"contactUsLocation": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"contactUsPhoneNumber": {
|
||||
"fields": ["*"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"subscribeNow": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"blogs": {
|
||||
"fields": ["*"],
|
||||
"populate": {
|
||||
"button": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"posts": {
|
||||
"fields": ["name", "id", "header","documentId" ],
|
||||
"populate": {
|
||||
"tags": {
|
||||
"fields": ["*" ]
|
||||
},
|
||||
"teaserImage": {
|
||||
"fields": ["name","mime","url"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"feedbacks": {
|
||||
"fields": ["*"],
|
||||
"populate": {
|
||||
"feedbacks": {
|
||||
"fields": ["*"],
|
||||
"populate": {
|
||||
"customerImage": {
|
||||
"fields": ["name","mime","url"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ourServices": {
|
||||
"fields": ["*"],
|
||||
"populate": {
|
||||
"services": {
|
||||
"fields": ["*"],
|
||||
"populate": {
|
||||
"image": {
|
||||
"fields": ["name","mime","url"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"aboutUs": {
|
||||
"fields": ["*"],
|
||||
"populate": {
|
||||
"image": {
|
||||
"fields": ["name","mime","url"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"contactUs": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"prices": {
|
||||
"fields": ["*"],
|
||||
"populate": {
|
||||
"prices": {
|
||||
"fields": ["*"],
|
||||
"populate": {
|
||||
"icon": {
|
||||
"fields": ["name","mime","url"]
|
||||
},
|
||||
"image": {
|
||||
"fields": ["name","mime","url"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ourSpecialities": {
|
||||
"fields": ["*"] ,
|
||||
"populate": {
|
||||
"left1": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"left2": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"left3": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"left4": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"right1": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"right2": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"right3": {
|
||||
"fields": ["*"]
|
||||
},
|
||||
"right4": {
|
||||
"fields": ["*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
import {About_Plain} from "@/types/generated-strapi-interfaces/api/about";
|
||||
import strapiClient from "@/app/api/strapi/strapi-client";
|
||||
import {StrapiQuery} from "@/app/api/strapi/strapi-query";
|
||||
import qs from "qs";
|
||||
import aboutQuery from "@/app/api/strapi/query/about.json";
|
||||
import {YogaBlogPost_Plain} from "@/types/generated-strapi-interfaces/api/yoga-blog-post";
|
||||
|
||||
|
||||
class StrapiApi{
|
||||
constructor( ) {
|
||||
}
|
||||
|
||||
protected async getJson<T>(path: string, params?: object){
|
||||
const query = params ? qs.stringify(params,{ arrayFormat: 'indices' , encode: false}) : "";
|
||||
const payload = await strapiClient.httpGetJson<T>(
|
||||
path+ query
|
||||
);
|
||||
return payload?.data;
|
||||
}
|
||||
|
||||
public getImageUrl(imagePath: string){
|
||||
return strapiClient.getImageUrl(imagePath);
|
||||
}
|
||||
public async getAboutPage(): Promise<About_Plain>{
|
||||
return this.getJson("/api/about?",aboutQuery);
|
||||
}
|
||||
|
||||
public getHomePage(){
|
||||
return this.getJson("/api/home?",aboutQuery);
|
||||
|
||||
}
|
||||
|
||||
public getBlog(blogId: string): Promise<YogaBlogPost_Plain>{
|
||||
return this.getJson("/api/yoga-blog-posts/"+blogId,undefined);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const api = new StrapiApi();
|
||||
export default api;
|
||||
@@ -1,43 +0,0 @@
|
||||
import httpClient from "@/app/api/http-client";
|
||||
import {Payload} from "@/types/generated-strapi-interfaces/common/Payload";
|
||||
|
||||
const STRAPI_URL = process.env.STRAPI_URL;
|
||||
|
||||
class StrapiClient{
|
||||
|
||||
constructor(private strapiUrl: string = "http://localhost:1337") {
|
||||
}
|
||||
public getImageUrl(imagePath: string){
|
||||
return this.strapiUrl + imagePath;
|
||||
}
|
||||
public async httpGet(path: string){
|
||||
return await httpClient.httpGet(this.strapiUrl + path);
|
||||
}
|
||||
public async httpGetJson<T>(url: string): Promise<Payload<T>>{
|
||||
const response = await this.httpGet(url);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
public async findContentType<T>(contentType: string,options?: FindContentOptions): Promise<Payload<T>>{
|
||||
const searchParams = new URLSearchParams();
|
||||
if ( options?.populateAll ){
|
||||
searchParams.append("populate","*");
|
||||
}
|
||||
if (options?.localeAll){
|
||||
searchParams.append("_locale","all");
|
||||
}
|
||||
|
||||
|
||||
|
||||
const response = await this.httpGet("/api/"+contentType+"?"+searchParams.toString());
|
||||
return await response.json();
|
||||
}
|
||||
}
|
||||
|
||||
export interface FindContentOptions{
|
||||
populateAll?: boolean;
|
||||
localeAll?: boolean;
|
||||
}
|
||||
|
||||
const client = new StrapiClient(STRAPI_URL);
|
||||
export default client;
|
||||
@@ -1,3 +0,0 @@
|
||||
export const StrapiQuery = {
|
||||
aboutUrl: "/api/about?populate[header][fields][0]=header1&populate[header][fields][1]=description&populate[ourServices][fields][0]=*&populate[aboutUs][fields][0]=*&populate[ourSpecialities][fields][0]=*&populate[ourSpecialities][populate][specialityLeft1][fields][0]=*&populate[ourSpecialities][populate][specialityLeft2][fields][0]=*&populate[ourSpecialities][populate][specialityLeft3][fields][0]=*&populate[ourSpecialities][populate][specialityLeft4][fields][0]=*&populate[ourSpecialities][populate][specialityRight1][fields][0]=*&populate[ourSpecialities][populate][specialityRight2][fields][0]=*&populate[ourSpecialities][populate][specialityRight3][fields][0]=*&populate[ourSpecialities][populate][specialityRight4][fields][0]=*"
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
export interface HomePageData{
|
||||
|
||||
}
|
||||
|
||||
|
||||
export interface OurServiceData{
|
||||
|
||||
}
|
||||
|
||||
export interface AboutUsData{
|
||||
|
||||
}
|
||||
|
||||
export interface OurSpecialitiesData{
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
import {About_Plain} from '@/types/generated-strapi-interfaces/api/about';
|
||||
import strapiApi from "@/app/api/strapi/strapi-api";
|
||||
|
||||
|
||||
class WebApi {
|
||||
|
||||
public getHomePage(){
|
||||
|
||||
}
|
||||
|
||||
public async getAboutPage(): Promise<About_Plain> {
|
||||
return await strapiApi.getAboutPage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const client = new WebApi();
|
||||
|
||||
export default client;
|
||||
@@ -1,4 +1,4 @@
|
||||
import strapiApi from "@/app/api/strapi/strapi-api";
|
||||
import strapiApi from "@/api/strapi/strapi-api";
|
||||
import clsx from "clsx";
|
||||
|
||||
export default async function BlogComponent({
|
||||
|
||||
@@ -12,23 +12,40 @@ import SubscribeComponent from "@/components/subscribe.component";
|
||||
import MainHeaderComponent from "@/components/mainHeaderComponent";
|
||||
import BootstrapComponent from "@/components/bootstrap.component";
|
||||
import ITypedComponent from "@/components/ityped.component";
|
||||
import webApi from "@/api/web-client/web-api";
|
||||
|
||||
export default function Home() {
|
||||
export default async function Home() {
|
||||
const pageData = await webApi.getHomePage();
|
||||
|
||||
console.info(JSON.stringify(pageData))
|
||||
|
||||
const {
|
||||
header,
|
||||
ourServices,
|
||||
aboutUs,
|
||||
contactUs,
|
||||
ourSpecialities,
|
||||
prices,
|
||||
blogs,
|
||||
subscribeNow,
|
||||
footer,
|
||||
feedbacks
|
||||
} = pageData;
|
||||
return (
|
||||
<>
|
||||
<MainHeaderComponent/>
|
||||
<OurServicesComponent />
|
||||
<AboutUsComponent />
|
||||
<OurSpecialitiesComponent />
|
||||
<ContactUsComponent />
|
||||
<PricingComponent />
|
||||
<FeedbackComponent />
|
||||
<BlogPostsComponent />
|
||||
<SubscribeComponent />
|
||||
<FooterComponent />
|
||||
{ header && <MainHeaderComponent config={header}/> }
|
||||
{ ourServices && <OurServicesComponent header={ourServices.header!} description={ourServices.description!} title={ourServices.title!}/> }
|
||||
{ aboutUs && <AboutUsComponent data={aboutUs} /> }
|
||||
{ ourSpecialities && <OurSpecialitiesComponent config={ourSpecialities} /> }
|
||||
{ contactUs && <ContactUsComponent contactUs={contactUs} /> }
|
||||
{ prices && <PricingComponent config={prices}/> }
|
||||
{ feedbacks && <FeedbackComponent config={feedbacks} /> }
|
||||
{ blogs && <BlogPostsComponent config={blogs} /> }
|
||||
{ subscribeNow && <SubscribeComponent config={subscribeNow} /> }
|
||||
{ footer && <FooterComponent config={footer} /> }
|
||||
<AosComponent />
|
||||
<BootstrapComponent />
|
||||
<ITypedComponent />
|
||||
{header?.headerIType && <ITypedComponent text={header.headerIType} /> }
|
||||
</>
|
||||
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { invoices, customers, revenue, users } from './placeholder-data';
|
||||
|
||||
import strapiApi from "@/app/api/strapi/strapi-api";
|
||||
import strapiApi from "@/api/strapi/strapi-api";
|
||||
|
||||
// const client = await connectionPool.connect();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user