diff --git a/src/templates/AgentContacts.tsx b/src/templates/AgentContacts.tsx index f0b12dd..e9c1224 100644 --- a/src/templates/AgentContacts.tsx +++ b/src/templates/AgentContacts.tsx @@ -1,68 +1,64 @@ import Footer from "@/components/Footer"; import Navbar from "@/components/Navbar"; import Title from "@/components/Title"; -import { Contact } from "@/types/contact"; +import {Contact} from "@/types/contact"; import translation from "@/translation/agentcontacts.json"; type Language = "en" | "ar"; interface Props { - country: string; - page: string; - language: Language; + country: string; + page: string; + language: Language; } async function getCountryManagers(country: string, language: Language = "en") { - const res = await fetch( - `${process.env.NEXT_PUBLIC_APP_URL}/api/users/agents/${country}?language=${language}` - ); + const res = await fetch(`https://platform.encoach.com/api/users/agents/${country}?language=${language}`); - if (!res.ok) { - throw new Error("Failed to fetch contacts"); - } + if (!res.ok) { + throw new Error("Failed to fetch contacts"); + } - return res.json(); + return res.json(); } export async function generateStaticParamsHelper(language: Language = "en") { - const contacts = (await fetch( - `${process.env.NEXT_PUBLIC_APP_URL}/api/users/agents?language=${language}` - ).then((res) => res.json())) as Contact[]; - return contacts.map(({ key }) => ({ - country: key.toLowerCase().replaceAll(" ", ""), - })); + const contacts = (await fetch(`https://platform.encoach.com/api/users/agents?language=${language}`).then((res) => res.json())) as Contact[]; + return contacts.map(({key}) => ({ + country: key.toLowerCase().replaceAll(" ", ""), + })); } -export async function AgentContacts({ language, page, country }: Props) { - const contact = (await getCountryManagers(country, language)) as Contact; +export async function AgentContacts({language, page, country}: Props) { + const contact = (await getCountryManagers(country, language)) as Contact; - return ( -
- + return ( +
+ -
-
- {`${contact.label} Contacts`} -
-
+
+
+ {`${contact.label} Contacts`} +
+
-
- {contact.entries.map((entry) => ( -
-

- {translation.name[language]}: - {entry.name} -

-

- {translation.number[language]}: - {entry.number} -

-

- {translation.email[language]}: - {entry.email} -

-
- ))} -
-
-
- ); +
+ {contact.entries.map((entry) => ( +
+

+ {translation.name[language]}: + {entry.name} +

+

+ {translation.number[language]}: + {entry.number} +

+

+ {translation.email[language]}: + {entry.email} +

+
+ ))} +
+
+ ); }