Updated the whole website to work according to the CMS

This commit is contained in:
Tiago Ribeiro
2024-03-19 01:02:07 +00:00
parent 91ee920b42
commit 5ee1364afb
36 changed files with 617 additions and 648 deletions

View File

@@ -1,5 +1,9 @@
import {getData} from "@/cms";
import About from "@/templates/About"; import About from "@/templates/About";
import AboutPage from "@/types/cms/about";
export default function Page() { export default async function Page() {
return <About language="en" />; const {data} = await getData<AboutPage>("about", "en");
return <About data={data.data.attributes} language="en" />;
} }

View File

@@ -1,5 +1,9 @@
import {getData} from "@/cms";
import About from "@/templates/About"; import About from "@/templates/About";
import AboutPage from "@/types/cms/about";
export default function Page() { export default async function Page() {
return <About language="ar" />; const {data} = await getData<AboutPage>("about", "ar");
return <About data={data.data.attributes} language="ar" />;
} }

View File

@@ -1,5 +1,9 @@
import {getData} from "@/cms";
import ContactUs from "@/templates/ContactUs"; import ContactUs from "@/templates/ContactUs";
import ContactPage from "@/types/cms/contact";
export default function Page() { export default async function Page() {
return <ContactUs page="/contact" language="ar" />; const {data} = await getData<ContactPage>("contact", "ar");
return <ContactUs data={data.data.attributes} page="/contact" language="ar" />;
} }

View File

@@ -1,19 +1,21 @@
import { AgentContacts, generateStaticParamsHelper} from "@/templates/AgentContacts"; import {getData} from "@/cms";
import {AgentContacts, generateStaticParamsHelper} from "@/templates/AgentContacts";
import CountryManagerContactsPage from "@/types/cms/countryManagerContacts";
interface PageProps { interface PageProps {
params: { params: {
country: string; country: string;
}; };
} }
const language = "ar"; const language = "ar";
export async function generateStaticParams() { export async function generateStaticParams() {
return generateStaticParamsHelper(language); return generateStaticParamsHelper(language);
} }
export default async function Page({ export default async function Page({params: {country}}: PageProps) {
params: { country }, const {data} = await getData<CountryManagerContactsPage>("country-managers-contact", language);
}: PageProps) {
return <AgentContacts country={country} page={`/contacts/${country}`} language={language} />; return <AgentContacts data={data.data.attributes} country={country} page={`/contacts/${country}`} language={language} />;
} }

View File

@@ -1,7 +1,9 @@
import About from "@/templates/About"; import {getData} from "@/cms";
import ComingSoon from "@/templates/ComingSoon";
import History from "@/templates/History"; import History from "@/templates/History";
import HistoryPage from "@/types/cms/history";
export default function Page() { export default async function Page() {
return <History language="ar" />; const {data} = await getData<HistoryPage>("history", "ar");
return <History data={data.data.attributes} language="ar" />;
} }

View File

@@ -1,6 +1,10 @@
import {getData} from "@/cms";
import Home from "@/templates/Home"; import Home from "@/templates/Home";
import HomePage from "@/types/cms/home";
import {NextPageContext} from "next"; import {NextPageContext} from "next";
export default function Page() { export default async function Page() {
return <Home language="ar" />; const {data} = await getData<HomePage>("home", "ar");
return <Home data={data.data.attributes} language="ar" />;
} }

View File

@@ -1,5 +1,9 @@
import {getData} from "@/cms";
import Price from "@/templates/Price"; import Price from "@/templates/Price";
import PricePage from "@/types/cms/price";
export default function Page() { export default async function Page() {
return <Price language="ar" />; const {data} = await getData<PricePage>("price", "ar");
return <Price data={data.data.attributes} language="ar" />;
} }

View File

@@ -1,6 +1,10 @@
import {getData} from "@/cms";
import Privacy from "@/templates/Privacy"; import Privacy from "@/templates/Privacy";
import Terms from "@/templates/Terms"; import Terms from "@/templates/Terms";
import PrivacyPolicyPage from "@/types/cms/privacyPolicy";
export default function Page() { export default async function Page() {
return <Privacy language="ar" />; const {data} = await getData<PrivacyPolicyPage>("privacy-policy", "ar");
return <Privacy data={data.data.attributes} language="ar" />;
} }

View File

@@ -1,5 +1,9 @@
import {getData} from "@/cms";
import Services from "@/templates/Services"; import Services from "@/templates/Services";
import ServicesPage from "@/types/cms/services";
export default function Page() { export default async function Page() {
return <Services language="ar" />; const {data} = await getData<ServicesPage>("services", "ar");
return <Services data={data.data.attributes} language="ar" />;
} }

View File

@@ -1,5 +1,9 @@
import {getData} from "@/cms";
import Terms from "@/templates/Terms"; import Terms from "@/templates/Terms";
import TermsAndConditionsPage from "@/types/cms/termsConditions";
export default function Page() { export default async function Page() {
return <Terms language="ar" />; const {data} = await getData<TermsAndConditionsPage>("terms-and-conditions", "ar");
return <Terms data={data.data.attributes} language="ar" />;
} }

View File

@@ -1,5 +1,9 @@
import {getData} from "@/cms";
import ContactUs from "@/templates/ContactUs"; import ContactUs from "@/templates/ContactUs";
import ContactPage from "@/types/cms/contact";
export default function Page() { export default async function Page() {
return <ContactUs page="/contact" language="en" />; const {data} = await getData<ContactPage>("contact", "en");
return <ContactUs data={data.data.attributes} page="/contact" language="en" />;
} }

View File

@@ -1,26 +1,21 @@
import { import {getData} from "@/cms";
AgentContacts, import {AgentContacts, generateStaticParamsHelper} from "@/templates/AgentContacts";
generateStaticParamsHelper, import CountryManagerContactsPage from "@/types/cms/countryManagerContacts";
} from "@/templates/AgentContacts";
interface PageProps { interface PageProps {
params: { params: {
country: string; country: string;
}; };
} }
const language = "en"; const language = "en";
export async function generateStaticParams() { export async function generateStaticParams() {
return generateStaticParamsHelper(language); return generateStaticParamsHelper(language);
} }
export default async function Page({ params: { country } }: PageProps) { export default async function Page({params: {country}}: PageProps) {
return ( const {data} = await getData<CountryManagerContactsPage>("country-managers-contact", language);
<AgentContacts
country={country} return <AgentContacts data={data.data.attributes} country={country} page={`/contacts/${country}`} language={language} />;
page={`/contacts/${country}`}
language={language}
/>
);
} }

View File

@@ -1,7 +1,9 @@
import About from "@/templates/About"; import {getData} from "@/cms";
import ComingSoon from "@/templates/ComingSoon";
import History from "@/templates/History"; import History from "@/templates/History";
import HistoryPage from "@/types/cms/history";
export default function Page() { export default async function Page() {
return <History language="en" />; const {data} = await getData<HistoryPage>("history", "en");
return <History data={data.data.attributes} language="en" />;
} }

View File

@@ -1,5 +1,10 @@
import {getData} from "@/cms";
import Home from "@/templates/Home"; import Home from "@/templates/Home";
import HomePage from "@/types/cms/home";
import {NextPageContext} from "next";
export default function Page() { export default async function Page() {
return <Home language="en" />; const {data} = await getData<HomePage>("home", "en");
return <Home data={data.data.attributes} language="en" />;
} }

View File

@@ -1,5 +1,9 @@
import {getData} from "@/cms";
import Price from "@/templates/Price"; import Price from "@/templates/Price";
import PricePage from "@/types/cms/price";
export default function Page() { export default async function Page() {
return <Price language="en" />; const {data} = await getData<PricePage>("price", "en");
return <Price data={data.data.attributes} language="en" />;
} }

View File

@@ -1,6 +1,10 @@
import {getData} from "@/cms";
import Privacy from "@/templates/Privacy"; import Privacy from "@/templates/Privacy";
import Terms from "@/templates/Terms"; import Terms from "@/templates/Terms";
import PrivacyPolicyPage from "@/types/cms/privacyPolicy";
export default function Page() { export default async function Page() {
return <Privacy language="en" />; const {data} = await getData<PrivacyPolicyPage>("privacy-policy", "en");
return <Privacy data={data.data.attributes} language="en" />;
} }

View File

@@ -1,5 +1,9 @@
import {getData} from "@/cms";
import Services from "@/templates/Services"; import Services from "@/templates/Services";
import ServicesPage from "@/types/cms/services";
export default function Page() { export default async function Page() {
return <Services language="en" />; const {data} = await getData<ServicesPage>("services", "en");
return <Services data={data.data.attributes} language="en" />;
} }

View File

@@ -1,5 +1,9 @@
import {getData} from "@/cms";
import Terms from "@/templates/Terms"; import Terms from "@/templates/Terms";
import TermsAndConditionsPage from "@/types/cms/termsConditions";
export default function Page() { export default async function Page() {
return <Terms language="en" />; const {data} = await getData<TermsAndConditionsPage>("terms-and-conditions", "en");
return <Terms data={data.data.attributes} language="en" />;
} }

View File

@@ -3,12 +3,15 @@ import {BiLogoFacebook} from "react-icons/bi";
import {BsInstagram, BsTwitter} from "react-icons/bs"; import {BsInstagram, BsTwitter} from "react-icons/bs";
import translation from "@/translation/footer.json"; import translation from "@/translation/footer.json";
import clsx from "clsx"; import clsx from "clsx";
import FooterSection from "@/types/cms/footer";
interface Props { interface Props {
language: "en" | "ar"; language: "en" | "ar";
data: FooterSection;
} }
interface FooterLinkProps extends Props { interface FooterLinkProps {
language: "en" | "ar";
children: string; children: string;
href: string; href: string;
} }
@@ -17,7 +20,7 @@ const FooterLink = ({language, href, children}: FooterLinkProps) => {
return <Link href={`${language === "ar" ? "/ar" : ""}${href}`}>{children}</Link>; return <Link href={`${language === "ar" ? "/ar" : ""}${href}`}>{children}</Link>;
}; };
export default function Footer({language}: Props) { export default function Footer({language, data}: Props) {
return ( return (
<> <>
<section className="bg-mti-gray-seasalt w-full"> <section className="bg-mti-gray-seasalt w-full">
@@ -27,54 +30,54 @@ export default function Footer({language}: Props) {
language === "ar" ? "md:flex-row-reverse" : "md:flex-row", language === "ar" ? "md:flex-row-reverse" : "md:flex-row",
)}> )}>
<div className="flex flex-col gap-4"> <div className="flex flex-col gap-4">
<span className="font-bold text-xl">{translation.navigation.text[language]}</span> <span className="font-bold text-xl">{data.Navigation.Text}</span>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<FooterLink language={language} href={`/about`}> <FooterLink language={language} href={`/about`}>
{translation.navigation.why_us[language]} {data.Navigation.WhyUs}
</FooterLink> </FooterLink>
<FooterLink language={language} href={`/about#capabilities`}> <FooterLink language={language} href={`/about#capabilities`}>
{translation.navigation.capabilities[language]} {data.Navigation.Capabilities}
</FooterLink> </FooterLink>
<FooterLink language={language} href={`/about#expertise`}> <FooterLink language={language} href={`/about#expertise`}>
{translation.navigation.expertise[language]} {data.Navigation.Expertise}
</FooterLink> </FooterLink>
<FooterLink language={language} href="/history"> <FooterLink language={language} href="/history">
{translation.navigation.history[language]} {data.Navigation.History}
</FooterLink> </FooterLink>
<FooterLink language={language} href="/contact"> <FooterLink language={language} href="/contact">
{translation.navigation.contact[language]} {data.Navigation.Contact}
</FooterLink> </FooterLink>
</div> </div>
</div> </div>
<div className="flex flex-col gap-4"> <div className="flex flex-col gap-4">
<span className="font-bold text-xl">{translation.services.text[language]}</span> <span className="font-bold text-xl">{data.Services.Text}</span>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<FooterLink language={language} href="/#benefits"> <FooterLink language={language} href="/#benefits">
{translation.services.encoach_benefits[language]} {data.Services.EnCoachBenefits}
</FooterLink> </FooterLink>
<FooterLink language={language} href="#testimonials"> <FooterLink language={language} href="#testimonials">
{translation.services.student_testimonials[language]} {data.Services.StudentTestimonials}
</FooterLink> </FooterLink>
</div> </div>
</div> </div>
<div className="flex flex-col gap-4"> <div className="flex flex-col gap-4">
<span className="font-bold text-xl">{translation.about.text[language]}</span> <span className="font-bold text-xl">{data.About.Text}</span>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<FooterLink language={language} href="/terms"> <FooterLink language={language} href="/terms">
{translation.about.terms[language]} {data.About.Terms}
</FooterLink> </FooterLink>
<FooterLink language={language} href="/privacy-policy"> <FooterLink language={language} href="/privacy-policy">
{translation.about.privacy_policy[language]} {data.About.PrivacyPolicy}
</FooterLink> </FooterLink>
<FooterLink language={language} href="/about"> <FooterLink language={language} href="/about">
{translation.about.text[language]} {data.About.Text}
</FooterLink> </FooterLink>
</div> </div>
</div> </div>
<div className="flex flex-col gap-4"> <div className="flex flex-col gap-4">
<span className="font-bold text-xl">{translation.get_in_touch.title[language]}</span> <span className="font-bold text-xl">{data.GetInTouch.Title}</span>
<div className="flex flex-col gap-4"> <div className="flex flex-col gap-4">
<span className="max-w-[280px]">{translation.get_in_touch.text[language]}</span> <span className="max-w-[280px]">{data.GetInTouch.Text}</span>
<div className={clsx("flex gap-6 items-center", language === "ar" && "flex-row-reverse justify-start")}> <div className={clsx("flex gap-6 items-center", language === "ar" && "flex-row-reverse justify-start")}>
<Link <Link
href="https://facebook.com" href="https://facebook.com"
@@ -97,9 +100,7 @@ export default function Footer({language}: Props) {
</div> </div>
</section> </section>
<footer className="w-full py-10 bg-mti-rose-light text-white flex items-center justify-center"> <footer className="w-full py-10 bg-mti-rose-light text-white flex items-center justify-center">© {data.Copyright}</footer>
© {translation.copyright[language]}
</footer>
</> </>
); );
} }

View File

@@ -0,0 +1,13 @@
import {getData} from "@/cms";
import Footer from "./Footer";
import FooterSection from "@/types/cms/footer";
interface Props {
language: "en" | "ar";
}
export default async function FooterContainer({language}: Props) {
const {data} = await getData<FooterSection>("footer", language);
return <Footer data={data.data.attributes} language={language} />;
}

View File

@@ -1,303 +0,0 @@
/* eslint-disable @next/next/no-img-element */
"use client";
import Link from "next/link";
import Image from "next/image";
import clsx from "clsx";
import { BsList, BsXLg } from "react-icons/bs";
import { Fragment, useEffect, useState } from "react";
import { Dialog, Menu, Transition } from "@headlessui/react";
import { useRouter } from "next/navigation";
import translation from "@/translation/navbar.json";
import { Contact } from "@/types/contact";
interface Item {
page: string;
key: string;
entries?: {
key: string;
label: string;
}[];
}
async function getCountryManagers(language: "en" | "ar" = "en") {
const res = await fetch(`${process.env.NEXT_PUBLIC_APP_URL}/api/users/agents?language=${language}`);
if(!res.ok) {
throw new Error("Failed to fetch contacts");
}
return res.json();
}
export default function Navbar({
currentPage,
language,
}: {
currentPage: string;
language: "en" | "ar";
}) {
const [contacts, setContacts] = useState([]);
useEffect(() => {
getCountryManagers(language)
.then((contacts) => setContacts(contacts.map((data: Contact) => ({
key: data.key,
label: data.label,
}))))
.catch(console.error);
}, [language]);
const items = [
{ page: "/", key: "home" },
{ page: "/services", key: "services" },
{ page: "/price", key: "price" },
{ page: "/about", key: "about" },
{ page: "/history", key: "history" },
{ page: "/contact", key: "contact" },
{
key: "country_manager",
page: "/contacts",
entries: contacts,
},
] as Item[];
const [isOpen, setIsOpen] = useState(false);
const renderItem = (item: Item, className: string) => {
if (item.entries) {
return (
<div
key={item.key}
className={clsx(
"group relative hover:border-b-mti-purple-light transition duration-300 ease-in-out hover:border-b-2 z-10 cursor-pointer w-fit",
currentPage === item.page && "border-b-mti-purple-light border-b-2"
)}
>
<span className="py-2">
{translation[item.key as keyof typeof translation][language]}
</span>
<ul className="absolute hidden group-hover:block bg-gray-700 text-white rounded shadow-md mt-1">
{item.entries?.map((innerEntry) => (
<li
key={innerEntry.key}
className="px-4 py-2 hover:bg-gray-600 whitespace-nowrap h-12 flex items-center"
>
<Link href={`${language === 'ar' ? '/ar' : ''}${item.page}/${innerEntry.key}`} className="w-full h-full flex items-center">
{innerEntry.label}
</Link>
</li>
))}
</ul>
</div>
);
}
return (
<Link
key={item.key}
href={language === "ar" ? `/${language}${item.page}` : item.page}
className={className}
>
{(translation as any)[item.key][language]}
</Link>
);
};
return (
<>
<header className="-md:hidden w-full items-center justify-between px-11 py-3 shadow-sm md:flex">
<Link href="/">
<Image
src="/logo_title.png"
alt="EnCoach logo"
width={128}
height={128}
/>
</Link>
<div className={clsx("flex w-fit items-center gap-8")}>
{items.map((item) =>
renderItem(
item,
clsx(
"hover:border-b-mti-purple-light transition duration-300 ease-in-out hover:border-b-2",
currentPage === item.page &&
"border-b-mti-purple-light border-b-2"
)
)
)}
</div>
<div className="flex w-fit items-center gap-4">
<Link
href="https://platform.encoach.com"
className="hover:bg-mti-purple-dark border-mti-purple-dark rounded-xl border px-8 py-2 transition duration-300 ease-in-out hover:text-white"
>
{translation.platform[language]}
</Link>
<Link
href="https://platform.encoach.com/register"
className="hover:bg-mti-purple-dark hover:border-mti-purple-dark border-mti-purple-light bg-mti-purple-light rounded-xl border px-8 py-2 text-white transition duration-300 ease-in-out"
>
{translation.join[language]}
</Link>
{language === "ar" ? (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`${currentPage}`}
>
EN
</Link>
) : (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`/ar${currentPage}`}
>
AR
</Link>
)}
</div>
</header>
<Transition appear show={isOpen} as={Fragment}>
<Dialog
as="div"
className="relative z-10"
onClose={() => setIsOpen(false)}
>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-25" />
</Transition.Child>
<div className="fixed inset-0 overflow-y-auto">
<div className="flex min-h-full items-center justify-center text-center">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<Dialog.Panel className="flex h-screen w-full transform flex-col gap-8 overflow-hidden bg-white text-left align-middle text-black shadow-xl transition-all">
<Dialog.Title
as="header"
className="-md:flex w-full items-center justify-between px-8 py-2 shadow-sm md:hidden"
>
<Link href="/">
<Image
src="/logo_title.png"
alt="EnCoach logo"
width={128}
height={128}
/>
</Link>
<div className="flex items-center gap-4">
{language === "ar" ? (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`${currentPage}`}
>
EN
</Link>
) : (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`/ar${currentPage}`}
>
AR
</Link>
)}
<div
className="cursor-pointer"
onClick={() => setIsOpen(false)}
tabIndex={0}
>
<BsXLg
className="text-mti-purple-light text-2xl"
onClick={() => setIsOpen(false)}
/>
</div>
</div>
</Dialog.Title>
<div
className={clsx(
"flex flex-col gap-6 px-8 text-lg",
language === "ar" && "items-end"
)}
>
{items.map((item) =>
renderItem(
item,
clsx(
"w-fit transition duration-300 ease-in-out",
currentPage === item.page &&
"text-mti-purple-light border-b-mti-purple-light border-b-2 font-semibold "
)
)
)}
<Link
href="https://platform.encoach.com/register"
className="w-fit transition duration-300 ease-in-out"
>
{translation.join[language]}
</Link>
<Link
href="https://platform.encoach.com"
className={clsx(
"w-fit transition duration-300 ease-in-out"
)}
>
{translation.platform[language]}
</Link>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition>
<header className="-md:flex w-full items-center justify-between px-8 py-2 md:hidden">
<Link href="/">
<Image
src="/logo_title.png"
alt="EnCoach logo"
width={69}
height={69}
/>
</Link>
<div className="flex items-center gap-4">
{language === "ar" ? (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`${currentPage}`}
>
EN
</Link>
) : (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`/ar${currentPage}`}
>
AR
</Link>
)}
<div className="cursor-pointer" onClick={() => setIsOpen(true)}>
<BsList className="text-2xl" onClick={() => setIsOpen(true)} />
</div>
</div>
</header>
</>
);
}

View File

@@ -0,0 +1,243 @@
/* eslint-disable @next/next/no-img-element */
"use client";
import Link from "next/link";
import Image from "next/image";
import clsx from "clsx";
import {BsList, BsXLg} from "react-icons/bs";
import {Fragment, useEffect, useState} from "react";
import {Dialog, Menu, Transition} from "@headlessui/react";
import {useRouter} from "next/navigation";
import translation from "@/translation/navbar.json";
import {Contact} from "@/types/contact";
import NavBarSection from "@/types/cms/navbar";
interface Item {
page: string;
key: string;
entries?: {
key: string;
label: string;
}[];
}
interface Props {
currentPage: string;
language: "en" | "ar";
data: NavBarSection;
}
async function getCountryManagers(language: "en" | "ar" = "en") {
const res = await fetch(`${process.env.NEXT_PUBLIC_APP_URL}/api/users/agents?language=${language}`);
if (!res.ok) {
throw new Error("Failed to fetch contacts");
}
return res.json();
}
export default function Navbar({currentPage, language, data}: Props) {
const [contacts, setContacts] = useState([]);
useEffect(() => {
getCountryManagers(language)
.then((contacts) =>
setContacts(
contacts.map((data: Contact) => ({
key: data.key,
label: data.label,
})),
),
)
.catch(console.error);
}, [language]);
const items = [
{page: "/", key: "Home"},
{page: "/services", key: "Services"},
{page: "/price", key: "Price"},
{page: "/about", key: "About"},
{page: "/history", key: "History"},
{page: "/contact", key: "Contact"},
{
key: "CountryManager",
page: "/contacts",
entries: contacts,
},
] as Item[];
const [isOpen, setIsOpen] = useState(false);
const renderItem = (item: Item, className: string) => {
if (item.entries) {
return (
<div
key={item.key}
className={clsx(
"group relative hover:border-b-mti-purple-light transition duration-300 ease-in-out hover:border-b-2 z-10 cursor-pointer w-fit",
currentPage === item.page && "border-b-mti-purple-light border-b-2",
)}>
<span className="py-2">{data[item.key as keyof typeof data]}</span>
<ul className="absolute hidden group-hover:block bg-gray-700 text-white rounded shadow-md mt-1">
{item.entries?.map((innerEntry) => (
<li key={innerEntry.key} className="px-4 py-2 hover:bg-gray-600 whitespace-nowrap h-12 flex items-center">
<Link
href={`${language === "ar" ? "/ar" : ""}${item.page}/${innerEntry.key}`}
className="w-full h-full flex items-center">
{innerEntry.label}
</Link>
</li>
))}
</ul>
</div>
);
}
return (
<Link key={item.key} href={language === "ar" ? `/${language}${item.page}` : item.page} className={className}>
{data[item.key as keyof typeof data]}
</Link>
);
};
return (
<>
<header className="-md:hidden w-full items-center justify-between px-11 py-3 shadow-sm md:flex">
<Link href="/">
<Image src="/logo_title.png" alt="EnCoach logo" width={128} height={128} />
</Link>
<div className={clsx("flex w-fit items-center gap-8")}>
{items.map((item) =>
renderItem(
item,
clsx(
"hover:border-b-mti-purple-light transition duration-300 ease-in-out hover:border-b-2",
currentPage === item.page && "border-b-mti-purple-light border-b-2",
),
),
)}
</div>
<div className="flex w-fit items-center gap-4">
<Link
href="https://platform.encoach.com"
className="hover:bg-mti-purple-dark border-mti-purple-dark rounded-xl border px-8 py-2 transition duration-300 ease-in-out hover:text-white">
{data.Platform}
</Link>
<Link
href="https://platform.encoach.com/register"
className="hover:bg-mti-purple-dark hover:border-mti-purple-dark border-mti-purple-light bg-mti-purple-light rounded-xl border px-8 py-2 text-white transition duration-300 ease-in-out">
{data.Join}
</Link>
{language === "ar" ? (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`${currentPage}`}>
EN
</Link>
) : (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`/ar${currentPage}`}>
AR
</Link>
)}
</div>
</header>
<Transition appear show={isOpen} as={Fragment}>
<Dialog as="div" className="relative z-10" onClose={() => setIsOpen(false)}>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0">
<div className="fixed inset-0 bg-black bg-opacity-25" />
</Transition.Child>
<div className="fixed inset-0 overflow-y-auto">
<div className="flex min-h-full items-center justify-center text-center">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95">
<Dialog.Panel className="flex h-screen w-full transform flex-col gap-8 overflow-hidden bg-white text-left align-middle text-black shadow-xl transition-all">
<Dialog.Title as="header" className="-md:flex w-full items-center justify-between px-8 py-2 shadow-sm md:hidden">
<Link href="/">
<Image src="/logo_title.png" alt="EnCoach logo" width={128} height={128} />
</Link>
<div className="flex items-center gap-4">
{language === "ar" ? (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`${currentPage}`}>
EN
</Link>
) : (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`/ar${currentPage}`}>
AR
</Link>
)}
<div className="cursor-pointer" onClick={() => setIsOpen(false)} tabIndex={0}>
<BsXLg className="text-mti-purple-light text-2xl" onClick={() => setIsOpen(false)} />
</div>
</div>
</Dialog.Title>
<div className={clsx("flex flex-col gap-6 px-8 text-lg", language === "ar" && "items-end")}>
{items.map((item) =>
renderItem(
item,
clsx(
"w-fit transition duration-300 ease-in-out",
currentPage === item.page &&
"text-mti-purple-light border-b-mti-purple-light border-b-2 font-semibold ",
),
),
)}
<Link href="https://platform.encoach.com/register" className="w-fit transition duration-300 ease-in-out">
{data.Join}
</Link>
<Link href="https://platform.encoach.com" className={clsx("w-fit transition duration-300 ease-in-out")}>
{data.Platform}
</Link>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition>
<header className="-md:flex w-full items-center justify-between px-8 py-2 md:hidden">
<Link href="/">
<Image src="/logo_title.png" alt="EnCoach logo" width={69} height={69} />
</Link>
<div className="flex items-center gap-4">
{language === "ar" ? (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`${currentPage}`}>
EN
</Link>
) : (
<Link
className="text-mti-purple-light hover:text-mti-purple-dark transition duration-300 ease-in-out"
href={`/ar${currentPage}`}>
AR
</Link>
)}
<div className="cursor-pointer" onClick={() => setIsOpen(true)}>
<BsList className="text-2xl" onClick={() => setIsOpen(true)} />
</div>
</div>
</header>
</>
);
}

View File

@@ -0,0 +1,14 @@
import {getData} from "@/cms";
import Navbar from "./Navbar";
import NavBarSection from "@/types/cms/navbar";
interface Props {
currentPage: string;
language: "en" | "ar";
}
export default async function NavbarContainer({currentPage, language}: Props) {
const {data} = await getData<NavBarSection>("nav-bar", language);
return <Navbar data={data.data.attributes} language={language} currentPage={currentPage} />;
}

View File

@@ -4,6 +4,7 @@ import Navbar from "@/components/Navbar";
import Tag from "@/components/Tag"; import Tag from "@/components/Tag";
import Title from "@/components/Title"; import Title from "@/components/Title";
import translation from "@/translation/about.json"; import translation from "@/translation/about.json";
import AboutPage from "@/types/cms/about";
import clsx from "clsx"; import clsx from "clsx";
import React from "react"; import React from "react";
import {BiSolidBrain, BiWorld} from "react-icons/bi"; import {BiSolidBrain, BiWorld} from "react-icons/bi";
@@ -26,26 +27,27 @@ import {
interface Props { interface Props {
language: "en" | "ar"; language: "en" | "ar";
data: AboutPage;
} }
export default function About({language}: Props) { export default function About({language, data}: Props) {
return ( return (
<main className="h-screen w-full bg-white text-mti-black flex flex-col" dir={language === "ar" ? "rtl" : "ltr"}> <main className="h-screen w-full bg-white text-mti-black flex flex-col" dir={language === "ar" ? "rtl" : "ltr"}>
<Navbar currentPage="/about" language={language} /> <Navbar currentPage="/about" language={language} />
<section className="w-full h-full bg-mti-purple text-white text-center p-8 md:p-16"> <section className="w-full h-full bg-mti-purple text-white text-center p-8 md:p-16">
<div className="w-full h-full flex flex-col items-center justify-center"> <div className="w-full h-full flex flex-col items-center justify-center">
<Tag>{translation.title.tag[language]}</Tag> <Tag>{data.TagTitle.Tag}</Tag>
<Title>{translation.title.text[language]}</Title> <Title>{data.TagTitle.Title}</Title>
</div> </div>
</section> </section>
{/* About Us Section */} {/* About Us Section */}
<section id="about" className="w-full bg-white"> <section id="about" className="w-full bg-white">
<div className="w-full flex flex-col items-center gap-8 p-8 md:p-20 container mx-auto"> <div className="w-full flex flex-col items-center gap-8 p-8 md:p-20 container mx-auto">
<Title>{translation.about.title[language]}</Title> <Title>{data.AboutSection.Title}</Title>
<span> <span>
{translation.about.text[language].split("\n").map((line, index) => ( {data.AboutSection.Text.split("\n").map((line, index) => (
<React.Fragment key={index}> <React.Fragment key={index}>
<p className={clsx(language === "ar" ? "text-right" : "text-left")}>{line}</p> <p className={clsx(language === "ar" ? "text-right" : "text-left")}>{line}</p>
<br /> <br />
@@ -62,20 +64,20 @@ export default function About({language}: Props) {
<div className="bg-mti-rose-ultralight border border-mti-rose-light p-6 rounded-3xl flex items-center justify-center w-fit h-fit"> <div className="bg-mti-rose-ultralight border border-mti-rose-light p-6 rounded-3xl flex items-center justify-center w-fit h-fit">
<BsEyeFill className="text-mti-rose-light w-10 h-10" /> <BsEyeFill className="text-mti-rose-light w-10 h-10" />
</div> </div>
<span className="text-lg">{translation.mission_vision_values.vision[language]}</span> <span className="text-lg">{data.MissionVisionValuesSection.Vision}</span>
</div> </div>
<div className="flex flex-col items-center gap-4 text-center"> <div className="flex flex-col items-center gap-4 text-center">
<div className="bg-mti-rose-ultralight border border-mti-rose-light p-6 rounded-3xl flex items-center justify-center w-fit h-fit"> <div className="bg-mti-rose-ultralight border border-mti-rose-light p-6 rounded-3xl flex items-center justify-center w-fit h-fit">
<BsRocketTakeoffFill className="text-mti-rose-light w-10 h-10" /> <BsRocketTakeoffFill className="text-mti-rose-light w-10 h-10" />
</div> </div>
<span className="text-lg">{translation.mission_vision_values.mission[language]}</span> <span className="text-lg">{data.MissionVisionValuesSection.Mission}</span>
</div> </div>
<div className="flex flex-col items-center gap-4 md:col-span-2"> <div className="flex flex-col items-center gap-4 md:col-span-2">
<div className="bg-mti-rose-ultralight border border-mti-rose-light p-6 rounded-3xl flex items-center justify-center w-fit h-fit"> <div className="bg-mti-rose-ultralight border border-mti-rose-light p-6 rounded-3xl flex items-center justify-center w-fit h-fit">
<BsFlower3 className="text-mti-rose-light w-10 h-10" /> <BsFlower3 className="text-mti-rose-light w-10 h-10" />
</div> </div>
<div className="text-lg flex flex-wrap items-center justify-center max-w-xl gap-x-8 gap-y-4"> <div className="text-lg flex flex-wrap items-center justify-center max-w-xl gap-x-8 gap-y-4">
{translation.mission_vision_values.values[language].map((x) => ( {data.MissionVisionValuesSection.Values.split("\n").map((x) => (
<span key={x}>{x}</span> <span key={x}>{x}</span>
))} ))}
</div> </div>
@@ -87,9 +89,9 @@ export default function About({language}: Props) {
<section id="message" className="w-full bg-white"> <section id="message" className="w-full bg-white">
<div className="w-full flex -md:flex-col -md:items-center -md:pb-16 justify-between gap-8 p-8 md:p-20 container mx-auto"> <div className="w-full flex -md:flex-col -md:items-center -md:pb-16 justify-between gap-8 p-8 md:p-20 container mx-auto">
<div className={clsx("flex flex-col gap-8 max-w-xl")}> <div className={clsx("flex flex-col gap-8 max-w-xl")}>
<Title>{translation.ceo_message.title[language]}</Title> <Title>{data.CEOMessage.Title}</Title>
<span> <span>
{translation.ceo_message.text[language].split("\n").map((line, index) => ( {data.CEOMessage.Text.split("\n").map((line, index) => (
<React.Fragment key={index}> <React.Fragment key={index}>
<p>{line}</p> <p>{line}</p>
<br /> <br />
@@ -107,7 +109,7 @@ export default function About({language}: Props) {
<div className="w-5 h-5 rounded-full bg-mti-rose-ultralight absolute -left-10 bottom-10" /> <div className="w-5 h-5 rounded-full bg-mti-rose-ultralight absolute -left-10 bottom-10" />
<div className="w-5 h-5 rounded-full bg-mti-rose-ultralight absolute -left-10 bottom-20" /> <div className="w-5 h-5 rounded-full bg-mti-rose-ultralight absolute -left-10 bottom-20" />
<div className="w-5 h-5 rounded-full bg-mti-rose-ultralight absolute -left-10 bottom-30" /> <div className="w-5 h-5 rounded-full bg-mti-rose-ultralight absolute -left-10 bottom-30" />
<span className="absolute left-1/2 -translate-x-2/3 -bottom-10">{translation.ceo_message.name[language]}</span> <span className="absolute left-1/2 -translate-x-2/3 -bottom-10">{data.CEOMessage.Name}</span>
</div> </div>
</div> </div>
</div> </div>
@@ -117,17 +119,17 @@ export default function About({language}: Props) {
<section id="capabilities" className="w-full bg-mti-gray-seasalt"> <section id="capabilities" className="w-full bg-mti-gray-seasalt">
<div className={clsx("w-full flex flex-col -md:items-center -md:pb-16 gap-8 p-8 md:p-20 container mx-auto")}> <div className={clsx("w-full flex flex-col -md:items-center -md:pb-16 gap-8 p-8 md:p-20 container mx-auto")}>
<div className={clsx("w-full flex")}> <div className={clsx("w-full flex")}>
<Title>{translation.capabilities.title[language]}</Title> <Title>{data.Capabilities.Title}</Title>
</div> </div>
<span className="text-lg">{translation.capabilities.intro[language]}</span> <span className="text-lg">{data.Capabilities.Intro}</span>
<div className="w-full grid -md:grid-cols-1 md:grid-cols-2 gap-8"> <div className="w-full grid -md:grid-cols-1 md:grid-cols-2 gap-8">
<div className={clsx("flex gap-4 items-center", language === "ar" && "flex-row-reverse")}> <div className={clsx("flex gap-4 items-center", language === "ar" && "flex-row-reverse")}>
<div className="bg-mti-rose-ultralight border border-mti-rose-light p-4 rounded-xl flex items-center justify-center w-fit h-fit"> <div className="bg-mti-rose-ultralight border border-mti-rose-light p-4 rounded-xl flex items-center justify-center w-fit h-fit">
<BsGraphUp className="text-mti-rose-light w-6 h-6" /> <BsGraphUp className="text-mti-rose-light w-6 h-6" />
</div> </div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<span className="text-lg font-bold text-mti-rose-light">{translation.capabilities.analytics.title[language]}</span> <span className="text-lg font-bold text-mti-rose-light">{data.Capabilities.Analytics.Title}</span>
<p>{translation.capabilities.analytics.text[language]}</p> <p>{data.Capabilities.Analytics.Text}</p>
</div> </div>
</div> </div>
@@ -136,8 +138,8 @@ export default function About({language}: Props) {
<BiSolidBrain className="text-mti-rose-light w-6 h-6" /> <BiSolidBrain className="text-mti-rose-light w-6 h-6" />
</div> </div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<span className="text-lg font-bold text-mti-rose-light">{translation.capabilities.predictive.title[language]}</span> <span className="text-lg font-bold text-mti-rose-light">{data.Capabilities.Predictive.Title}</span>
<p>{translation.capabilities.predictive.text[language]}</p> <p>{data.Capabilities.Predictive.Text}</p>
</div> </div>
</div> </div>
@@ -146,8 +148,8 @@ export default function About({language}: Props) {
<BsTranslate className="text-mti-rose-light w-6 h-6" /> <BsTranslate className="text-mti-rose-light w-6 h-6" />
</div> </div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<span className="text-lg font-bold text-mti-rose-light">{translation.capabilities.nlp.title[language]}</span> <span className="text-lg font-bold text-mti-rose-light">{data.Capabilities.NLP.Title}</span>
<p>{translation.capabilities.nlp.text[language]}</p> <p>{data.Capabilities.NLP.Text}</p>
</div> </div>
</div> </div>
@@ -156,8 +158,8 @@ export default function About({language}: Props) {
<BsPersonFill className="text-mti-rose-light w-6 h-6" /> <BsPersonFill className="text-mti-rose-light w-6 h-6" />
</div> </div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<span className="text-lg font-bold text-mti-rose-light">{translation.capabilities.engine.title[language]}</span> <span className="text-lg font-bold text-mti-rose-light">{data.Capabilities.Engine.Title}</span>
<p>{translation.capabilities.engine.text[language]}</p> <p>{data.Capabilities.Engine.Text}</p>
</div> </div>
</div> </div>
@@ -166,10 +168,8 @@ export default function About({language}: Props) {
<BsRepeat className="text-mti-rose-light w-6 h-6" /> <BsRepeat className="text-mti-rose-light w-6 h-6" />
</div> </div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<span className="text-lg font-bold text-mti-rose-light"> <span className="text-lg font-bold text-mti-rose-light">{data.Capabilities.ContinuousLearning.Title}</span>
{translation.capabilities.continuous_learning.title[language]} <p>{data.Capabilities.ContinuousLearning.Text}</p>
</span>
<p>{translation.capabilities.continuous_learning.text[language]}</p>
</div> </div>
</div> </div>
</div> </div>
@@ -180,17 +180,17 @@ export default function About({language}: Props) {
<section id="expertise" className="w-full bg-white"> <section id="expertise" className="w-full bg-white">
<div className={clsx("w-full flex flex-col -md:items-center -md:pb-16 gap-8 p-8 md:p-20 container mx-auto")}> <div className={clsx("w-full flex flex-col -md:items-center -md:pb-16 gap-8 p-8 md:p-20 container mx-auto")}>
<div className={clsx("w-full flex")}> <div className={clsx("w-full flex")}>
<Title>{translation.expertise.title[language]}</Title> <Title>{data.Expertise.Title}</Title>
</div> </div>
<span className="text-lg">{translation.expertise.intro[language]}</span> <span className="text-lg">{data.Expertise.Intro}</span>
<div className="w-full grid -md:grid-cols-1 md:grid-cols-2 gap-8"> <div className="w-full grid -md:grid-cols-1 md:grid-cols-2 gap-8">
<div className={clsx("flex gap-4 items-center", language === "ar" && "flex-row-reverse")}> <div className={clsx("flex gap-4 items-center", language === "ar" && "flex-row-reverse")}>
<div className="bg-mti-rose-ultralight border border-mti-rose-light p-4 rounded-xl flex items-center justify-center w-fit h-fit"> <div className="bg-mti-rose-ultralight border border-mti-rose-light p-4 rounded-xl flex items-center justify-center w-fit h-fit">
<BiWorld className="text-mti-rose-light w-6 h-6" /> <BiWorld className="text-mti-rose-light w-6 h-6" />
</div> </div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<span className="text-lg font-bold text-mti-rose-light">{translation.expertise.language.title[language]}</span> <span className="text-lg font-bold text-mti-rose-light">{data.Expertise.Language.Title}</span>
<p>{translation.expertise.language.text[language]}</p> <p>{data.Expertise.Language.Text}</p>
</div> </div>
</div> </div>
@@ -199,8 +199,8 @@ export default function About({language}: Props) {
<BsClipboard2CheckFill className="text-mti-rose-light w-6 h-6" /> <BsClipboard2CheckFill className="text-mti-rose-light w-6 h-6" />
</div> </div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<span className="text-lg font-bold text-mti-rose-light">{translation.expertise.ielts.title[language]}</span> <span className="text-lg font-bold text-mti-rose-light">{data.Expertise.IELTS.Title}</span>
<p>{translation.expertise.ielts.text[language]}</p> <p>{data.Expertise.IELTS.Text}</p>
</div> </div>
</div> </div>
@@ -209,8 +209,8 @@ export default function About({language}: Props) {
<BsClipboard2DataFill className="text-mti-rose-light w-6 h-6" /> <BsClipboard2DataFill className="text-mti-rose-light w-6 h-6" />
</div> </div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<span className="text-lg font-bold text-mti-rose-light">{translation.expertise.alignment.title[language]}</span> <span className="text-lg font-bold text-mti-rose-light">{data.Expertise.Alignment.Title}</span>
<p>{translation.expertise.alignment.text[language]}</p> <p>{data.Expertise.Alignment.Text}</p>
</div> </div>
</div> </div>
@@ -219,8 +219,8 @@ export default function About({language}: Props) {
<BsPersonFillExclamation className="text-mti-rose-light w-6 h-6" /> <BsPersonFillExclamation className="text-mti-rose-light w-6 h-6" />
</div> </div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<span className="text-lg font-bold text-mti-rose-light">{translation.expertise.native.title[language]}</span> <span className="text-lg font-bold text-mti-rose-light">{data.Expertise.Native.Title}</span>
<p>{translation.expertise.native.text[language]}</p> <p>{data.Expertise.Native.Text}</p>
</div> </div>
</div> </div>
@@ -229,10 +229,8 @@ export default function About({language}: Props) {
<BsBook className="text-mti-rose-light w-6 h-6" /> <BsBook className="text-mti-rose-light w-6 h-6" />
</div> </div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<span className="text-lg font-bold text-mti-rose-light"> <span className="text-lg font-bold text-mti-rose-light">{data.Expertise.KnowledgeExperience.Title}</span>
{translation.expertise.knowledge_experience.title[language]} <p>{data.Expertise.KnowledgeExperience.Text}</p>
</span>
<p>{translation.expertise.knowledge_experience.text[language]}</p>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -3,12 +3,14 @@ import Navbar from "@/components/Navbar";
import Title from "@/components/Title"; import Title from "@/components/Title";
import {Contact} from "@/types/contact"; import {Contact} from "@/types/contact";
import translation from "@/translation/agentcontacts.json"; import translation from "@/translation/agentcontacts.json";
import CountryManagerContactsPage from "@/types/cms/countryManagerContacts";
type Language = "en" | "ar"; type Language = "en" | "ar";
interface Props { interface Props {
country: string; country: string;
page: string; page: string;
language: Language; language: Language;
data: CountryManagerContactsPage;
} }
async function getCountryManagers(country: string, language: Language = "en") { async function getCountryManagers(country: string, language: Language = "en") {
@@ -27,7 +29,7 @@ export async function generateStaticParamsHelper(language: Language = "en") {
country: key.toLowerCase().replaceAll(" ", ""), country: key.toLowerCase().replaceAll(" ", ""),
})); }));
} }
export async function AgentContacts({language, page, country}: Props) { export async function AgentContacts({language, page, country, data}: Props) {
const contact = (await getCountryManagers(country, language)) as Contact; const contact = (await getCountryManagers(country, language)) as Contact;
return ( return (
@@ -44,15 +46,15 @@ export async function AgentContacts({language, page, country}: Props) {
{contact.entries.map((entry) => ( {contact.entries.map((entry) => (
<div key={entry.name}> <div key={entry.name}>
<h2> <h2>
<strong>{translation.name[language]}: </strong> <strong>{data.Name}: </strong>
{entry.name} {entry.name}
</h2> </h2>
<p> <p>
<strong>{translation.number[language]}: </strong> <strong>{data.Number}: </strong>
{entry.number} {entry.number}
</p> </p>
<p> <p>
<strong>{translation.email[language]}: </strong> <strong>{data.Email}: </strong>
{entry.email} {entry.email}
</p> </p>
</div> </div>

View File

@@ -6,30 +6,25 @@ import Title from "@/components/Title";
import translation from "@/translation/about.json"; import translation from "@/translation/about.json";
import clsx from "clsx"; import clsx from "clsx";
import React from "react"; import React from "react";
import { import {BsEye, BsEyeFill, BsFlower3, BsRocketTakeoffFill} from "react-icons/bs";
BsEye,
BsEyeFill,
BsFlower3,
BsRocketTakeoffFill,
} from "react-icons/bs";
interface Props { interface Props {
page: string; page: string;
language: "en" | "ar"; language: "en" | "ar";
} }
export default function ComingSoon({ page, language }: Props) { export default function ComingSoon({page, language}: Props) {
return ( return (
<main className="text-mti-black flex h-screen w-full flex-col bg-white" dir={language === "ar" ? "rtl" : "ltr"}> <main className="text-mti-black flex h-screen w-full flex-col bg-white" dir={language === "ar" ? "rtl" : "ltr"}>
<Navbar currentPage={page} language={language} /> <Navbar currentPage={page} language={language} />
<section className="bg-mti-purple h-full w-full p-8 text-center text-white md:p-16"> <section className="bg-mti-purple h-full w-full p-8 text-center text-white md:p-16">
<div className="flex h-full w-full flex-col items-center justify-center"> <div className="flex h-full w-full flex-col items-center justify-center">
<Title>Coming soon...</Title> <Title>Coming soon...</Title>
</div> </div>
</section> </section>
<Footer language={language} /> <Footer language={language} />
</main> </main>
); );
} }

View File

@@ -7,6 +7,7 @@ import Title from "@/components/Title";
import translation from "@/translation/contactus.json"; import translation from "@/translation/contactus.json";
import Image from "next/image"; import Image from "next/image";
import {toast, ToastContainer} from "react-toastify"; import {toast, ToastContainer} from "react-toastify";
import ContactPage from "@/types/cms/contact";
type FormValues = { type FormValues = {
name: string; name: string;
@@ -18,6 +19,7 @@ type FormValues = {
interface Props { interface Props {
language: "en" | "ar"; language: "en" | "ar";
data: ContactPage;
page: string; page: string;
} }
@@ -26,18 +28,18 @@ const ErrorMessage = ({message}: {message: string}) => (
<span className="text-mti-red">{message}</span> <span className="text-mti-red">{message}</span>
</div> </div>
); );
export default function App({language, page}: Props) { export default function App({language, data, page}: Props) {
const selectOptions = [ const selectOptions = [
{ {
label: translation.feedback[language], label: data.Feedback,
value: "feedback", value: "feedback",
}, },
{ {
label: translation.bug[language], label: data.Bug,
value: "bug", value: "bug",
}, },
{ {
label: translation.help[language], label: data.Help,
value: "help", value: "help",
}, },
]; ];
@@ -53,7 +55,7 @@ export default function App({language, page}: Props) {
}); });
const {errors, isDirty, isValid} = formState; const {errors, isDirty, isValid} = formState;
const onSubmit: SubmitHandler<FormValues> = async (data) => { const onSubmit: SubmitHandler<FormValues> = async (body) => {
try { try {
const response = await fetch(`https://platform.encoach.com/api/tickets`, { const response = await fetch(`https://platform.encoach.com/api/tickets`, {
method: "POST", method: "POST",
@@ -62,29 +64,29 @@ export default function App({language, page}: Props) {
}, },
body: JSON.stringify({ body: JSON.stringify({
reporter: { reporter: {
name: data.name, name: body.name,
email: data.email, email: body.email,
}, },
subject: data.subject, subject: body.subject,
type: data.type, type: body.type,
reportedFrom: window?.location.toString() || "", reportedFrom: window?.location.toString() || "",
status: "submitted", status: "submitted",
date: new Date().toISOString(), date: new Date().toISOString(),
description: data.description, description: body.description,
}), }),
}); });
if (response.status === 200) { if (response.status === 200) {
const data = await response.json(); const body = await response.json();
// Pass data to the page via props // Pass data to the page via props
if (data.ok) { if (body.ok) {
toast.success(translation.ticketSuccess[language]); toast.success(data.TicketSuccess);
return; return;
} }
} }
} catch (err) {} } catch (err) {}
toast.error(translation.ticketError[language]); toast.error(data.TicketError);
}; };
return ( return (
@@ -94,7 +96,7 @@ export default function App({language, page}: Props) {
<Navbar currentPage={page} language={language} /> <Navbar currentPage={page} language={language} />
<section className="w-full bg-mti-purple text-white text-center p-8 md:p-16"> <section className="w-full bg-mti-purple text-white text-center p-8 md:p-16">
<div className="w-full h-full flex flex-col items-center justify-center"> <div className="w-full h-full flex flex-col items-center justify-center">
<Title>{translation.title[language]}</Title> <Title>{data.Title}</Title>
</div> </div>
</section> </section>
<section className="w-full bg-white text-center p-8 md:p-16 flex justify-center items-center gap-32"> <section className="w-full bg-white text-center p-8 md:p-16 flex justify-center items-center gap-32">
@@ -102,31 +104,31 @@ export default function App({language, page}: Props) {
<input <input
id="name" id="name"
type="text" type="text"
placeholder={translation.name[language]} placeholder={data.Name}
{...register("name", {required: true})} {...register("name", {required: true})}
className="input input-bordered md:w-full sm:w-1/2 max-w-md" className="input input-bordered md:w-full sm:w-1/2 max-w-md"
/> />
{errors.name && errors.name.type === "required" && <ErrorMessage message={translation.fieldRequired[language]} />} {errors.name && errors.name.type === "required" && <ErrorMessage message={data.FieldRequired} />}
<input <input
id="email" id="email"
placeholder={translation.email[language]} placeholder={data.Email}
type="text" type="text"
{...register("email", {required: true, pattern: /^\S+@\S+$/i})} {...register("email", {required: true, pattern: /^\S+@\S+$/i})}
className="input input-bordered md:w-full sm:w-1/2 max-w-md" className="input input-bordered md:w-full sm:w-1/2 max-w-md"
/> />
{errors.email && errors.email.type === "required" && <ErrorMessage message={translation.fieldRequired[language]} />} {errors.email && errors.email.type === "required" && <ErrorMessage message={data.FieldRequired} />}
{errors.email && errors.email.type === "pattern" && <ErrorMessage message={translation.invalidEmail[language]} />} {errors.email && errors.email.type === "pattern" && <ErrorMessage message={data.InvalidEmail} />}
<input <input
id="subject" id="subject"
placeholder={translation.subject[language]} placeholder={data.Subject}
type="text" type="text"
{...register("subject", {required: true})} {...register("subject", {required: true})}
className="input input-bordered md:w-full sm:w-1/2 max-w-md" className="input input-bordered md:w-full sm:w-1/2 max-w-md"
/> />
{errors.subject && errors.subject.type === "required" && <ErrorMessage message={translation.fieldRequired[language]} />} {errors.subject && errors.subject.type === "required" && <ErrorMessage message={data.FieldRequired} />}
<select id="type" {...register("type", {required: true})} className="select select-bordered md:w-full sm:w-1/2 max-w-md"> <select id="type" {...register("type", {required: true})} className="select select-bordered md:w-full sm:w-1/2 max-w-md">
<option value="" disabled> <option value="" disabled>
{translation.selectType[language]} {data.SelectType}
</option> </option>
{selectOptions.map((option) => ( {selectOptions.map((option) => (
<option key={option.value} value={option.value}> <option key={option.value} value={option.value}>
@@ -134,18 +136,16 @@ export default function App({language, page}: Props) {
</option> </option>
))} ))}
</select> </select>
{errors.type && errors.type.type === "required" && <ErrorMessage message={translation.fieldRequired[language]} />} {errors.type && errors.type.type === "required" && <ErrorMessage message={data.FieldRequired} />}
<textarea <textarea
id="description" id="description"
placeholder={translation.description[language]} placeholder={data.Description}
{...register("description", {required: true})} {...register("description", {required: true})}
className="textarea textarea-bordered md:w-full sm:w-1/2 max-w-md" className="textarea textarea-bordered md:w-full sm:w-1/2 max-w-md"
rows={5} rows={5}
/> />
{errors.description && errors.description.type === "required" && ( {errors.description && errors.description.type === "required" && <ErrorMessage message={data.FieldRequired} />}
<ErrorMessage message={translation.fieldRequired[language]} /> <input type="submit" className="btn" disabled={!isDirty || !isValid} value={data.Submit} />
)}
<input type="submit" className="btn" disabled={!isDirty || !isValid} value={translation.submit[language]} />
</form> </form>
<div className="flex flex-col"> <div className="flex flex-col">
<Image src="/person_laptop_focus.jpg" alt="Contact Us" width={500} height={340} className="rounded-xl" /> <Image src="/person_laptop_focus.jpg" alt="Contact Us" width={500} height={340} className="rounded-xl" />

View File

@@ -2,14 +2,15 @@
import Footer from "@/components/Footer"; import Footer from "@/components/Footer";
import Navbar from "@/components/Navbar"; import Navbar from "@/components/Navbar";
import Title from "@/components/Title"; import Title from "@/components/Title";
import translation from "@/translation/history.json";
import clsx from "clsx"; import clsx from "clsx";
import React from "react"; import React from "react";
import * as BsIcon from "react-icons/bs"; import * as BsIcon from "react-icons/bs";
import {IconType} from "react-icons"; import {IconType} from "react-icons";
import HistoryPage from "@/types/cms/history";
interface Props { interface Props {
language: "en" | "ar"; language: "en" | "ar";
data: HistoryPage;
} }
interface ElementProps { interface ElementProps {
@@ -48,25 +49,25 @@ const Element = ({date, label, isEven, language, Icon}: ElementProps) => {
); );
}; };
export default function History({language}: Props) { export default function History({language, data}: Props) {
return ( return (
<main className="h-screen w-full bg-white text-mti-black flex flex-col" dir={language === "ar" ? "rtl" : "ltr"}> <main className="h-screen w-full bg-white text-mti-black flex flex-col" dir={language === "ar" ? "rtl" : "ltr"}>
<Navbar currentPage="/history" language={language} /> <Navbar currentPage="/history" language={language} />
<section className="w-full bg-mti-purple text-white text-center p-8 md:p-16"> <section className="w-full bg-mti-purple text-white text-center p-8 md:p-16">
<div className="w-full h-full flex flex-col items-center justify-center"> <div className="w-full h-full flex flex-col items-center justify-center">
<Title>{translation.title[language]}</Title> <Title>{data.Title}</Title>
</div> </div>
</section> </section>
<section id="history" className="w-full h-fit bg-white"> <section id="history" className="w-full h-fit bg-white">
<div className="w-full h-fit flex flex-col items-center gap-8 p-8 md:p-20 container mx-auto relative"> <div className="w-full h-fit flex flex-col items-center gap-8 p-8 md:p-20 container mx-auto relative">
<div className="flex flex-col gap-8 z-20"> <div className="flex flex-col gap-8 z-20">
{translation.events.map((event, index) => ( {data.Events.map((event, index) => (
<Element <Element
date={event.date[language]} date={event.Date}
label={event.label[language]} label={event.Label}
Icon={BsIcon[event.icon as keyof typeof BsIcon]} Icon={BsIcon[event.Icon as keyof typeof BsIcon]}
key={index} key={index}
isEven={(index + 1) % 2 === 0} isEven={(index + 1) % 2 === 0}
language={language} language={language}

View File

@@ -7,12 +7,14 @@ import translation from "@/translation/home.json";
import clsx from "clsx"; import clsx from "clsx";
import Tag from "@/components/Tag"; import Tag from "@/components/Tag";
import Title from "@/components/Title"; import Title from "@/components/Title";
import HomePage from "@/types/cms/home";
interface Props { interface Props {
language: "en" | "ar"; language: "en" | "ar";
data: HomePage;
} }
export default function Home({language}: Props) { export default function Home({language, data}: Props) {
return ( return (
<main <main
className={clsx("h-screen w-full bg-white text-mti-black flex flex-col", language === "ar" && "text-right")} className={clsx("h-screen w-full bg-white text-mti-black flex flex-col", language === "ar" && "text-right")}
@@ -23,7 +25,7 @@ export default function Home({language}: Props) {
<img src="/banner_encoach_home.png" alt="IELTS Packages - Together we prepare for the future" className="w-full" /> <img src="/banner_encoach_home.png" alt="IELTS Packages - Together we prepare for the future" className="w-full" />
<Link href={language === "ar" ? "/ar/price" : "/price"}> <Link href={language === "ar" ? "/ar/price" : "/price"}>
<button className="absolute bottom-1/12 -lg:hidden left-1/12 bg-mti-purple-light hover:bg-mti-purple text-white rounded-xl px-8 py-4 transition ease-in-out duration-300 shadow"> <button className="absolute bottom-1/12 -lg:hidden left-1/12 bg-mti-purple-light hover:bg-mti-purple text-white rounded-xl px-8 py-4 transition ease-in-out duration-300 shadow">
{translation.get_started_btn[language]} {data.GetStartedButton}
</button> </button>
</Link> </Link>
</section> </section>
@@ -36,8 +38,8 @@ export default function Home({language}: Props) {
<BsBook className="text-mti-rose-light w-10 h-10" /> <BsBook className="text-mti-rose-light w-10 h-10" />
</div> </div>
<div className={clsx("flex flex-col gap-4 items-center max-w-[260px]", language === "ar" ? "text-right" : "text-left")}> <div className={clsx("flex flex-col gap-4 items-center max-w-[260px]", language === "ar" ? "text-right" : "text-left")}>
<span className="font-bold text-xl">{translation.modules.reading.title[language]}</span> <span className="font-bold text-xl">{data.Modules.Reading.Title}</span>
<span>{translation.modules.reading.description[language]}</span> <span>{data.Modules.Reading.Text}</span>
</div> </div>
</div> </div>
<div className="flex flex-col items-center gap-6"> <div className="flex flex-col items-center gap-6">
@@ -45,8 +47,8 @@ export default function Home({language}: Props) {
<BsHeadphones className="text-mti-rose-light w-10 h-10" /> <BsHeadphones className="text-mti-rose-light w-10 h-10" />
</div> </div>
<div className={clsx("flex flex-col gap-4 items-center max-w-[260px]", language === "ar" ? "text-right" : "text-left")}> <div className={clsx("flex flex-col gap-4 items-center max-w-[260px]", language === "ar" ? "text-right" : "text-left")}>
<span className="font-bold text-xl">{translation.modules.listening.title[language]}</span> <span className="font-bold text-xl">{data.Modules.Listening.Title}</span>
<span>{translation.modules.listening.description[language]}</span> <span>{data.Modules.Listening.Text}</span>
</div> </div>
</div> </div>
<div className="flex flex-col items-center gap-6"> <div className="flex flex-col items-center gap-6">
@@ -54,8 +56,8 @@ export default function Home({language}: Props) {
<BsPen className="text-mti-rose-light w-10 h-10" /> <BsPen className="text-mti-rose-light w-10 h-10" />
</div> </div>
<div className={clsx("flex flex-col gap-4 items-center max-w-[260px]", language === "ar" ? "text-right" : "text-left")}> <div className={clsx("flex flex-col gap-4 items-center max-w-[260px]", language === "ar" ? "text-right" : "text-left")}>
<span className="font-bold text-xl">{translation.modules.writing.title[language]}</span> <span className="font-bold text-xl">{data.Modules.Writing.Title}</span>
<span>{translation.modules.writing.description[language]}</span> <span>{data.Modules.Writing.Text}</span>
</div> </div>
</div> </div>
<div className="flex flex-col items-center gap-6"> <div className="flex flex-col items-center gap-6">
@@ -63,8 +65,8 @@ export default function Home({language}: Props) {
<BsMegaphone className="text-mti-rose-light w-10 h-10" /> <BsMegaphone className="text-mti-rose-light w-10 h-10" />
</div> </div>
<div className={clsx("flex flex-col gap-4 items-center max-w-[260px]", language === "ar" ? "text-right" : "text-left")}> <div className={clsx("flex flex-col gap-4 items-center max-w-[260px]", language === "ar" ? "text-right" : "text-left")}>
<span className="font-bold text-xl">{translation.modules.speaking.title[language]}</span> <span className="font-bold text-xl">{data.Modules.Speaking.Title}</span>
<span>{translation.modules.speaking.description[language]}</span> <span>{data.Modules.Speaking.Text}</span>
</div> </div>
</div> </div>
</div> </div>
@@ -74,14 +76,14 @@ export default function Home({language}: Props) {
<section className="w-full bg-mti-gray-seasalt"> <section className="w-full bg-mti-gray-seasalt">
<div className="w-full p-8 lg:py-24 lg:px-12 flex flex-col gap-8 md:gap-24 lg:flex-row items-center justify-center container mx-auto"> <div className="w-full p-8 lg:py-24 lg:px-12 flex flex-col gap-8 md:gap-24 lg:flex-row items-center justify-center container mx-auto">
<div className="flex flex-col gap-8"> <div className="flex flex-col gap-8">
<Tag>{translation.learn_ai.tag[language]}</Tag> <Tag>{data.LearnAI.Tag}</Tag>
<div className={clsx("flex flex-col gap-3", language === "ar" && "items-end")}> <div className={clsx("flex flex-col gap-3", language === "ar" && "items-end")}>
<Title>{translation.learn_ai.title[language]}</Title> <Title>{data.LearnAI.Title}</Title>
<p className="max-w-lg text-base">{translation.learn_ai.description[language]}</p> <p className="max-w-lg text-base">{data.LearnAI.Text}</p>
</div> </div>
<Link href="/price"> <Link href="/price">
<button className="bg-mti-purple-light hover:bg-mti-purple text-white rounded-xl px-8 py-4 transition ease-in-out duration-300 shadow"> <button className="bg-mti-purple-light hover:bg-mti-purple text-white rounded-xl px-8 py-4 transition ease-in-out duration-300 shadow">
{translation.learn_more[language]} {data.LearnMore}
</button> </button>
</Link> </Link>
</div> </div>
@@ -106,14 +108,14 @@ export default function Home({language}: Props) {
</div> </div>
</div> </div>
<div className="flex flex-col gap-8"> <div className="flex flex-col gap-8">
<Tag>{translation.encoach_benefits.tag[language]}</Tag> <Tag>{data.EnCoachBenefits.Tag}</Tag>
<div className={clsx("flex flex-col gap-3", language === "ar" && "items-end")}> <div className={clsx("flex flex-col gap-3", language === "ar" && "items-end")}>
<Title>{translation.encoach_benefits.title[language]}</Title> <Title>{data.EnCoachBenefits.Title}</Title>
<p className="max-w-lg text-base">{translation.encoach_benefits.description[language]}</p> <p className="max-w-lg text-base">{data.EnCoachBenefits.Text}</p>
</div> </div>
<Link href="/about"> <Link href="/about">
<button className="bg-mti-purple-light hover:bg-mti-purple text-white rounded-xl px-8 py-4 transition ease-in-out duration-300 shadow"> <button className="bg-mti-purple-light hover:bg-mti-purple text-white rounded-xl px-8 py-4 transition ease-in-out duration-300 shadow">
{translation.learn_more[language]} {data.LearnMore}
</button> </button>
</Link> </Link>
</div> </div>
@@ -123,15 +125,15 @@ export default function Home({language}: Props) {
{/* Interested Section */} {/* Interested Section */}
<section className="w-full bg-mti-gray-seasalt"> <section className="w-full bg-mti-gray-seasalt">
<div className="w-full p-8 py-16 md:py-32 md:px-16 lg:px-28 items-center justify-center flex flex-col gap-10 relative container mx-auto"> <div className="w-full p-8 py-16 md:py-32 md:px-16 lg:px-28 items-center justify-center flex flex-col gap-10 relative container mx-auto">
<Tag>{translation.interested.tag[language]}</Tag> <Tag>{data.Interested.Tag}</Tag>
<Title className="!max-w-sm text-center">{translation.interested.title[language]}</Title> <Title className="!max-w-sm text-center">{data.Interested.Title}</Title>
<Link href="/contact"> <Link href="/contact">
<button className="bg-mti-purple-light hover:bg-mti-purple text-white rounded-xl px-8 py-4 transition ease-in-out duration-300 shadow"> <button className="bg-mti-purple-light hover:bg-mti-purple text-white rounded-xl px-8 py-4 transition ease-in-out duration-300 shadow">
{translation.interested.contact_us[language]} {data.Interested.ContactUs}
</button> </button>
</Link> </Link>
<div className="lg:absolute top-1/2 lg:-translate-y-2/3 right-1/6 flex flex-col items-center"> <div className="lg:absolute top-1/2 lg:-translate-y-2/3 right-1/6 flex flex-col items-center">
<em className="text-xs text-mti-purple-light font-semibold">{translation.interested.whatsapp[language]}</em> <em className="text-xs text-mti-purple-light font-semibold">{data.Interested.WhatsAppContact}</em>
<img className="w-32 h-32" alt="WhatsApp QR Code for MTI" src="/whatsapp_qrcode.png" /> <img className="w-32 h-32" alt="WhatsApp QR Code for MTI" src="/whatsapp_qrcode.png" />
<div className="w-full h-full relative"> <div className="w-full h-full relative">
<div className="w-3 h-3 bg-mti-purple rounded-full absolute -bottom-6" /> <div className="w-3 h-3 bg-mti-purple rounded-full absolute -bottom-6" />
@@ -152,14 +154,14 @@ export default function Home({language}: Props) {
<section className="w-full bg-white"> <section className="w-full bg-white">
<div className="w-full px-8 pt-12 pb-20 md:p-20 lg:p-32 flex flex-col gap-12 md:flex-row items-center justify-around container mx-auto"> <div className="w-full px-8 pt-12 pb-20 md:p-20 lg:p-32 flex flex-col gap-12 md:flex-row items-center justify-around container mx-auto">
<div className="flex flex-col gap-8"> <div className="flex flex-col gap-8">
<Tag>{translation.ceo_message.tag[language]}</Tag> <Tag>{data.CEOMessage.Tag}</Tag>
<div className={clsx("flex flex-col gap-3", language === "ar" && "items-end")}> <div className={clsx("flex flex-col gap-3", language === "ar" && "items-end")}>
<Title>{translation.ceo_message.title[language]}</Title> <Title>{data.CEOMessage.Title}</Title>
<p className="max-w-lg text-base">{translation.ceo_message.description[language]}</p> <p className="max-w-lg text-base">{data.CEOMessage.Text}</p>
</div> </div>
<Link href={`${language === "ar" ? "/ar" : ""}/about#message`}> <Link href={`${language === "ar" ? "/ar" : ""}/about#message`}>
<button className="bg-mti-purple-light hover:bg-mti-purple text-white rounded-xl px-8 py-4 transition ease-in-out duration-300 shadow"> <button className="bg-mti-purple-light hover:bg-mti-purple text-white rounded-xl px-8 py-4 transition ease-in-out duration-300 shadow">
{translation.learn_more[language]} {data.LearnMore}
</button> </button>
</Link> </Link>
</div> </div>

View File

@@ -8,7 +8,7 @@ import clsx from "clsx";
import Navbar from "@/components/Navbar"; import Navbar from "@/components/Navbar";
import Link from "next/link"; import Link from "next/link";
import Footer from "@/components/Footer"; import Footer from "@/components/Footer";
import translation from "@/translation/price.json"; import PricePage from "@/types/cms/price";
type DurationUnit = "weeks" | "days" | "months" | "years"; type DurationUnit = "weeks" | "days" | "months" | "years";
@@ -20,28 +20,33 @@ interface Package {
price: number; price: number;
} }
export default function Page({language}: {language: "en" | "ar"}) { interface Props {
language: "en" | "ar";
data: PricePage;
}
export default function Page({language, data}: Props) {
const getDurationUnit = (duration: number, durationUnitSingular: string, durationUnitPlural: string) => { const getDurationUnit = (duration: number, durationUnitSingular: string, durationUnitPlural: string) => {
if(duration >= 2 && duration <= 10) { if (duration >= 2 && duration <= 10) {
return durationUnitPlural; return durationUnitPlural;
} }
return durationUnitSingular; return durationUnitSingular;
} };
const durationAndDurationUnitParser = (duration: number, duration_unit: DurationUnit) => { const durationAndDurationUnitParser = (duration: number, duration_unit: DurationUnit) => {
if(language === 'ar') { if (language === "ar") {
switch (duration_unit) { switch (duration_unit) {
case "days": case "days":
return `${duration} ${getDurationUnit(duration, translation.days.singular[language], translation.days.plural[language])}`; return `${duration} ${getDurationUnit(duration, data.Days.Singular, data.Days.Plural)}`;
case "weeks": case "weeks":
return `${duration} ${getDurationUnit(duration, translation.weeks.singular[language], translation.weeks.plural[language])}`; return `${duration} ${getDurationUnit(duration, data.Weeks.Singular, data.Weeks.Plural)}`;
case "months": case "months":
return `${duration} ${getDurationUnit(duration, translation.months.singular[language], translation.months.plural[language])}`; return `${duration} ${getDurationUnit(duration, data.Months.Singular, data.Months.Plural)}`;
} }
} }
return `${duration} ${capitalize(duration === 1 ? duration_unit.slice(0, duration_unit.length - 1) : duration_unit)}`; return `${duration} ${capitalize(duration === 1 ? duration_unit.slice(0, duration_unit.length - 1) : duration_unit)}`;
} };
const [payments, setPayments] = React.useState<Package[]>([]); const [payments, setPayments] = React.useState<Package[]>([]);
const getData = async () => { const getData = async () => {
@@ -65,14 +70,14 @@ export default function Page({language}: {language: "en" | "ar"}) {
<main className="h-screen w-full bg-white text-mti-black flex flex-col" dir={language === "ar" ? "rtl" : "ltr"}> <main className="h-screen w-full bg-white text-mti-black flex flex-col" dir={language === "ar" ? "rtl" : "ltr"}>
<Navbar currentPage="/price" language={language} /> <Navbar currentPage="/price" language={language} />
<section className="w-full relative bg-white px-8 flex flex-col items-center text-center gap-4"> <section className="w-full relative bg-white px-8 flex flex-col items-center text-center gap-4">
<h2 className="text-3xl font-bold">{translation.title[language]}</h2> <h2 className="text-3xl font-bold">{data.Title}</h2>
<div className="grid grid-cols-2 gap-8"> <div className="grid grid-cols-2 gap-8">
{payments.map((p) => ( {payments.map((p) => (
<div key={p.id} className={clsx("p-4 bg-white rounded-xl flex flex-col gap-6 items-start")}> <div key={p.id} className={clsx("p-4 bg-white rounded-xl flex flex-col gap-6 items-start")}>
<div className="flex flex-col items-start mb-2"> <div className="flex flex-col items-start mb-2">
<Image src="/logo_title.png" alt="EnCoach's Logo" width={32} height={32} /> <Image src="/logo_title.png" alt="EnCoach's Logo" width={32} height={32} />
<span className="font-semibold text-xl"> <span className="font-semibold text-xl">
{translation.encoach[language]} - {durationAndDurationUnitParser(p.duration, p.duration_unit)} {data.EnCoach} - {durationAndDurationUnitParser(p.duration, p.duration_unit)}
</span> </span>
</div> </div>
<div className="flex flex-col gap-2 items-start w-full"> <div className="flex flex-col gap-2 items-start w-full">
@@ -82,11 +87,11 @@ export default function Page({language}: {language: "en" | "ar"}) {
</span> </span>
</div> </div>
<div className="flex flex-col gap-1 items-start"> <div className="flex flex-col gap-1 items-start">
<span>{translation.packageIncludes[language]}</span> <span>{data.PackageIncludes}</span>
<ul className="flex flex-col items-start text-sm"> <ul className="flex flex-col items-start text-sm">
<li>- {translation.packageIncludesA[language]}</li> <li>- {data.PackageIncludesA}</li>
<li>- {translation.packageIncludesB[language]}</li> <li>- {data.PackageIncludesB}</li>
<li>- {translation.packageIncludesC[language]}</li> <li>- {data.PackageIncludesB}</li>
</ul> </ul>
</div> </div>
</div> </div>
@@ -95,7 +100,7 @@ export default function Page({language}: {language: "en" | "ar"}) {
<Link <Link
className="transition ease-in-out duration-300 text-white hover:bg-mti-purple-dark hover:border-mti-purple-dark border border-mti-purple-light bg-mti-purple-light px-8 py-2 rounded-xl mb-8" className="transition ease-in-out duration-300 text-white hover:bg-mti-purple-dark hover:border-mti-purple-dark border border-mti-purple-light bg-mti-purple-light px-8 py-2 rounded-xl mb-8"
href={`https://platform.encoach.com/register`}> href={`https://platform.encoach.com/register`}>
{translation.joinus[language]} {data.SignUp}
</Link> </Link>
</section> </section>
<Footer language={language} /> <Footer language={language} />

View File

@@ -7,48 +7,40 @@ import clsx from "clsx";
import React from "react"; import React from "react";
import * as BsIcon from "react-icons/bs"; import * as BsIcon from "react-icons/bs";
import {IconType} from "react-icons"; import {IconType} from "react-icons";
import PrivacyPolicyPage from "@/types/cms/privacyPolicy";
interface Props { interface Props {
language: "en" | "ar"; language: "en" | "ar";
data: PrivacyPolicyPage;
} }
type ContentKey = keyof typeof translation.content; export default function Privacy({language, data}: Props) {
type Translation = {ar: string; en: string};
interface Content {
title?: Translation;
text?: Translation;
list?: Translation[];
}
export default function Privacy({language}: Props) {
return ( return (
<main className="h-screen w-full bg-white text-mti-black flex flex-col" dir={language === "ar" ? "rtl" : "ltr"}> <main className="h-screen w-full bg-white text-mti-black flex flex-col" dir={language === "ar" ? "rtl" : "ltr"}>
<Navbar currentPage="/terms" language={language} /> <Navbar currentPage="/privacy-policy" language={language} />
<section className="w-full bg-mti-purple text-white text-center p-8 md:p-16"> <section className="w-full bg-mti-purple text-white text-center p-8 md:p-16">
<div className="w-full h-full flex flex-col items-center justify-center"> <div className="w-full h-full flex flex-col items-center justify-center">
<Title>{translation.title[language]}</Title> <Title>{data.Title}</Title>
</div> </div>
</section> </section>
<section id="terms" className="w-full h-fit bg-white"> <section id="privacy-policy" className="w-full h-fit bg-white">
<div <div
className={clsx( className={clsx(
"w-full h-fit flex flex-col gap-8 p-8 md:p-20 container mx-auto", "w-full h-fit flex flex-col gap-8 p-8 md:p-20 container mx-auto",
language === "ar" ? "text-right" : "text-left", language === "ar" ? "text-right" : "text-left",
)}> )}>
{Object.keys(translation.content).map((key) => { {data.Content.map((content, index) => {
const content = translation.content[key as ContentKey] as Content;
return ( return (
<span className="flex flex-col gap-1" key={key} id={key}> <span className="flex flex-col gap-1" key={index} id={index.toString()}>
{content.title && <h2 className="font-semibold text-lg text-mti-purple-light">{content.title[language]}</h2>} {content.Title && <h2 className="font-semibold text-lg text-mti-purple-light">{content.Title}</h2>}
{content.text && <p className="whitespace-pre-wrap">{content.text[language]}</p>} {content.Text && <p className="whitespace-pre-wrap">{content.Text}</p>}
{content.list && ( {content.List && (
<ul className="list-disc pl-8"> <ul className="list-disc pl-8">
{content.list.map((text, index) => ( {content.List.split("\n").map((text, index) => (
<li className="whitespace-pre-wrap" key={index}> <li className="whitespace-pre-wrap" key={index}>
{text[language]} {text}
</li> </li>
))} ))}
</ul> </ul>

View File

@@ -1,6 +1,7 @@
import Navbar from "@/components/Navbar"; import Navbar from "@/components/Navbar";
import clsx from "clsx"; import clsx from "clsx";
import Title from "@/components/Title"; import Title from "@/components/Title";
import * as BsIcon from "react-icons/bs";
import { import {
BsBook, BsBook,
BsBlockquoteLeft, BsBlockquoteLeft,
@@ -13,11 +14,12 @@ import {
BsFileBarGraph, BsFileBarGraph,
BsBank, BsBank,
} from "react-icons/bs"; } from "react-icons/bs";
import translation from "@/translation/services.json";
import Footer from "@/components/Footer"; import Footer from "@/components/Footer";
import ServicesPage from "@/types/cms/services";
interface Props { interface Props {
language: "en" | "ar"; language: "en" | "ar";
data: ServicesPage;
} }
interface SectionStruct { interface SectionStruct {
@@ -31,84 +33,33 @@ interface SectionStruct {
}[]; }[];
} }
export default function About({language}: Props) { export default function Services({language, data}: Props) {
const struct = [ const struct: SectionStruct[] = [
{ ...data.ModuleEvaluation.map((module, index) => ({
id: "english_writing_evaluation", id: index.toString(),
title: translation.english_writing_evaluation.title[language], description: module.Text,
description: translation.english_writing_evaluation.description[language], title: module.Title,
bullets: [ bullets: [
{ {
title: translation.english_writing_evaluation.evaluation[language], title: module.Evaluation,
values: translation.english_writing_evaluation.evaluation_values[language], values: module.EvaluationValues.split("\n"),
icon: BsBlockquoteLeft, icon: BsIcon[module.EvaluationIcon as keyof typeof BsIcon],
}, },
{ {
title: translation.english_writing_evaluation.acquire[language], title: module.Acquire,
values: translation.english_writing_evaluation.acquire_values[language], values: module.AcquireValues.split("\n"),
icon: BsFillPencilFill, icon: BsIcon[module.AcquireIcon as keyof typeof BsIcon],
}, },
], ],
}, })),
{
id: "speaking_practice_evaluation",
title: translation.speaking_practice_evaluation.title[language],
description: translation.speaking_practice_evaluation.description[language],
bullets: [
{
title: translation.speaking_practice_evaluation.evaluation[language],
values: translation.speaking_practice_evaluation.evaluation_values[language],
icon: BsMic,
},
{
title: translation.speaking_practice_evaluation.acquire[language],
values: translation.speaking_practice_evaluation.acquire_values[language],
icon: BsBook,
},
],
},
{
id: "reading_and_listening",
title: translation.reading_and_listening.title[language],
description: translation.reading_and_listening.description[language],
bullets: [
{
title: translation.reading_and_listening.evaluation[language],
values: translation.reading_and_listening.evaluation_values[language],
icon: BsSoundwave,
},
{
title: translation.reading_and_listening.acquire[language],
values: translation.reading_and_listening.acquire_values[language],
icon: BsBookmarkStar,
},
],
},
{
id: "practice_tests",
title: translation.practice_tests.title[language],
description: translation.practice_tests.description[language],
bullets: [
{
title: translation.practice_tests.evaluation[language],
values: translation.practice_tests.evaluation_values[language],
icon: BsCheck2Circle,
},
{
title: translation.practice_tests.acquire[language],
values: translation.practice_tests.acquire_values[language],
icon: BsEarbuds,
},
],
},
{ {
id: "progress_tracking", id: "progress_tracking",
title: translation.progress_tracking.title[language], title: data.ProgressTracking.Title,
description: translation.progress_tracking.description[language], description: data.ProgressTracking.Text,
bullets: [ bullets: [
{ {
title: translation.progress_tracking.advantages[language], title: data.ProgressTracking.Advantages,
values: translation.progress_tracking.advantages_values[language], values: data.ProgressTracking.AdvantageValues.split("\n"),
icon: BsFileBarGraph, icon: BsFileBarGraph,
}, },
], ],
@@ -118,20 +69,20 @@ export default function About({language}: Props) {
const final_struct = [ const final_struct = [
{ {
id: "unified_english_level_test", id: "unified_english_level_test",
title: translation.unified_english_level_test.title[language], title: data.UnifiedEnglishLevelTest.Title,
description: translation.unified_english_level_test.description[language], description: data.UnifiedEnglishLevelTest.Text,
bullets: [ bullets: [
{ {
title: translation.unified_english_level_test.advantages[language], title: data.UnifiedEnglishLevelTest.Advantages,
values: translation.unified_english_level_test.advantages_values[language], values: data.UnifiedEnglishLevelTest.AdvantageValues.split("\n"),
icon: BsBank, icon: BsBank,
}, },
], ],
}, },
{ {
id: "customized_packages", id: "customized_packages",
title: translation.customized_packages.title[language], title: data.CustomizedPackages.Title,
description: translation.customized_packages.description[language], description: data.CustomizedPackages.Text,
bullets: [], bullets: [],
}, },
]; ];
@@ -174,13 +125,13 @@ export default function About({language}: Props) {
<Navbar currentPage="/services" language={language} /> <Navbar currentPage="/services" language={language} />
<section className="w-full bg-mti-purple text-white text-center p-8 md:p-16"> <section className="w-full bg-mti-purple text-white text-center p-8 md:p-16">
<div className="w-full h-full flex flex-col items-center justify-center"> <div className="w-full h-full flex flex-col items-center justify-center">
<Title>{translation.services[language]}</Title> <Title>{data.Title}</Title>
</div> </div>
</section> </section>
{renderStruct(struct, (index: number) => `bg-${index % 2 ? "mti-gray-seasalt" : "white"}`)} {renderStruct(struct, (index: number) => `bg-${index % 2 ? "mti-gray-seasalt" : "white"}`)}
<section className="w-full bg-mti-purple text-white text-center p-8 md:p-16"> <section className="w-full bg-mti-purple text-white text-center p-8 md:p-16">
<div className="w-full h-full flex flex-col items-center justify-center"> <div className="w-full h-full flex flex-col items-center justify-center">
<Title className="max-w-fit">{translation.corporate_educational_institutions[language]}</Title> <Title className="max-w-fit">{data.CorporateEducationalInstitutions}</Title>
</div> </div>
</section> </section>
{renderStruct(final_struct, (index: number) => `bg-${index % 2 ? "white" : "mti-gray-seasalt"}`)} {renderStruct(final_struct, (index: number) => `bg-${index % 2 ? "white" : "mti-gray-seasalt"}`)}

View File

@@ -2,32 +2,23 @@
import Footer from "@/components/Footer"; import Footer from "@/components/Footer";
import Navbar from "@/components/Navbar"; import Navbar from "@/components/Navbar";
import Title from "@/components/Title"; import Title from "@/components/Title";
import translation from "@/translation/terms.json";
import clsx from "clsx"; import clsx from "clsx";
import React from "react"; import React from "react";
import * as BsIcon from "react-icons/bs"; import TermsAndConditionsPage from "@/types/cms/termsConditions";
import {IconType} from "react-icons";
interface Props { interface Props {
language: "en" | "ar"; language: "en" | "ar";
data: TermsAndConditionsPage;
} }
type ContentKey = keyof typeof translation.content; export default function Terms({language, data}: Props) {
type Translation = {ar: string; en: string};
interface Content {
title: Translation;
text: Translation;
list?: Translation[];
}
export default function Terms({language}: Props) {
return ( return (
<main className="h-screen w-full bg-white text-mti-black flex flex-col" dir={language === "ar" ? "rtl" : "ltr"}> <main className="h-screen w-full bg-white text-mti-black flex flex-col" dir={language === "ar" ? "rtl" : "ltr"}>
<Navbar currentPage="/terms" language={language} /> <Navbar currentPage="/terms" language={language} />
<section className="w-full bg-mti-purple text-white text-center p-8 md:p-16"> <section className="w-full bg-mti-purple text-white text-center p-8 md:p-16">
<div className="w-full h-full flex flex-col items-center justify-center"> <div className="w-full h-full flex flex-col items-center justify-center">
<Title>{translation.title[language]}</Title> <Title>{data.Title}</Title>
</div> </div>
</section> </section>
@@ -37,17 +28,17 @@ export default function Terms({language}: Props) {
"w-full h-fit flex flex-col gap-8 p-8 md:p-20 container mx-auto", "w-full h-fit flex flex-col gap-8 p-8 md:p-20 container mx-auto",
language === "ar" ? "text-right" : "text-left", language === "ar" ? "text-right" : "text-left",
)}> )}>
{Object.keys(translation.content).map((key) => { {data.Content.map((content, index) => {
const content = translation.content[key as ContentKey] as Content;
return ( return (
<span className="flex flex-col gap-1" key={key} id={key}> <span className="flex flex-col gap-1" key={index} id={index.toString()}>
<h2 className="font-semibold text-lg text-mti-purple-light">{content.title[language]}</h2> {content.Title && <h2 className="font-semibold text-lg text-mti-purple-light">{content.Title}</h2>}
<p className="whitespace-pre-wrap">{content.text[language]}</p> {content.Text && <p className="whitespace-pre-wrap">{content.Text}</p>}
{content.list && ( {content.List && (
<ul className="list-disc pl-8"> <ul className="list-disc pl-8">
{content.list.map((text, index) => ( {content.List.split("\n").map((text, index) => (
<li key={index}>{text[language]}</li> <li className="whitespace-pre-wrap" key={index}>
{text}
</li>
))} ))}
</ul> </ul>
)} )}

View File

@@ -1,7 +1,10 @@
import {TitleWithText} from "./common";
export default interface FooterSection { export default interface FooterSection {
Navigation: Navigation; Navigation: Navigation;
Services: Services; Services: Services;
About: About; About: About;
GetInTouch: TitleWithText;
Copyright: string; Copyright: string;
} }

View File

@@ -1,4 +1,4 @@
import {TitleWithTagAndText, TitleWithText} from "./common"; import {TagTitle, TitleWithTagAndText, TitleWithText} from "./common";
export default interface HomePage { export default interface HomePage {
GetStartedButton: string; GetStartedButton: string;
@@ -19,6 +19,7 @@ interface Modules {
Speaking: TitleWithText; Speaking: TitleWithText;
} }
interface Interested extends TitleWithTagAndText { interface Interested extends TagTitle {
WhatsAppContact: string; WhatsAppContact: string;
ContactUs: string;
} }

View File

@@ -3,7 +3,7 @@ import {TitleWithText} from "./common";
export default interface ServicesPage { export default interface ServicesPage {
Title: string; Title: string;
ModuleEvaluation: ModuleEvaluation[]; ModuleEvaluation: ModuleEvaluation[];
UnifiedEnglishLevelTest: ModuleEvaluation[]; UnifiedEnglishLevelTest: ProgressTracking;
ProgressTracking: ProgressTracking; ProgressTracking: ProgressTracking;
CorporateEducationalInstitutions: string; CorporateEducationalInstitutions: string;
CustomizedPackages: TitleWithText; CustomizedPackages: TitleWithText;
@@ -14,8 +14,10 @@ interface ModuleEvaluation {
Text: string; Text: string;
Evaluation: string; Evaluation: string;
EvaluationValues: string; EvaluationValues: string;
EvaluationIcon: string;
Acquire: string; Acquire: string;
AcquireValues: string; AcquireValues: string;
AcquireIcon: string;
} }
interface ProgressTracking { interface ProgressTracking {