improvements
This commit is contained in:
22
pages/api/departures.ts
Normal file
22
pages/api/departures.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { createRideBusClient, parseRequest, RideBusError } from '@/lib/ridebus';
|
||||
|
||||
const ridebus = createRideBusClient();
|
||||
|
||||
export default async function departures(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse
|
||||
) {
|
||||
res.setHeader('Cache-Control', 'no-store');
|
||||
if (req.method !== 'GET') {
|
||||
res.setHeader('Allow', 'GET');
|
||||
return res.status(405).json({ error: 'method_not_allowed' });
|
||||
}
|
||||
try {
|
||||
return res.status(200).json(await ridebus.get(parseRequest(req.query)));
|
||||
} catch (error) {
|
||||
const status = error instanceof RideBusError ? error.status : 502;
|
||||
// Never forward upstream responses or configuration details to the browser.
|
||||
return res.status(status).json({ error: 'departures_unavailable' });
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import { locales } from '@/modules/contribute/locales';
|
||||
import { ShareCard } from '@/modules/contribute/shareCard';
|
||||
import { Fragment } from 'react';
|
||||
import { Header } from '@/modules/contribute/header';
|
||||
import { AddCityCard } from '@/modules/contribute/addCityCard/addCityCard';
|
||||
|
||||
export default function ContributePage() {
|
||||
const router = useRouter();
|
||||
@@ -25,6 +26,7 @@ export default function ContributePage() {
|
||||
</Head>
|
||||
<Header />
|
||||
<main className={styles.main}>
|
||||
<AddCityCard />
|
||||
<ShareCard />
|
||||
<div className={styles.stores}>
|
||||
<Card
|
||||
@@ -51,4 +53,4 @@ export default function ContributePage() {
|
||||
<Footer />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,15 @@ import { GooglePlayButton } from '@/components/googlePlayButton';
|
||||
import { ContributeCard } from '@/modules/home/contributeCard';
|
||||
import Header from '@/modules/home/header';
|
||||
import styles from '@/modules/home/home.module.scss';
|
||||
import { HowItsWorkCard } from '@/modules/home/howItsWorkCard';
|
||||
import { DeparturesCard } from '@/modules/home/departuresCard/departuresCard';
|
||||
import { FaqCard } from '@/modules/home/faqCard/faqCard';
|
||||
import { FreeCard } from '@/modules/home/freeCard';
|
||||
import { CitiesCard } from '@/modules/home/citiesCard';
|
||||
import { ChangesCard } from '@/modules/home/changesCard/changesCard';
|
||||
import { DownloadCard } from '@/modules/home/downloadCard/downloadCard';
|
||||
import { ReportCard } from '@/modules/home/reportCard/reportCard';
|
||||
import { FeaturesCards } from '@/modules/home/featuresCards/featuresCards';
|
||||
import { LegalCards } from '@/modules/home/legalCards/legalCards';
|
||||
import { locales } from '@/modules/home/locales';
|
||||
import useLocale from '@/utils/useLocale';
|
||||
import Head from 'next/head';
|
||||
@@ -24,10 +30,19 @@ export default function HomePage() {
|
||||
</Head>
|
||||
<Header />
|
||||
<main className={styles.main}>
|
||||
<DownloadCard />
|
||||
<div className={styles.liveCardsRow}>
|
||||
<DeparturesCard />
|
||||
<div className={styles.liveAside}>
|
||||
<ChangesCard />
|
||||
<ReportCard />
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.cardsRow}>
|
||||
<FreeCard />
|
||||
<CitiesCard />
|
||||
</div>
|
||||
<FeaturesCards />
|
||||
<div className={styles.cardsRow}>
|
||||
<div className={styles.storesBlock}>
|
||||
<GooglePlayButton className={styles.googlePlayButton} />
|
||||
@@ -40,6 +55,8 @@ export default function HomePage() {
|
||||
</div>
|
||||
<ContributeCard />
|
||||
</div>
|
||||
<FaqCard />
|
||||
<LegalCards />
|
||||
</main>
|
||||
<Footer />
|
||||
</Fragment>
|
||||
|
||||
5
pages/privacy.tsx
Normal file
5
pages/privacy.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { LegalPage } from '@/modules/legal/legalPage';
|
||||
|
||||
export default function PrivacyPage() {
|
||||
return <LegalPage documentId="privacy" />;
|
||||
}
|
||||
5
pages/terms.tsx
Normal file
5
pages/terms.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { LegalPage } from '@/modules/legal/legalPage';
|
||||
|
||||
export default function TermsPage() {
|
||||
return <LegalPage documentId="terms" />;
|
||||
}
|
||||
Reference in New Issue
Block a user