diff --git a/api/aboutApi.ts b/api/aboutApi.ts new file mode 100644 index 0000000..3de4d1c --- /dev/null +++ b/api/aboutApi.ts @@ -0,0 +1,35 @@ +/** + * About API Functions + * Fetch about us data from external API + */ + +const getApiUrl = (): string => { + return process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001"; +}; + +import { AboutData } from "../app/about/types"; + +export const aboutApi = { + // Get about us data + getAbout: async (): Promise => { + try { + const apiUrl = getApiUrl(); + const response = await fetch(`${apiUrl}/api/about`, { + cache: 'no-store', + headers: { + 'Cache-Control': 'no-cache', + 'Pragma': 'no-cache' + } + }); + if (!response.ok) { + console.error(`HTTP error! status: ${response.status}`); + return null; + } + return await response.json(); + } catch (error) { + console.error("Error fetching about data:", error); + return null; + } + }, +}; + diff --git a/app/about/about.json b/app/about/about.json deleted file mode 100644 index fbfdab5..0000000 --- a/app/about/about.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "hero": { - "title": "About Us", - "subtitle": "Global Education Simplified", - "breadcrumb": ["Home", "About Us"], - "backgroundImage": "/assets/img/inner-page/breadcrumb.jpg" - }, - "intro": { - "subheading": "Company Intro", - "heading": "Building Pathways to Your Immigration Success", - "description": "We provide expert guidance, personalized solutions, and transparent processes to help you achieve your immigration goals. Our dedicated team ensures a smooth journey, building pathways to your international success.", - "image": "/assets/img/inner-page/intro.jpg" - }, - "mission": { - "subheading": "About Our Consultancy", - "heading": "Turning Study Abroad Dreams Into Reality", - "description": "We guide students with expert visa consulting, ensuring a smooth process from application to approval, turning study abroad aspirations into life-changing opportunities for a brighter future.", - "images": { - "main": "/assets/img/home-1/about/about-1.jpg", - "secondary": "/assets/img/home-1/about/about-02.jpg", - "bgShape": "/assets/img/home-1/about/Vector.png", - "planeShape": "/assets/img/home-1/about/plane.png", - "topShape": "/assets/img/home-1/about/shape.png", - "globeShape": "/assets/img/home-1/about/globe.png" - }, - "items": [ - { - "icon": "/assets/img/home-1/icon/01.svg", - "label": "Global Reach", - "description": "Expanding Opportunities Worldwide" - }, - { - "icon": "/assets/img/home-1/icon/01.svg", - "label": "Global Reach", - "description": "Expanding Opportunities Worldwide" - } - ], - "features": [ - "Fastest Visa form processing with skilled immigration agents", - "Partnership with International Educational Institutions" - ], - "ctaButton": { - "label": "Get Started", - "href": "/about" - } - }, - "features": { - "backgroundImage": "/assets/img/home-2/feature/bg-shape.png", - "subheading": "Your Travel Made Easy", - "heading": "Smooth Visa Journey Guaranteed", - "description": "We provide expert guidance for every visa application, ensuring smooth processing, personalized support, and reliable assistance", - "image": "/assets/img/home-2/feature/02.png", - "items": [ - { - "icon": "/assets/img/home-2/icon/01.png", - "title": "Expert Consultants", - "description": "Skilled and knowledgeable visa advisors. Skilled and knowledgeable visa advisors." - }, - { - "icon": "/assets/img/home-2/icon/01.png", - "title": "Personalized Support", - "description": "Skilled and knowledgeable visa advisors. Skilled and knowledgeable visa advisors." - }, - { - "icon": "/assets/img/home-2/icon/01.png", - "title": "Transparent Process", - "description": "Skilled and knowledgeable visa advisors. Skilled and knowledgeable visa advisors." - } - ], - "ctaButton": { - "label": "Get Started Today", - "href": "/contact" - } - }, - "news": { - "subheading": "Visa Tips & Guides", - "heading": "Latest Insights & Updates", - "ctaButton": { - "label": "view all articles", - "href": "/blog" - }, - "items": [ - { - "title": "Step-by-Step Guide to Applying for a Student Visa", - "category": "Student Visa", - "date": "20 August ,2025", - "comments": 8, - "author": { - "name": "Sohel", - "avatar": "/assets/img/home-1/news/client.png" - }, - "link": "/blog/step-by-step-guide-student-visa", - "thumbnail": "/assets/img/home-1/news/news-1.jpg" - }, - { - "title": "Tips to Prepare Financial Documents for Visa Approval", - "category": "IELTS / TOEFL", - "date": "20 August ,2025", - "comments": 8, - "author": { - "name": "Sohel", - "avatar": "/assets/img/home-1/news/client.png" - }, - "link": "/blog/financial-documents-visa-approval", - "thumbnail": "/assets/img/home-1/news/news-2.jpg" - }, - { - "title": "Post-Arrival Guide What Every Student Should Know", - "category": "Study Abroad", - "date": "20 August ,2025", - "comments": 8, - "author": { - "name": "Sohel", - "avatar": "/assets/img/home-1/news/client.png" - }, - "link": "/blog/post-arrival-guide-students", - "thumbnail": "/assets/img/home-1/news/news-3.jpg" - } - ] - } -} diff --git a/app/about/page.tsx b/app/about/page.tsx index 0f7f075..8730cde 100644 --- a/app/about/page.tsx +++ b/app/about/page.tsx @@ -1,14 +1,21 @@ import { AboutHero, AboutIntro, AboutMission, AboutFeatures, AboutNews } from "../components/about"; -import aboutData from "./about.json"; +import { aboutApi } from "../../api/aboutApi"; + +export default async function AboutPage() { + const data = await aboutApi.getAbout(); + + if (!data) { + return null; + } -export default function AboutPage() { return ( <> - - - - - + + + + + ); } + diff --git a/app/about/types.ts b/app/about/types.ts index 8d4cc1a..2f863dd 100644 --- a/app/about/types.ts +++ b/app/about/types.ts @@ -1,7 +1,6 @@ export interface AboutData { hero: { title: string; - subtitle: string; breadcrumb: string[]; backgroundImage: string; }; diff --git a/app/components/about/AboutHero.tsx b/app/components/about/AboutHero.tsx index b18f21a..9ab631c 100644 --- a/app/components/about/AboutHero.tsx +++ b/app/components/about/AboutHero.tsx @@ -14,20 +14,22 @@ const AboutHero = ({ data }: AboutHeroProps) => {

{data.title}

-
    - {data.breadcrumb.map((item, index) => ( -
  • - {index === data.breadcrumb.length - 1 ? ( - item - ) : ( - <> - {item} - - - )} -
  • - ))} -
+ {Array.isArray(data.breadcrumb) && ( +
    + {data.breadcrumb.map((item, index) => ( +
  • + {index === data.breadcrumb.length - 1 ? ( + item + ) : ( + <> + {item} + + + )} +
  • + ))} +
+ )}