-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: container and router clean up (#115)
- Reorganizes trpc router. - Creates trpc routes specific for each container. - Collocates mocks with containers - moves some href generation to trpc. Generally we want to keep all this kind of logic outside of containers - Some stories are broken. WIP ;)
- Loading branch information
Showing
137 changed files
with
7,549 additions
and
8,493 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,21 @@ | ||
import * as fs from "node:fs/promises"; | ||
import { type FunctionComponent } from "react"; | ||
import KeyboardArrowRightIcon from "@mui/icons-material/KeyboardArrowRight"; | ||
import { | ||
Card, | ||
CardContent, | ||
Link, | ||
Typography, | ||
CardActions, | ||
Button, | ||
Box, | ||
} from "@mui/joy"; | ||
import { DateTime } from "luxon"; | ||
import { default as dedent } from "ts-dedent"; | ||
import { | ||
AppHead, | ||
BackgroundFadedImage, | ||
BlogPostChip, | ||
} from "@chair-flight/react/components"; | ||
import { LayoutPublic } from "@chair-flight/react/containers"; | ||
import { AppHead, BackgroundFadedImage } from "@chair-flight/react/components"; | ||
import { BlogIndex, LayoutPublic } from "@chair-flight/react/containers"; | ||
import { staticHandler } from "@chair-flight/trpc/server"; | ||
import type { AppRouterOutput } from "@chair-flight/trpc/server"; | ||
import type { NextPage } from "next"; | ||
|
||
export type PageProps = AppRouterOutput["blog"]["getBlogPostsMeta"]; | ||
|
||
const Page: FunctionComponent<PageProps> = ({ meta }) => { | ||
const Page: NextPage = () => { | ||
return ( | ||
<LayoutPublic background={<BackgroundFadedImage img="article" />}> | ||
<AppHead linkDescription={dedent``} /> | ||
<Typography level="h2" sx={{ pt: 4 }}> | ||
Posts | ||
</Typography> | ||
{meta.map((post) => ( | ||
<Card sx={{ mt: 2 }} key={post.filename}> | ||
<CardContent> | ||
<Box sx={{ mb: 2 }}> | ||
<BlogPostChip key={post.tag} tag={post.tag} size="sm" /> | ||
</Box> | ||
<Typography level="h3" color="primary"> | ||
{post.title} | ||
</Typography> | ||
<Typography level="body-sm">{post.description}</Typography> | ||
</CardContent> | ||
<CardActions> | ||
<Box> | ||
<Typography level="body-sm">{post.author}</Typography> | ||
<Typography level="body-xs"> | ||
{DateTime.fromISO(post.date).toFormat("dd LLL yyyy")} | ||
</Typography> | ||
</Box> | ||
<Button | ||
color="primary" | ||
variant="plain" | ||
component={Link} | ||
href={`/articles/blog/${post.filename}`} | ||
children="Read More" | ||
endDecorator={<KeyboardArrowRightIcon />} | ||
sx={{ flex: 0, ml: "auto" }} | ||
/> | ||
</CardActions> | ||
</Card> | ||
))} | ||
<Box component="footer" sx={{ py: 2 }} /> | ||
<AppHead /> | ||
<BlogIndex /> | ||
</LayoutPublic> | ||
); | ||
}; | ||
|
||
export const getStaticProps = staticHandler<PageProps>(async ({ helper }) => { | ||
const props = await helper.blog.getBlogPostsMeta.fetch(); | ||
return { props }; | ||
export const getStaticProps = staticHandler(async ({ helper }) => { | ||
await BlogIndex.getData({ params: {}, helper }); | ||
return { props: {} }; | ||
}, fs); | ||
|
||
export default Page; |
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
Oops, something went wrong.
73db598
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:
chair-flight – ./
chair-flight.com
chair-flight-git-main-chair-flight-team.vercel.app
chair-flight-chair-flight-team.vercel.app
chair-flight.vercel.app
www.chair-flight.com