Skip to content
Merged
4 changes: 1 addition & 3 deletions client/app/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ body {
}

body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
font-family: "Arial", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
Expand Down
46 changes: 46 additions & 0 deletions client/app/hopitaux/[id]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import type { Metadata } from 'next';

type Props = {
params: Promise<{ id: string }>;
};

async function getHospitalName(id: string): Promise<string | null> {
const baseUrl = process.env.NEXT_PUBLIC_HOSPITALS_SINGLE_API_URL;

if (!baseUrl) {
console.error('NEXT_PUBLIC_HOSPITALS_SINGLE_API_URL manquant');
return null;
}

const apiUrl = `${baseUrl}&rows=1&q=recordid:${id}`;
const res = await fetch(apiUrl, { next: { revalidate: 3600 } });

if (!res.ok) return null;

const data = await res.json();
return data.records?.[0]?.fields?.name ?? null;
}

export async function generateMetadata(
props: Props
): Promise<Metadata> {
const params = await props.params;
const hospitalName = await getHospitalName(params.id);

return {
title: hospitalName
? `${hospitalName} – Urgences`
: `Détail de l'hôpital`,
description: hospitalName
? `Consultez les informations de l'hôpital ${hospitalName}.`
: `Consultez les détails de l'hôpital.`,
};
}

export default function HospitalLayout({
children,
}: {
children: React.ReactNode;
}) {
return <>{children}</>;
}
6 changes: 2 additions & 4 deletions client/app/hopitaux/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,8 @@ export default function HospitalDetailPage({ params }: { params: Promise<{ id: s
})()}

{!mockData && !accessibilityOptions && (
<div className="col-span-full text-center py-4">
<p className="text-gray-500 italic">
Les spécifications de cet établissement ne sont pas encore disponibles.
</p>
<div className="col-span-full flex items-center justify-center">
<NotFoundData message="Les spécifications de cet établissement ne sont pas encore disponibles." />
</div>
)}
</div>
Expand Down
14 changes: 14 additions & 0 deletions client/app/hopitaux/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Metadata } from 'next';

export const metadata: Metadata = {
title: 'Liste des hôpitaux',
description: 'Consultez la liste des hôpitaux avec services d\'urgence les plus proches de votre position.',
}

export default function HopitauxLayout({
children,
}: {
children: React.ReactNode
}) {
return <>{children}</>;
}
36 changes: 16 additions & 20 deletions client/app/hopitaux/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useState, useEffect, useMemo } from 'react';
import Header from '@/components/Header';
import HospitalList from './components/HospitalList';
import HospitalList from '@/components/hopitaux/HospitalList';
import SearchBar from '@/components/SearchBar';
import MultiSelectFilter from '@/components/MultiSelectFilter';
import Loading from '@/components/Loading';
Expand Down Expand Up @@ -128,26 +128,22 @@ export default function HopitauxPage() {
if (selectedSpecifications.length > 0) {
filtered = filtered.filter(hospital => {
return selectedSpecifications.every(spec => {
if (spec === 'fire_fighter') {
return hospital.mockData?.fire_fighter;
switch (spec) {
case 'fire_fighter':
return hospital.mockData?.fire_fighter;
case 'social_worker':
return hospital.mockData?.social_worker;
case 'wheelchairAccessibleEntrance':
return hospital.accessibilityOptions?.wheelchairAccessibleEntrance;
case 'wheelchairAccessibleParking':
return hospital.accessibilityOptions?.wheelchairAccessibleParking;
case 'wheelchairAccessibleRestroom':
return hospital.accessibilityOptions?.wheelchairAccessibleRestroom;
case 'wheelchairAccessibleSeating':
return hospital.accessibilityOptions?.wheelchairAccessibleSeating;
default:
return false;
}
if (spec === 'social_worker') {
return hospital.mockData?.social_worker;
}
if (spec === 'wheelchairAccessibleEntrance') {
return hospital.accessibilityOptions?.wheelchairAccessibleEntrance;
}
if (spec === 'wheelchairAccessibleParking') {
return hospital.accessibilityOptions?.wheelchairAccessibleParking;
}
if (spec === 'wheelchairAccessibleRestroom') {
return hospital.accessibilityOptions?.wheelchairAccessibleRestroom;
}
if (spec === 'wheelchairAccessibleSeating') {
return hospital.accessibilityOptions?.wheelchairAccessibleSeating;
}

return false;
});
});
}
Expand Down
7 changes: 5 additions & 2 deletions client/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import type { Metadata } from 'next'
import './globals.scss'
import { Metadata } from 'next';

export const metadata: Metadata = {
title: 'Quelles Urgences',
title: {
default: 'Quelles Urgences',
template: '%s | Quelles Urgences',
},
description: 'Application de gestion des urgences',
icons: {
icon: '/images/logo/logo-red.svg',
Expand Down
14 changes: 14 additions & 0 deletions client/app/map/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Metadata } from 'next';

export const metadata: Metadata = {
title: 'Carte des urgences',
description: 'Visualisez les hôpitaux avec services d\'urgence les plus proches de votre position.',
}

export default function MapLayout({
children,
}: {
children: React.ReactNode
}) {
return <>{children}</>;
}
3 changes: 1 addition & 2 deletions client/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Image from 'next/image'
import Link from 'next/link';
import Header from '@/components/Header'
import MapWrapper from '@/components/MapWrapper'
import FAQSection from '@/app/components/FAQSection'
import FAQSection from '@/components/home/FAQSection'

export default function Home() {
return (
Expand Down
Loading
Loading