mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 15:07:13 +01:00
move Layout into _app.tsx
This commit is contained in:
committed by
Thomas Ruoff
parent
7389289b81
commit
2fd3a47e72
@@ -1,7 +1,11 @@
|
|||||||
export { reportWebVitals } from 'next-axiom'
|
export { reportWebVitals } from 'next-axiom'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
|
import type { AppProps } from 'next/app'
|
||||||
|
|
||||||
import { useSession, signIn, SessionProvider } from 'next-auth/react'
|
import { useSession, signIn, SessionProvider } from 'next-auth/react'
|
||||||
|
import Layout from '../components/layout';
|
||||||
|
|
||||||
import '../styles/index.css'
|
import '../styles/index.css'
|
||||||
|
|
||||||
function Auth({ children }) {
|
function Auth({ children }) {
|
||||||
@@ -29,6 +33,7 @@ export default function MyApp({
|
|||||||
return (
|
return (
|
||||||
<div className="flex flex-col min-h-screen">
|
<div className="flex flex-col min-h-screen">
|
||||||
<SessionProvider session={session}>
|
<SessionProvider session={session}>
|
||||||
|
<Layout>
|
||||||
{Component.authenticationRequired ? (
|
{Component.authenticationRequired ? (
|
||||||
<Auth>
|
<Auth>
|
||||||
<Component {...pageProps} />
|
<Component {...pageProps} />
|
||||||
@@ -36,6 +41,7 @@ export default function MyApp({
|
|||||||
) : (
|
) : (
|
||||||
<Component {...pageProps} />
|
<Component {...pageProps} />
|
||||||
)}
|
)}
|
||||||
|
</Layout>
|
||||||
</SessionProvider>
|
</SessionProvider>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import Layout from '../../../../components/layout'
|
|
||||||
import Input from '../../../../components/input'
|
import Input from '../../../../components/input'
|
||||||
import Select from '../../../../components/select'
|
import Select from '../../../../components/select'
|
||||||
import { Booking } from '../../../../db/booking'
|
import { Booking } from '../../../../db/booking'
|
||||||
@@ -115,14 +114,14 @@ function BookingBillPage({
|
|||||||
setStoringInProgress(false)
|
setStoringInProgress(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onAddAdditionalCost = function (
|
const onAddAdditionalCost = function(
|
||||||
event: React.MouseEvent<HTMLButtonElement>
|
event: React.MouseEvent<HTMLButtonElement>
|
||||||
) {
|
) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
setAdditionalCosts([...additionalCosts, { name: '', value: 0 }])
|
setAdditionalCosts([...additionalCosts, { name: '', value: 0 }])
|
||||||
}
|
}
|
||||||
|
|
||||||
const onRemoveAdditionalCost = function (
|
const onRemoveAdditionalCost = function(
|
||||||
event: React.MouseEvent<HTMLButtonElement>,
|
event: React.MouseEvent<HTMLButtonElement>,
|
||||||
index: number
|
index: number
|
||||||
) {
|
) {
|
||||||
@@ -134,7 +133,7 @@ function BookingBillPage({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<>
|
||||||
{booking && (
|
{booking && (
|
||||||
<form className="w-full" onSubmit={onSubmit}>
|
<form className="w-full" onSubmit={onSubmit}>
|
||||||
<div>
|
<div>
|
||||||
@@ -198,8 +197,7 @@ function BookingBillPage({
|
|||||||
>
|
>
|
||||||
-
|
-
|
||||||
</button>
|
</button>
|
||||||
<label className="flabel inline">{`Kostenpunkt ${
|
<label className="flabel inline">{`Kostenpunkt ${index + 1
|
||||||
index + 1
|
|
||||||
}`}</label>
|
}`}</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="ml-10 mb-3" key={`input{index}`}>
|
<div className="ml-10 mb-3" key={`input{index}`}>
|
||||||
@@ -258,7 +256,7 @@ function BookingBillPage({
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
)}
|
)}
|
||||||
</Layout>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import Layout from '../../../../components/layout'
|
|
||||||
import Calendar from '../../../../components/calendar'
|
import Calendar from '../../../../components/calendar'
|
||||||
import { getServerSideBooking } from '../../../../lib/getServerSideProps'
|
import { getServerSideBooking } from '../../../../lib/getServerSideProps'
|
||||||
import { Booking } from '../../../../db/booking'
|
import { Booking } from '../../../../db/booking'
|
||||||
@@ -37,7 +36,7 @@ function ShowBookingAdmin({ booking: bookingProp }: { booking: Booking }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<>
|
||||||
<h2 className="text-3xl">Buchung {booking.uuid}</h2>
|
<h2 className="text-3xl">Buchung {booking.uuid}</h2>
|
||||||
<Calendar start={booking.startDate} end={booking.endDate} />
|
<Calendar start={booking.startDate} end={booking.endDate} />
|
||||||
<div>
|
<div>
|
||||||
@@ -71,7 +70,7 @@ function ShowBookingAdmin({ booking: bookingProp }: { booking: Booking }) {
|
|||||||
<a className="btn btn-gray">Rechnung</a>
|
<a className="btn btn-gray">Rechnung</a>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import BookingTable from '../../components/bookingTable'
|
import BookingTable from '../../components/bookingTable'
|
||||||
import Layout from '../../components/layout'
|
|
||||||
|
|
||||||
import { getServerSideRecentBookings } from '../../lib/getServerSideProps'
|
import { getServerSideRecentBookings } from '../../lib/getServerSideProps'
|
||||||
|
|
||||||
@@ -9,20 +8,18 @@ export const getServerSideProps = getServerSideRecentBookings
|
|||||||
function AdminRecentBookings({ bookings }) {
|
function AdminRecentBookings({ bookings }) {
|
||||||
if (!bookings || !bookings.length) {
|
if (!bookings || !bookings.length) {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
|
||||||
<h3 className="text-lg leading-6 font-medium text-gray-900">
|
<h3 className="text-lg leading-6 font-medium text-gray-900">
|
||||||
No recent bookings 😿
|
No recent bookings 😿
|
||||||
</h3>
|
</h3>
|
||||||
</Layout>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<>
|
||||||
{bookings.map((booking: any) => (
|
{bookings.map((booking: any) => (
|
||||||
<BookingTable key={booking.uuid} booking={booking} />
|
<BookingTable key={booking.uuid} booking={booking} />
|
||||||
))}
|
))}
|
||||||
</Layout>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import Layout from '../components/layout'
|
|
||||||
import Book from '../components/book'
|
import Book from '../components/book'
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<>
|
||||||
<h1 className="mb-3 text-xl font-extrabold">Buchungsanfrage</h1>
|
<h1 className="mb-3 text-xl font-extrabold">Buchungsanfrage</h1>
|
||||||
<Book />
|
<Book />
|
||||||
</Layout>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import Layout from '../../../components/layout'
|
|
||||||
import { getServerSideBooking } from '../../../lib/getServerSideProps'
|
import { getServerSideBooking } from '../../../lib/getServerSideProps'
|
||||||
import { Booking } from '../../../db/booking'
|
import { Booking } from '../../../db/booking'
|
||||||
import { BOOKING_STATUS } from '../../../db/enums'
|
import { BOOKING_STATUS } from '../../../db/enums'
|
||||||
@@ -41,7 +40,7 @@ export default function ShowBooking({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<>
|
||||||
<div>
|
<div>
|
||||||
<strong>Buchungsstatus:</strong> {getBookingStatus(booking.status)}
|
<strong>Buchungsstatus:</strong> {getBookingStatus(booking.status)}
|
||||||
</div>
|
</div>
|
||||||
@@ -64,6 +63,6 @@ export default function ShowBooking({
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Layout>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import Layout from '../../../components/layout'
|
|
||||||
import { Booking } from '../../../db/booking'
|
import { Booking } from '../../../db/booking'
|
||||||
import { loadBookingData, storeBookingData } from '../../../helpers/storage'
|
import { loadBookingData, storeBookingData } from '../../../helpers/storage'
|
||||||
import { getServerSideBooking } from '../../../lib/getServerSideProps'
|
import { getServerSideBooking } from '../../../lib/getServerSideProps'
|
||||||
@@ -19,7 +18,7 @@ export default function ShowBookingStored({ booking }: { booking: Booking }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<>
|
||||||
<h3 className="thanks mb-3 mt-6 text-lg">
|
<h3 className="thanks mb-3 mt-6 text-lg">
|
||||||
Vielen Dank für die Buchungsanfrage
|
Vielen Dank für die Buchungsanfrage
|
||||||
</h3>
|
</h3>
|
||||||
@@ -52,6 +51,6 @@ export default function ShowBookingStored({ booking }: { booking: Booking }) {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Layout>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,9 @@ import { MDXRemote } from 'next-mdx-remote'
|
|||||||
|
|
||||||
import mdComponents from '../components/mdComponents'
|
import mdComponents from '../components/mdComponents'
|
||||||
|
|
||||||
import Layout from '../components/layout'
|
|
||||||
|
|
||||||
export default function TermsPage({ source }) {
|
export default function TermsPage({ source }) {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
|
||||||
<MDXRemote {...source} components={{ ...mdComponents }} />
|
<MDXRemote {...source} components={{ ...mdComponents }} />
|
||||||
</Layout>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import Layout from '../components/layout'
|
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
|
||||||
<div className="mt-6 sm:text-center">
|
<div className="mt-6 sm:text-center">
|
||||||
<h1 className="text-xl tracking-tight font-extrabold text-gray-900 sm:text-2xl md:text-3xl">
|
<h1 className="text-xl tracking-tight font-extrabold text-gray-900 sm:text-2xl md:text-3xl">
|
||||||
<span className="block text-blue-800 xl:inline">Pfadi-Bussle</span>{' '}
|
<span className="block text-blue-800 xl:inline">Pfadi-Bussle</span>{' '}
|
||||||
@@ -69,6 +67,5 @@ export default function Home() {
|
|||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import Layout from '../components/layout'
|
|
||||||
|
|
||||||
export default function Prices() {
|
export default function Prices() {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<>
|
||||||
<h1 className="mb-3 text-xl font-extrabold">Preise</h1>
|
<h1 className="mb-3 text-xl font-extrabold">Preise</h1>
|
||||||
<table className="divide-y divide-gray-200">
|
<table className="divide-y divide-gray-200">
|
||||||
<thead className="bg-gray-50">
|
<thead className="bg-gray-50">
|
||||||
@@ -43,6 +41,6 @@ export default function Prices() {
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</Layout>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,11 @@ import { serialize } from 'next-mdx-remote/serialize'
|
|||||||
import { MDXRemote } from 'next-mdx-remote'
|
import { MDXRemote } from 'next-mdx-remote'
|
||||||
import mdComponents from '../components/mdComponents'
|
import mdComponents from '../components/mdComponents'
|
||||||
|
|
||||||
import Layout from '../components/layout'
|
|
||||||
|
|
||||||
export default function TermsPage({ source }) {
|
export default function TermsPage({ source }) {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
|
||||||
<div className="text-gray-700">
|
<div className="text-gray-700">
|
||||||
<MDXRemote {...source} components={{ ...mdComponents }} />
|
<MDXRemote {...source} components={{ ...mdComponents }} />
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,15 +5,11 @@ import { MDXRemote } from 'next-mdx-remote'
|
|||||||
|
|
||||||
import mdComponents from '../components/mdComponents'
|
import mdComponents from '../components/mdComponents'
|
||||||
|
|
||||||
import Layout from '../components/layout'
|
|
||||||
|
|
||||||
export default function TermsPage({ source }) {
|
export default function TermsPage({ source }) {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
|
||||||
<div className="text-gray-700">
|
<div className="text-gray-700">
|
||||||
<MDXRemote {...source} components={{ ...mdComponents }} />
|
<MDXRemote {...source} components={{ ...mdComponents }} />
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user