Files
school_compare/nextjs-app/app/page.tsx
Tudor ff7f5487e6
Some checks failed
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 1m26s
Build and Push Docker Images / Build Frontend (Next.js) (push) Failing after 1m48s
Build and Push Docker Images / Trigger Portainer Update (push) Has been skipped
Complete Next.js migration with SSR and Docker deployment
- Migrate from vanilla JavaScript SPA to Next.js 16 with App Router
- Add server-side rendering for all pages (Home, Compare, Rankings)
- Create individual school pages with dynamic routing (/school/[urn])
- Implement Chart.js and Leaflet map integrations
- Add comprehensive SEO with sitemap, robots.txt, and JSON-LD
- Set up Docker multi-service architecture (PostgreSQL, FastAPI, Next.js)
- Update CI/CD pipeline to build both backend and frontend images
- Fix Dockerfile to include devDependencies for TypeScript compilation
- Add Jest testing configuration
- Implement performance optimizations (code splitting, caching)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 20:34:35 +00:00

54 lines
1.3 KiB
TypeScript

/**
* Home Page (SSR)
* Main landing page with school search and browsing
*/
import { fetchSchools, fetchFilters } from '@/lib/api';
import { HomeView } from '@/components/HomeView';
interface HomePageProps {
searchParams: {
search?: string;
local_authority?: string;
school_type?: string;
page?: string;
postcode?: string;
radius?: string;
};
}
export const metadata = {
title: 'Home',
description: 'Search and compare primary school KS2 performance across England',
};
// Force dynamic rendering (no static generation at build time)
export const dynamic = 'force-dynamic';
export default async function HomePage({ searchParams }: HomePageProps) {
// Parse search params
const page = parseInt(searchParams.page || '1');
const radius = searchParams.radius ? parseInt(searchParams.radius) : undefined;
// Fetch data on server
const [schoolsData, filtersData] = await Promise.all([
fetchSchools({
search: searchParams.search,
local_authority: searchParams.local_authority,
school_type: searchParams.school_type,
postcode: searchParams.postcode,
radius,
page,
page_size: 50,
}),
fetchFilters(),
]);
return (
<HomeView
initialSchools={schoolsData}
filters={filtersData.filters}
/>
);
}