From 71f697c88f28b42d253928e6000fd610ab53ddca Mon Sep 17 00:00:00 2001 From: Schneider Roland Date: Tue, 4 Feb 2025 22:13:39 +0100 Subject: [PATCH] add concatct page --- api.http | 2 +- yoga-app/src/api/strapi/query/contact.json | 31 ++++++++ yoga-app/src/api/strapi/strapi-api.ts | 5 ++ yoga-app/src/app/contact/page.tsx | 36 +++++++++ yoga-app/src/app/faq/page.tsx | 2 + .../src/components/breadcrumbs.component.tsx | 1 + yoga-app/src/components/faq.qa.component.tsx | 10 ++- .../src/components/google.maps.component.tsx | 26 +++++++ yoga-app/src/components/nav.component.tsx | 5 +- .../src/components/subscribe.component.tsx | 11 ++- yoga-app/src/util/const.ts | 8 +- yoga-cms/types/generated/contentTypes.d.ts | 78 +++++++++++++++++++ 12 files changed, 203 insertions(+), 12 deletions(-) create mode 100644 yoga-app/src/api/strapi/query/contact.json create mode 100644 yoga-app/src/app/contact/page.tsx create mode 100644 yoga-app/src/components/google.maps.component.tsx diff --git a/api.http b/api.http index 1a1fc63..449cad0 100644 --- a/api.http +++ b/api.http @@ -13,7 +13,7 @@ Accept: application/json #Authorization: Bearer {{token}} ### GET request with a header -GET {{domain}}/api/prices-page?fields[0]=*&populate[price][fields][0]=*&populate[price][populate][prices][fields][0]=*&populate[price][populate][prices][populate][icon][fields][0]=name&populate[price][populate][prices][populate][icon][fields][1]=mime&populate[price][populate][prices][populate][icon][fields][2]=url&populate[price][populate][prices][populate][image][fields][0]=name&populate[price][populate][prices][populate][image][fields][1]=mime&populate[price][populate][prices][populate][image][fields][2]=url&populate[discount][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[subscribeNow][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/contact-page?fields[0]=*&populate[contactUs][fields][0]=*&populate[google_maps][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[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]=* Accept: application/json #Authorization: Bearer {{token}} diff --git a/yoga-app/src/api/strapi/query/contact.json b/yoga-app/src/api/strapi/query/contact.json new file mode 100644 index 0000000..56996a5 --- /dev/null +++ b/yoga-app/src/api/strapi/query/contact.json @@ -0,0 +1,31 @@ +{ + "fields": ["*"], + "populate": { + "contactUs": { + "fields": ["*"] + }, + "google_maps": { + "fields": ["*"] + }, + "subscribe": { + "fields": ["*"] + }, + "footer": { + "fields": ["*"], + "populate": { + "links": { + "fields": ["*"] + }, + "contactUsEmail": { + "fields": ["*"] + }, + "contactUsLocation": { + "fields": ["*"] + }, + "contactUsPhoneNumber": { + "fields": ["*"] + } + } + } + } +} diff --git a/yoga-app/src/api/strapi/strapi-api.ts b/yoga-app/src/api/strapi/strapi-api.ts index a312e27..5aa91b6 100644 --- a/yoga-app/src/api/strapi/strapi-api.ts +++ b/yoga-app/src/api/strapi/strapi-api.ts @@ -6,11 +6,13 @@ import homeQuery from "@/api/strapi/query/home.json"; import servicesQuery from "@/api/strapi/query/services.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"; import {YogaBlogPost_Plain} from "@/types/generated-strapi-interfaces/api/yoga-blog-post"; import {Home_Plain} from "@/types/generated-strapi-interfaces/api/home"; import {ServicesPage_Plain} from "@/types/generated-strapi-interfaces/api/services-page"; import {PricesPage_Plain} from "@/types/generated-strapi-interfaces/api/prices-page"; import {FaqPage_Plain} from "@/types/generated-strapi-interfaces/api/faq-page"; +import {ContactPage_Plain} from "@/types/generated-strapi-interfaces/api/contact-page"; class StrapiApi{ @@ -47,6 +49,9 @@ class StrapiApi{ public getFaqPage(): Promise{ return this.getJson("/api/faq-page?",faqQuery); } + public getContactPage(): Promise{ + return this.getJson("/api/contact-page?",contactQuery); + } public getBlog(blogId: string): Promise{ diff --git a/yoga-app/src/app/contact/page.tsx b/yoga-app/src/app/contact/page.tsx new file mode 100644 index 0000000..66fed80 --- /dev/null +++ b/yoga-app/src/app/contact/page.tsx @@ -0,0 +1,36 @@ +import strapiApi from "@/api/strapi/strapi-api"; +import SubHeaderComponent from "@/components/subHeader.component"; +import FaqComponent from "@/components/faq.component"; +import BlogPostsComponent from "@/components/blog.posts.component"; +import SubscribeComponent from "@/components/subscribe.component"; +import FooterComponent from "@/components/footer.component"; +import AosComponent from "@/components/aos.component"; +import BootstrapComponent from "@/components/bootstrap.component"; +import React from "react"; +import ContactUsComponent from "@/components/contact.us.component"; +import GoogleMapsComponent from "@/components/google.maps.component"; + +export default async function ContactPage(){ + + const { + header, + description, + contactUs, + google_maps, + subscribe, + footer + } = await strapiApi.getContactPage(); + return ( + <> + { } + { contactUs && } + { google_maps && } + { subscribe && } + { footer && } + + + + + ); + +} diff --git a/yoga-app/src/app/faq/page.tsx b/yoga-app/src/app/faq/page.tsx index b2d15ef..e4e4aa6 100644 --- a/yoga-app/src/app/faq/page.tsx +++ b/yoga-app/src/app/faq/page.tsx @@ -12,6 +12,7 @@ import SubscribeComponent from "@/components/subscribe.component"; import strapiApi from "@/api/strapi/strapi-api"; import SubHeaderComponent from "@/components/subHeader.component"; import FaqComponent from "@/components/faq.component"; +import BootstrapComponent from "@/components/bootstrap.component"; export default async function About() { const { @@ -30,6 +31,7 @@ export default async function About() { { subscribe && } { footer && } + ); diff --git a/yoga-app/src/components/breadcrumbs.component.tsx b/yoga-app/src/components/breadcrumbs.component.tsx index 8cc68b0..d9e69e5 100644 --- a/yoga-app/src/components/breadcrumbs.component.tsx +++ b/yoga-app/src/components/breadcrumbs.component.tsx @@ -14,6 +14,7 @@ const pathToBreadCrumbs = (path: string) => { 'about' : 'Rólam', 'services' : 'Szolgáltatásaim', 'prices' : 'Áraim', + 'faq' : 'GYIK', } if ( mapping.hasOwnProperty(path)){ return mapping[path]; diff --git a/yoga-app/src/components/faq.qa.component.tsx b/yoga-app/src/components/faq.qa.component.tsx index e13ac69..d96c389 100644 --- a/yoga-app/src/components/faq.qa.component.tsx +++ b/yoga-app/src/components/faq.qa.component.tsx @@ -18,10 +18,12 @@ export default function FaqQaComponent({id,qa,isOpen,onClick}: Props){ return (
- { - event.preventDefault(); - onClick(id) - }} className={clsx("btn", "btn-link", {"collapsed": !isOpen})} + { + // event.preventDefault(); + // onClick(id) + // }} + className={clsx("btn", "btn-link", {"collapsed": !isOpen})} data-toggle="collapse" data-target={"#collapse" + id} aria-expanded="false" aria-controls={"collapse" + id}>
{qa.question}
diff --git a/yoga-app/src/components/google.maps.component.tsx b/yoga-app/src/components/google.maps.component.tsx new file mode 100644 index 0000000..ff81802 --- /dev/null +++ b/yoga-app/src/components/google.maps.component.tsx @@ -0,0 +1,26 @@ +import { + YogaGoogleMapsComponent, + YogaGoogleMapsComponent_Plain +} from "@/types/generated-strapi-interfaces/api/yoga-google-maps-component"; + +export interface Props{ + config: YogaGoogleMapsComponent_Plain +} + +export default function GoogleMapsComponent({config}: Props){ + + if(!config?.google_maps_url){ + return null; + } + + return ( +
+
+
+
+
+
+ ); +} diff --git a/yoga-app/src/components/nav.component.tsx b/yoga-app/src/components/nav.component.tsx index 6e6e5e4..870651b 100644 --- a/yoga-app/src/components/nav.component.tsx +++ b/yoga-app/src/components/nav.component.tsx @@ -8,7 +8,8 @@ export interface MenuItem{ href?: string; label: string; children?: MenuItem[]; - active?: boolean + active?: boolean, + styleClass?: string; } export interface Props{ menuItems: MenuItem[]; @@ -58,7 +59,7 @@ const MenuItemComponent: FC = ({menuItem, dropdownItem}: MenuIte return ( //
  • - {menuItem.label} + {menuItem.label}
  • ); } diff --git a/yoga-app/src/components/subscribe.component.tsx b/yoga-app/src/components/subscribe.component.tsx index 335e5ee..454e4d5 100644 --- a/yoga-app/src/components/subscribe.component.tsx +++ b/yoga-app/src/components/subscribe.component.tsx @@ -2,12 +2,17 @@ import YogaImageComponent from "@/components/yoga.image.component"; import { YogaSubscribeNowComponent_Plain } from "@/types/generated-strapi-interfaces/api/yoga-subscribe-now-component"; +import clsx from "clsx"; export interface Props{ - config: YogaSubscribeNowComponent_Plain + config: YogaSubscribeNowComponent_Plain, + styleClass: string } -const SubscribeComponent = ({config: {title,header,placeHolderEmail,buttonSubscribeLabel}}: Props) => { +const SubscribeComponent = ({ + config: {title,header,placeHolderEmail,buttonSubscribeLabel}, + styleClass +}: Props) => { return ( -
    +
    diff --git a/yoga-app/src/util/const.ts b/yoga-app/src/util/const.ts index 2e1265c..5927c18 100644 --- a/yoga-app/src/util/const.ts +++ b/yoga-app/src/util/const.ts @@ -27,11 +27,15 @@ export const MAIN_MENU:MenuItem[] = [ ] }, { - label: 'Team', + label: 'Rólam', href: '/team' }, { label: 'Blog', - href: '/' + href: '/blog' + }, { + label: 'Kapcsolat', + href: '/contact', + styleClass: "contact_us" }, ]; diff --git a/yoga-cms/types/generated/contentTypes.d.ts b/yoga-cms/types/generated/contentTypes.d.ts index 6a8192b..9690893 100644 --- a/yoga-cms/types/generated/contentTypes.d.ts +++ b/yoga-cms/types/generated/contentTypes.d.ts @@ -540,6 +540,52 @@ export interface ApiCategoryCategory extends Struct.CollectionTypeSchema { }; } +export interface ApiContactPageContactPage extends Struct.SingleTypeSchema { + collectionName: 'contact_pages'; + info: { + description: ''; + displayName: 'ContactPage'; + pluralName: 'contact-pages'; + singularName: 'contact-page'; + }; + options: { + draftAndPublish: true; + }; + attributes: { + contactUs: Schema.Attribute.Relation< + 'oneToOne', + 'api::yoga-contact-us.yoga-contact-us' + >; + createdAt: Schema.Attribute.DateTime; + createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & + Schema.Attribute.Private; + description: Schema.Attribute.Text; + footer: Schema.Attribute.Relation< + 'oneToOne', + 'api::yoga-footer.yoga-footer' + >; + google_maps: Schema.Attribute.Relation< + 'oneToOne', + 'api::yoga-google-maps-component.yoga-google-maps-component' + >; + header: Schema.Attribute.String; + locale: Schema.Attribute.String & Schema.Attribute.Private; + localizations: Schema.Attribute.Relation< + 'oneToMany', + 'api::contact-page.contact-page' + > & + Schema.Attribute.Private; + publishedAt: Schema.Attribute.DateTime; + subscribe: Schema.Attribute.Relation< + 'oneToOne', + 'api::yoga-subscribe-now-component.yoga-subscribe-now-component' + >; + updatedAt: Schema.Attribute.DateTime; + updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & + Schema.Attribute.Private; + }; +} + export interface ApiFaqPageFaqPage extends Struct.SingleTypeSchema { collectionName: 'faq_pages'; info: { @@ -1407,6 +1453,36 @@ export interface ApiYogaFooterYogaFooter extends Struct.CollectionTypeSchema { }; } +export interface ApiYogaGoogleMapsComponentYogaGoogleMapsComponent + extends Struct.CollectionTypeSchema { + collectionName: 'yoga_google_maps_components'; + info: { + displayName: 'YogaGoogleMapsComponent'; + pluralName: 'yoga-google-maps-components'; + singularName: 'yoga-google-maps-component'; + }; + options: { + draftAndPublish: true; + }; + attributes: { + createdAt: Schema.Attribute.DateTime; + createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & + Schema.Attribute.Private; + google_maps_url: Schema.Attribute.Text; + locale: Schema.Attribute.String & Schema.Attribute.Private; + localizations: Schema.Attribute.Relation< + 'oneToMany', + 'api::yoga-google-maps-component.yoga-google-maps-component' + > & + Schema.Attribute.Private; + name: Schema.Attribute.String; + publishedAt: Schema.Attribute.DateTime; + updatedAt: Schema.Attribute.DateTime; + updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & + Schema.Attribute.Private; + }; +} + export interface ApiYogaMainHeaderComponentYogaMainHeaderComponent extends Struct.CollectionTypeSchema { collectionName: 'yoga_main_header_components'; @@ -2413,6 +2489,7 @@ declare module '@strapi/strapi' { 'api::article.article': ApiArticleArticle; 'api::author.author': ApiAuthorAuthor; 'api::category.category': ApiCategoryCategory; + 'api::contact-page.contact-page': ApiContactPageContactPage; 'api::faq-page.faq-page': ApiFaqPageFaqPage; 'api::global.global': ApiGlobalGlobal; 'api::home.home': ApiHomeHome; @@ -2433,6 +2510,7 @@ declare module '@strapi/strapi' { 'api::yoga-faq-component.yoga-faq-component': ApiYogaFaqComponentYogaFaqComponent; 'api::yoga-faq-qa.yoga-faq-qa': ApiYogaFaqQaYogaFaqQa; 'api::yoga-footer.yoga-footer': ApiYogaFooterYogaFooter; + 'api::yoga-google-maps-component.yoga-google-maps-component': ApiYogaGoogleMapsComponentYogaGoogleMapsComponent; 'api::yoga-main-header-component.yoga-main-header-component': ApiYogaMainHeaderComponentYogaMainHeaderComponent; 'api::yoga-our-services-component.yoga-our-services-component': ApiYogaOurServicesComponentYogaOurServicesComponent; 'api::yoga-price-component.yoga-price-component': ApiYogaPriceComponentYogaPriceComponent;