build improvements

This commit is contained in:
Schneider Roland
2025-02-23 14:57:49 +01:00
parent 4d239f7c7a
commit 5c3fe39074
50 changed files with 1672 additions and 212 deletions

View File

@@ -1,6 +1,5 @@
import YogaImageComponent from "@/components/yoga.image.component";
import {
YogaAboutUsComponent,
YogaAboutUsComponent_Plain
} from "@/types/generated-strapi-interfaces/api/yoga-about-us-component";
import {StrapiFile} from "@/types/types";

View File

@@ -7,7 +7,7 @@ export interface Props{
config: YogaAboutUsWithBoxesComponent_Plain
}
export default function AboutUsWithBoxesComponent({ config: {title,header,description,image, box1,box2,box3,box4}}: Props){
export default function AboutUsWithBoxesComponent({ config: {title,header,description, box1,box2,box3,box4}}: Props){
return (

View File

@@ -8,7 +8,7 @@ export interface Props{
}
export default function AchievementsItemComponent({achievement
:{ image,title}
:{ image}
}: Props){
const imageFile: StrapiFile = image as StrapiFile;

View File

@@ -1,5 +1,4 @@
import YogaImageComponent from "@/components/yoga.image.component";
import {YogaBlogPostsComponent_Plain} from "@/types/generated-strapi-interfaces/api/yoga-blog-posts-component";
import {YogaBlogPost_Plain} from "@/types/generated-strapi-interfaces/api/yoga-blog-post";
import {StrapiFile} from "@/types/types";
import strapiApi from "@/api/strapi/strapi-api";

View File

@@ -4,7 +4,7 @@ import { useEffect } from "react";
export default function BootstrapComponent()
{
useEffect(()=>{
// @ts-ignore
// @ts-expect-error promise
import( "bootstrap/dist/js/bootstrap.bundle")
},[])
return <></>

View File

@@ -1,12 +1,9 @@
'use client'
import React, { ReactNode } from 'react'
import React from 'react'
import {usePathname, useRouter} from 'next/navigation'
import Link from 'next/link'
import {usePathname} from 'next/navigation'
type Props = {
}
const pathToBreadCrumbs = (path: string) => {
const mapping: Record<string, string> = {
@@ -34,13 +31,13 @@ const NextBreadcrumb = () => {
<div className="btn_wrapper">
<span className="sub_home_span">{pathToBreadCrumbs( "/" )} </span>
{
pathNames.map((value,index) => {
pathNames.map((value) => {
return (
<>
<React.Fragment key={value}>
<i className="fa-solid fa-angles-right" aria-hidden="true"></i>
<span className="sub_span">{pathToBreadCrumbs( value )}</span>
</>
</React.Fragment>
)
})
}

View File

@@ -1,10 +1,43 @@
'use client'
import YogaImageComponent from "@/components/yoga.image.component";
import {YogaContactUs_Plain} from "@/types/generated-strapi-interfaces/api/yoga-contact-us";
import {RefObject, startTransition, useActionState, useEffect, useRef} from "react";
import {ContactFormState, sendContactUsMail} from "@/actions/contactus-actions";
import clsx from "clsx";
export interface Props{
export interface Props {
contactUs: YogaContactUs_Plain
}
const ContactUsComponent = ( { contactUs :{ header,firstName,lastName,phone,title,message,email,buttonText }}: Props) => {
const ContactUsComponent = ({
contactUs: {
header,
firstName,
lastName,
phone,
title,
message,
email,
buttonText
}
}: Props) => {
const initialState = () => {
return {
firstname: {value: ''},
lastname: {value: ''},
comment: {value: ''},
email: {value: ''},
phone: {value: ''}
} as ContactFormState;
}
const [state, formAction] = useActionState(sendContactUsMail, initialState());
const ref: RefObject<HTMLFormElement|null> = useRef(null)
useEffect(() => {
if ( state.formState == 'success'){
ref.current?.reset()
}
}, [state]);
return (
<section className="get_in_touch_section">
<div className="container">
@@ -13,39 +46,67 @@ const ContactUsComponent = ( { contactUs :{ header,firstName,lastName,phone,ti
<div className="get_in_touch_content">
<h5>{title}</h5>
<h2>{header}</h2>
<form>
<form
ref={ref}
onSubmit={(e) => {
e.preventDefault();
startTransition(() => formAction(new FormData(e.currentTarget)));
}}
>
<div className="row">
<div className="col-lg-6 col-md-6 col-sm-6">
<div className="form-group mb-0">
<input type="text" name="fname" id="fname" className="form-control"
placeholder={firstName}/>
<input type="text" name="firstname" id="firstname"
className={clsx("form-control", {"mb-0": state.firstname.error})}
placeholder={firstName}
/>
</div>
{state.firstname.error &&
<div className="text-danger mb-3">{state.firstname.error}</div>}
</div>
<div className="col-lg-6 col-md-6 col-sm-6">
<div className="form-group mb-0">
<input type="text" name="lname" id="lname"
className="form-control form_style" placeholder={lastName}/>
<input type="text" name="lastname" id="lname"
className={clsx("form-control", "form_style", {"mb-0": state.lastname.error})}
placeholder={lastName}/>
</div>
{state.lastname.error &&
<div className="text-danger mb-3">{state.lastname.error}</div>}
</div>
<div className="col-lg-6 col-md-6 col-sm-6">
<div className="form-group mb-0">
<input type="tel" name="phonenum" id="phonenum" className="form-control"
<input type="tel" name="phone" id="phonenum"
className={clsx("form-control", {"mb-0": state.phone.error})}
placeholder={phone}/>
</div>
{state.phone.error &&
<div className="text-danger mb-3">{state.phone.error}</div>}
</div>
<div className="col-lg-6 col-md-6 col-sm-6">
<div className="form-group mb-0">
<input type="email" name="emailaddrs" id="emailaddrs"
className="form-control form_style" placeholder={email}/>
<input type="email" name="email" id="emailaddrs"
className={clsx("form-control", "form_style", {"mb-0": state.email.error})}
placeholder={email}/>
</div>
{state.email.error &&
<div className="text-danger mb-3">{state.email.error}</div>}
</div>
</div>
<div className="row">
<div className="col-lg-12">
<div className=" form-group mb-0">
<textarea rows={3} name="comment" id="msg" className="form-control"
<textarea rows={3} name="comment" id="msg"
className={clsx("form-control", {"mb-0": state.comment.error})}
placeholder={message}></textarea>
</div>
{state.comment.error &&
<div className="text-danger mb-3">{state.comment.error}</div>}
</div>
</div>
<div className="btn_wrapper">
@@ -61,7 +122,7 @@ const ContactUsComponent = ( { contactUs :{ header,firstName,lastName,phone,ti
href="https://previews.customer.envatousercontent.com/6720474d-ddc3-4b86-acf1-8d093cb37b6d/watermarked_preview/watermarked_preview.mp4">
<figure className="video_img mb-0">
<YogaImageComponent className="thumb img-fluid" style={{"cursor": "pointer"}}
src="/assets/images/get_in_touch_video_icon.png" alt=""/>
src="/assets/images/get_in_touch_video_icon.png" alt=""/>
</figure>
</a>
</div>

View File

@@ -2,7 +2,6 @@
import {YogaFaqComponent_Plain} from "@/types/generated-strapi-interfaces/api/yoga-faq-component";
import {useState} from "react";
import FaqQaComponent from "@/components/faq.qa.component";
import { MouseEvent } from 'react'
export interface Props {
@@ -53,6 +52,7 @@ export default function FaqComponent({
questionsAndAnswers.map((qa, index) => {
return (
<FaqQaComponent
key={qa.id}
qa={qa}
id={index}
onClick={onQAClick}

View File

@@ -2,27 +2,18 @@ import YogaImageComponent from "@/components/yoga.image.component";
import {YogaFaqQa_Plain} from "@/types/generated-strapi-interfaces/api/yoga-faq-qa";
import clsx from "clsx";
import classes from "./faq.qa.module.scss";
import {useEffect, useState} from "react";
export interface Props{
id: number,
qa: YogaFaqQa_Plain,
isOpen: boolean,
onClick: (id: number) => void
}
export default function FaqQaComponent({id,qa,isOpen,onClick}: Props){
export default function FaqQaComponent({id,qa,isOpen}: Props){
return (
<div className="accordion-card">
<div className="card-header" id={"heading" + id}>
<a href="#"
// onClick={ (event) => {
// 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}>

View File

@@ -1,5 +1,4 @@
import {
YogaGoogleMapsComponent,
YogaGoogleMapsComponent_Plain
} from "@/types/generated-strapi-interfaces/api/yoga-google-maps-component";

View File

@@ -20,7 +20,7 @@ const ITypedComponent = ( {text}: Props ) => {
loop: true
})
setReady(true)
}, [ready]);
}, [ready,text]);
return (<></> );
}

View File

@@ -6,10 +6,8 @@ export interface Props{
const MainHeaderComponent = ({ config: {
title,
header,
headerIType,
description,
button,
image
}}: Props) => {

View File

@@ -2,7 +2,6 @@
import {FC} from "react";
import YogaImageComponent from "@/components/yoga.image.component";
import clsx from "clsx";
import exp from "node:constants";
export interface MenuItem{
href?: string;

View File

@@ -1,7 +1,4 @@
import YogaImageComponent from "@/components/yoga.image.component";
import {
OurSpecialitiesComponent_Plain
} from "@/types/generated-strapi-interfaces/components/yoga-site/OurSpecialitiesComponent";
import OurSpecialitiesItemComponent from "@/components/our.specialities.item.component";
import {YogaSpecialitiesComponent_Plain} from "@/types/generated-strapi-interfaces/api/yoga-specialities-component";

View File

@@ -1,7 +1,3 @@
import YogaImageComponent from "@/components/yoga.image.component";
import {
OurSpecialitiesComponent_Plain
} from "@/types/generated-strapi-interfaces/components/yoga-site/OurSpecialitiesComponent";
import {TitleDescription_Plain} from "@/types/generated-strapi-interfaces/components/shared/TitleDescription";
import clsx from "clsx";

View File

@@ -1,4 +1,3 @@
import YogaImageComponent from "@/components/yoga.image.component";
import {YogaPriceComponent_Plain} from "@/types/generated-strapi-interfaces/api/yoga-price-component";
import {PriceItemComponent} from "@/components/price.item.component";

View File

@@ -5,10 +5,9 @@ import {HeaderB} from "@/types/generated-strapi-interfaces/components/yoga-site/
import NextBreadcrumb from "@/components/breadcrumbs.component";
export interface Props extends HeaderB{
}
export type Props = HeaderB ;
const SubHeaderComponent = ({header1,header2,description}: Props) =>{
const SubHeaderComponent = ({header1,description}: Props) =>{
return (
<div className="sub-banner-section">
<Nav menuItems={MAIN_MENU} />

View File

@@ -5,7 +5,7 @@ import {
import clsx from "clsx";
export interface Props{
config: YogaSubscribeNowComponent_Plain,
styleClass: string
styleClass?: string
}
const SubscribeComponent = ({
config: {title,header,placeHolderEmail,buttonSubscribeLabel},

View File

@@ -11,6 +11,7 @@ export interface Properties {
const YogaImageComponent = ( {src,alt,className,style}: Properties ) => {
return (
/* eslint-disable @next/next/no-img-element */
<img src={src} alt={alt || ""} className={ clsx( className )} style={style} />
);
}