diff --git a/.env b/.env index 2810012..d184529 100644 --- a/.env +++ b/.env @@ -3,4 +3,7 @@ STRIPE_KEY= STRIPE_SECRET= WEBHOOK_URL= -NEXT_PUBLIC_APP_URL= \ No newline at end of file +NEXT_PUBLIC_APP_URL= + +STRAPI_TOKEN= +STRAPI_URL= \ No newline at end of file diff --git a/src/cms/index.ts b/src/cms/index.ts new file mode 100644 index 0000000..6ed8ee9 --- /dev/null +++ b/src/cms/index.ts @@ -0,0 +1,23 @@ +import axios from "axios"; + +interface StrapiResponse { + data: { + id: number; + attributes: { + createdAt: Date; + updatedAt: Date; + publishedAt: Date; + locale: "en" | "ar"; + } & T; + }; + meta: object; +} + +type Result = {data: StrapiResponse; isError: boolean}; + +export async function getData(page: string, locale: "ar" | "en"): Promise> { + const request = await axios.get>(`${process.env.STRAPI_URL}/api/${page}/?populate=deep&locale=${locale}`, { + headers: {Authorization: `Bearer ${process.env.STRAPI_TOKEN}`}, + }); + return {data: request.data, isError: request.status !== 200}; +} diff --git a/src/types/cms/about.ts b/src/types/cms/about.ts new file mode 100644 index 0000000..195e302 --- /dev/null +++ b/src/types/cms/about.ts @@ -0,0 +1,40 @@ +import {TagTitle, TitleWithText} from "./common"; + +export default interface AboutPage { + TagTitle: TagTitle; + AboutSection: TitleWithText; + MissionVisionValuesSection: MissionVisionValuesSection; + CEOMessage: CEOMessage; + Capabilities: Capabilities; + Expertise: Expertise; +} + +interface MissionVisionValuesSection { + Mission: string; + Vision: string; + Values: string; +} + +interface CEOMessage extends TitleWithText { + Name: string; +} + +interface Capabilities { + Title: string; + Intro: string; + Analytics: TitleWithText; + Predictive: TitleWithText; + NLP: TitleWithText; + Engine: TitleWithText; + ContinuousLearning: TitleWithText; +} + +interface Expertise { + Title: string; + Intro: string; + Language: TitleWithText; + IELTS: TitleWithText; + Alignment: TitleWithText; + Native: TitleWithText; + KnowledgeExperience: TitleWithText; +} diff --git a/src/types/cms/common.ts b/src/types/cms/common.ts new file mode 100644 index 0000000..0035d14 --- /dev/null +++ b/src/types/cms/common.ts @@ -0,0 +1,15 @@ +export interface TagTitle { + Title: string; + Tag: string; +} + +export interface TitleWithText { + Title: string; + Text: string; +} + +export type TitleWithTagAndText = TagTitle & TitleWithText; + +export interface TitleWithTextAndList extends TitleWithText { + List: string; +} diff --git a/src/types/cms/contact.ts b/src/types/cms/contact.ts new file mode 100644 index 0000000..ee53e23 --- /dev/null +++ b/src/types/cms/contact.ts @@ -0,0 +1,16 @@ +export default interface ContactPage { + Title: string; + Name: string; + Email: string; + Subject: string; + Submit: string; + SelectType: string; + Description: string; + Feedback: string; + Bug: string; + Help: string; + FieldRequired: string; + InvalidEmail: string; + TicketSuccess: string; + TicketError: string; +} diff --git a/src/types/cms/countryManagerContacts.ts b/src/types/cms/countryManagerContacts.ts new file mode 100644 index 0000000..3eab229 --- /dev/null +++ b/src/types/cms/countryManagerContacts.ts @@ -0,0 +1,5 @@ +export default interface CountryManagerContactsPage { + Name: string; + Number: string; + Email: string; +} diff --git a/src/types/cms/footer.ts b/src/types/cms/footer.ts new file mode 100644 index 0000000..7af61f2 --- /dev/null +++ b/src/types/cms/footer.ts @@ -0,0 +1,27 @@ +export default interface FooterSection { + Navigation: Navigation; + Services: Services; + About: About; + Copyright: string; +} + +interface Navigation { + Text: string; + WhyUs: string; + Capabilities: string; + Expertise: string; + History: string; + Contact: string; +} + +interface Services { + Text: string; + EnCoachBenefits: string; + StudentTestimonials: string; +} + +interface About { + Text: string; + Terms: string; + PrivacyPolicy: string; +} diff --git a/src/types/cms/history.ts b/src/types/cms/history.ts new file mode 100644 index 0000000..94fc853 --- /dev/null +++ b/src/types/cms/history.ts @@ -0,0 +1,10 @@ +export default interface HistoryPage { + Title: string; + Events: Event[]; +} + +interface Event { + Label: string; + Date: string; + Icon: string; +} diff --git a/src/types/cms/home.ts b/src/types/cms/home.ts new file mode 100644 index 0000000..b5ae479 --- /dev/null +++ b/src/types/cms/home.ts @@ -0,0 +1,24 @@ +import {TitleWithTagAndText, TitleWithText} from "./common"; + +export default interface HomePage { + GetStartedButton: string; + Modules: Modules; + LearnAI: TitleWithTagAndText; + LearnMore: string; + EnCoachBenefits: TitleWithTagAndText; + Interested: Interested; + CEOMessage: TitleWithTagAndText; + OurPartners: string; + Accreditation: string; +} + +interface Modules { + Reading: TitleWithText; + Listening: TitleWithText; + Writing: TitleWithText; + Speaking: TitleWithText; +} + +interface Interested extends TitleWithTagAndText { + WhatsAppContact: string; +} diff --git a/src/types/cms/navbar.ts b/src/types/cms/navbar.ts new file mode 100644 index 0000000..1c6f59c --- /dev/null +++ b/src/types/cms/navbar.ts @@ -0,0 +1,11 @@ +export default interface NavBarSection { + Home: string; + Services: string; + Price: string; + About: string; + History: string; + Contact: string; + Platform: string; + Join: string; + CountryManager: string; +} diff --git a/src/types/cms/price.ts b/src/types/cms/price.ts new file mode 100644 index 0000000..b645fa1 --- /dev/null +++ b/src/types/cms/price.ts @@ -0,0 +1,17 @@ +export default interface PricePage { + SignUp: string; + Title: string; + PackageIncludes: string; + PackageIncludesA: string; + PackageIncludesB: string; + PackageIncludesC: string; + Days: SingularPlural; + Weeks: SingularPlural; + Months: SingularPlural; + EnCoach: string; +} + +interface SingularPlural { + Singular: string; + Plural: string; +} diff --git a/src/types/cms/privacyPolicy.ts b/src/types/cms/privacyPolicy.ts new file mode 100644 index 0000000..21457f5 --- /dev/null +++ b/src/types/cms/privacyPolicy.ts @@ -0,0 +1,8 @@ +import {TitleWithTextAndList} from "./common"; + +export default interface PrivacyPolicyPage { + Title: string; + LastUpdate: string; + General: string; + Content: TitleWithTextAndList[]; +} diff --git a/src/types/cms/services.ts b/src/types/cms/services.ts new file mode 100644 index 0000000..e9ad8d8 --- /dev/null +++ b/src/types/cms/services.ts @@ -0,0 +1,26 @@ +import {TitleWithText} from "./common"; + +export default interface ServicesPage { + Title: string; + ModuleEvaluation: ModuleEvaluation[]; + UnifiedEnglishLevelTest: ModuleEvaluation[]; + ProgressTracking: ProgressTracking; + CorporateEducationalInstitutions: string; + CustomizedPackages: TitleWithText; +} + +interface ModuleEvaluation { + Title: string; + Text: string; + Evaluation: string; + EvaluationValues: string; + Acquire: string; + AcquireValues: string; +} + +interface ProgressTracking { + Title: string; + Text: string; + Advantages: string; + AdvantageValues: string; +} diff --git a/src/types/cms/termsConditions.ts b/src/types/cms/termsConditions.ts new file mode 100644 index 0000000..d8de72e --- /dev/null +++ b/src/types/cms/termsConditions.ts @@ -0,0 +1,7 @@ +import {TitleWithTextAndList} from "./common"; + +export default interface TermsAndConditionsPage { + Title: string; + LastUpdate: string; + Content: TitleWithTextAndList[]; +}