diff --git a/.env.local b/.env.local deleted file mode 100644 index 61b4d79..0000000 --- a/.env.local +++ /dev/null @@ -1 +0,0 @@ -# GA_MEASUREMENT_ID=UA-169820463-3 diff --git a/.gitignore b/.gitignore index 1f1d315..bc8c3c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store -.next -node_modules +/.next +/node_modules +/.env diff --git a/components/Itinerary/Itinerary.js b/components/Itinerary/Itinerary.js index bf20b6a..ad8bead 100644 --- a/components/Itinerary/Itinerary.js +++ b/components/Itinerary/Itinerary.js @@ -13,36 +13,52 @@ import { lines, } from './Itinerary.module.css'; -export default function Itinerary() { +export default function Itinerary({linkToEdit}) { const { query } = useRouter(); const { t, formatNumber } = useTranslation(); const { trip: { airports, distance, flightClass, passengers }, } = useTrip(); + + const WrappedAirportCard = (airport, key) => +
+ +
; + + const stats = + ; + return ( <>

{t('itinerary')}

- {airports.map((airport, index) => ( - + {linkToEdit + ? + <> + {airports.map((airport, index) => ( + + + {WrappedAirportCard(airport, index)} + + + ))} + -
- -
+ {stats}
- ))} - - - - - + + : <> + {airports.map(WrappedAirportCard)} + {stats} + + } ); } diff --git a/components/Payment/Payment.js b/components/Payment/Payment.js index eee08d2..dc798ef 100644 --- a/components/Payment/Payment.js +++ b/components/Payment/Payment.js @@ -1,6 +1,6 @@ import { useState } from 'react'; -import { useTrip, useTranslation } from '../../hooks'; +import { usePayment, useTrip, useTranslation } from '../../hooks'; import { Select } from '../Select'; @@ -8,61 +8,24 @@ import { wrapper, headline, amount, - select, button, } from './Payment.module.css'; -function usePayment() { - const { t, formatNumber } = useTranslation(); - const { - trip: { cost }, - } = useTrip(); - const [recipient, setRecipient] = useState('trees'); - const getUrl = () => { - const amount = formatNumber(cost, 2); - const language = t('lang'); - switch (recipient) { - case 'trees': - return `https://donorbox.org/trees-for-lure?amount=${amount}&language=${language}`; - case 'greenpeace': - return `https://www.greenpeace.de/spenden?betrag=${amount}`; - default: - throw new Error('unknown recipient'); - } - }; - return { - options: { - trees: t('donateTrees'), - greenpeace: t('donateToGreenpeace'), - }, - value: recipient, - onChange: setRecipient, - href: getUrl(), - }; -} export default function Payment() { const { t, formatNumber } = useTranslation(); const { trip: { cost }, } = useTrip(); - const { options, value, onChange, href } = usePayment(); + const { process } = usePayment(); + return (

{t('paymentHeadline')}

{formatNumber(cost, 2)} €

-