Prepared the website to work with the CMS
This commit is contained in:
5
.env
5
.env
@@ -3,4 +3,7 @@ STRIPE_KEY=
|
|||||||
STRIPE_SECRET=
|
STRIPE_SECRET=
|
||||||
|
|
||||||
WEBHOOK_URL=
|
WEBHOOK_URL=
|
||||||
NEXT_PUBLIC_APP_URL=
|
NEXT_PUBLIC_APP_URL=
|
||||||
|
|
||||||
|
STRAPI_TOKEN=
|
||||||
|
STRAPI_URL=
|
||||||
23
src/cms/index.ts
Normal file
23
src/cms/index.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
interface StrapiResponse<T> {
|
||||||
|
data: {
|
||||||
|
id: number;
|
||||||
|
attributes: {
|
||||||
|
createdAt: Date;
|
||||||
|
updatedAt: Date;
|
||||||
|
publishedAt: Date;
|
||||||
|
locale: "en" | "ar";
|
||||||
|
} & T;
|
||||||
|
};
|
||||||
|
meta: object;
|
||||||
|
}
|
||||||
|
|
||||||
|
type Result<T> = {data: StrapiResponse<T>; isError: boolean};
|
||||||
|
|
||||||
|
export async function getData<T>(page: string, locale: "ar" | "en"): Promise<Result<T>> {
|
||||||
|
const request = await axios.get<StrapiResponse<T>>(`${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};
|
||||||
|
}
|
||||||
40
src/types/cms/about.ts
Normal file
40
src/types/cms/about.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
15
src/types/cms/common.ts
Normal file
15
src/types/cms/common.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
16
src/types/cms/contact.ts
Normal file
16
src/types/cms/contact.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
5
src/types/cms/countryManagerContacts.ts
Normal file
5
src/types/cms/countryManagerContacts.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export default interface CountryManagerContactsPage {
|
||||||
|
Name: string;
|
||||||
|
Number: string;
|
||||||
|
Email: string;
|
||||||
|
}
|
||||||
27
src/types/cms/footer.ts
Normal file
27
src/types/cms/footer.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
10
src/types/cms/history.ts
Normal file
10
src/types/cms/history.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
export default interface HistoryPage {
|
||||||
|
Title: string;
|
||||||
|
Events: Event[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Event {
|
||||||
|
Label: string;
|
||||||
|
Date: string;
|
||||||
|
Icon: string;
|
||||||
|
}
|
||||||
24
src/types/cms/home.ts
Normal file
24
src/types/cms/home.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
11
src/types/cms/navbar.ts
Normal file
11
src/types/cms/navbar.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
17
src/types/cms/price.ts
Normal file
17
src/types/cms/price.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
8
src/types/cms/privacyPolicy.ts
Normal file
8
src/types/cms/privacyPolicy.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import {TitleWithTextAndList} from "./common";
|
||||||
|
|
||||||
|
export default interface PrivacyPolicyPage {
|
||||||
|
Title: string;
|
||||||
|
LastUpdate: string;
|
||||||
|
General: string;
|
||||||
|
Content: TitleWithTextAndList[];
|
||||||
|
}
|
||||||
26
src/types/cms/services.ts
Normal file
26
src/types/cms/services.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
7
src/types/cms/termsConditions.ts
Normal file
7
src/types/cms/termsConditions.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import {TitleWithTextAndList} from "./common";
|
||||||
|
|
||||||
|
export default interface TermsAndConditionsPage {
|
||||||
|
Title: string;
|
||||||
|
LastUpdate: string;
|
||||||
|
Content: TitleWithTextAndList[];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user