move Layout into _app.tsx

This commit is contained in:
Thomas Ruoff
2022-09-09 00:17:47 +02:00
committed by Thomas Ruoff
parent 7389289b81
commit 2fd3a47e72
12 changed files with 112 additions and 132 deletions

View File

@@ -1,5 +1,4 @@
import React, { useEffect, useState } from 'react'
import Layout from '../../../../components/layout'
import Input from '../../../../components/input'
import Select from '../../../../components/select'
import { Booking } from '../../../../db/booking'
@@ -115,14 +114,14 @@ function BookingBillPage({
setStoringInProgress(false)
}
const onAddAdditionalCost = function (
const onAddAdditionalCost = function(
event: React.MouseEvent<HTMLButtonElement>
) {
event.preventDefault()
setAdditionalCosts([...additionalCosts, { name: '', value: 0 }])
}
const onRemoveAdditionalCost = function (
const onRemoveAdditionalCost = function(
event: React.MouseEvent<HTMLButtonElement>,
index: number
) {
@@ -134,7 +133,7 @@ function BookingBillPage({
}
return (
<Layout>
<>
{booking && (
<form className="w-full" onSubmit={onSubmit}>
<div>
@@ -198,9 +197,8 @@ function BookingBillPage({
>
-
</button>
<label className="flabel inline">{`Kostenpunkt ${
index + 1
}`}</label>
<label className="flabel inline">{`Kostenpunkt ${index + 1
}`}</label>
</div>
<div className="ml-10 mb-3" key={`input{index}`}>
<Input
@@ -258,7 +256,7 @@ function BookingBillPage({
</button>
</form>
)}
</Layout>
</>
)
}

View File

@@ -1,7 +1,6 @@
import React, { useEffect, useState } from 'react'
import { useRouter } from 'next/router'
import Link from 'next/link'
import Layout from '../../../../components/layout'
import Calendar from '../../../../components/calendar'
import { getServerSideBooking } from '../../../../lib/getServerSideProps'
import { Booking } from '../../../../db/booking'
@@ -37,7 +36,7 @@ function ShowBookingAdmin({ booking: bookingProp }: { booking: Booking }) {
}
return (
<Layout>
<>
<h2 className="text-3xl">Buchung {booking.uuid}</h2>
<Calendar start={booking.startDate} end={booking.endDate} />
<div>
@@ -71,7 +70,7 @@ function ShowBookingAdmin({ booking: bookingProp }: { booking: Booking }) {
<a className="btn btn-gray">Rechnung</a>
</Link>
</div>
</Layout>
</>
)
}

View File

@@ -1,6 +1,5 @@
import React from 'react'
import BookingTable from '../../components/bookingTable'
import Layout from '../../components/layout'
import { getServerSideRecentBookings } from '../../lib/getServerSideProps'
@@ -9,20 +8,18 @@ export const getServerSideProps = getServerSideRecentBookings
function AdminRecentBookings({ bookings }) {
if (!bookings || !bookings.length) {
return (
<Layout>
<h3 className="text-lg leading-6 font-medium text-gray-900">
No recent bookings 😿
</h3>
</Layout>
<h3 className="text-lg leading-6 font-medium text-gray-900">
No recent bookings 😿
</h3>
)
}
return (
<Layout>
<>
{bookings.map((booking: any) => (
<BookingTable key={booking.uuid} booking={booking} />
))}
</Layout>
</>
)
}