-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate app to use server components
- Loading branch information
Showing
11 changed files
with
113 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export default function Head() { | ||
return ( | ||
<> | ||
<title>Mach</title> | ||
<meta content="width=device-width, initial-scale=1" name="viewport" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
import '../src/index.css' | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode | ||
}) { | ||
return ( | ||
<html> | ||
<head /> | ||
<body> | ||
{children} | ||
</body> | ||
</html> | ||
) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Link from 'next/link' | ||
import React from 'react' | ||
import FlightsTable from '../../src/components/FlightsTable' | ||
import Lead from '../../src/components/Lead' | ||
import GeneralLayout from '../../src/layouts/GeneralLayout' | ||
import { fetchFlights } from '../../src/services/fetch-flights' | ||
|
||
const getLeadMessage = (count: number) => { | ||
return count === 1 | ||
? 'There is a single result for your search.' | ||
: `There are ${count} results for your search.` | ||
} | ||
|
||
export default async function Search({ | ||
searchParams, | ||
}: { | ||
searchParams?: { [key: string]: string | string[] | undefined }; | ||
}) { | ||
|
||
const flights = (await fetchFlights(searchParams as any)) | ||
|
||
if (flights.length === 0) { | ||
return <GeneralLayout> | ||
<Lead> | ||
There are no results for your search.{" "} | ||
<Link href="/">Click here</Link> to make a new search. | ||
</Lead> | ||
</GeneralLayout> | ||
} | ||
|
||
return ( | ||
<GeneralLayout> | ||
<Lead> | ||
{getLeadMessage(flights.length)}{' '} | ||
<Link href="/">Click here</Link> to make a new search. | ||
</Lead> | ||
|
||
<FlightsTable items={flights} /> | ||
</GeneralLayout> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
experimental: { | ||
appDir: true, | ||
}, | ||
} | ||
|
||
module.exports = nextConfig |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56f1401
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
mach – ./
mach-five.vercel.app
mach-git-master-jpedroh.vercel.app
mach-jpedroh.vercel.app
mach.jpedroh.dev