Skip to content

Commit

Permalink
use actions (#57)
Browse files Browse the repository at this point in the history
use actions
  • Loading branch information
ashgw authored Feb 9, 2024
2 parents e31d023 + 4a3bf1e commit 3524871
Show file tree
Hide file tree
Showing 43 changed files with 1,728 additions and 229 deletions.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@commitlint/cli": "^18.2.0",
"@commitlint/config-conventional": "^18.1.0",
"@playwright/test": "^1.40.1",
"@tailwindcss/typography": "^0.5.10",
"@types/eslint": "^8.56.1",
"@types/jest": "^29.5.11",
"@types/mdx": "^2.0.10",
Expand Down Expand Up @@ -47,6 +48,8 @@
"@next/mdx": "^13.5.4",
"@nextui-org/react": "^2.2.9",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"@types/mapbox__rehype-prism": "^0.8.3",
"class-variance-authority": "^0.7.0",
Expand All @@ -72,6 +75,7 @@
"sugar-high": "^0.5.6",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7",
"uuid": "^9.0.1"
"uuid": "^9.0.1",
"zod": "^3.22.4"
}
}
100 changes: 100 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/blogs/tester.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tags:
First we might talk about <L href={'/blog/simple'}>how to run in parallel</L> and run the app on any machine, you can choose from two methods:
<S3/>
Using **``getStaticQueryParams()``** for isolation or, you can use <L href={'https://google.com'}>Google</L> if already have Python installed, the latter option.
**During the installation process, you will receive instructions on how to re-run the app if needed, one can mention:**
**During the <L href={'/blog/simple'}>installation</L> process, you will receive instructions on how to re-run the app if needed, one can mention:**
<S2/>
* \- **Referrer**: Static site generation
<S/>
Expand Down
113 changes: 58 additions & 55 deletions src/app/(pages)/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,65 +1,68 @@
import { Suspense } from 'react';
import LoadingScreen from '@/app/components/reusables/loading-screen';
import StyledMDX from '@/app/components/mdx/styled-mdx';
import { Heading1 as H1 } from '@/app/components/reusables/headers';
import { formatDate, isSameMonthAndYear } from '@/lib/funcs/dates';
import { MediumSection } from '@/app/components/reusables/sections';
import type { Metadata, ResolvingMetadata } from 'next';

import { notFound } from 'next/navigation';
import { pub } from '@/lib/env';
import { getBlogPosts } from '@/app/(pages)/blog/content';
import { Badge } from '@/app/components/ui/badge';
import { getPost } from '@/app/actions/blog';

export default function Blog({ params }: { params: { slug: string } }) {
let post = getBlogPosts().find((post) => post?.filenameSlug === params.slug);
if (!post) {
notFound();
export default async function Blog({ params }: { params: { slug: string } }) {
const post = await getPost(params.slug);
if (post) {
return (
<Suspense fallback={<LoadingScreen />}>
<main>
<script
type="application/ld+json"
suppressHydrationWarning
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'BlogPosting',
headline: post.parsedContent.attributes.title,
datePublished: post.parsedContent.attributes.firstModDate,
dateModified: post.parsedContent.attributes.lastModDate,
description: post.parsedContent.attributes.seoTitle,
url: pub.SITE_URL_PROD + `/blog/${post.filenameSlug}`,
author: {
'@type': 'Person',
name: 'ashgw',
},
}),
}}
/>
<MediumSection>
<H1>{post.parsedContent.attributes.title}</H1>
<div className="flex justify-between items-center mb-8 text-sm sm:max-w-[450px] md:max-w-[550px] lg:max-w-[650px] xl:max-w-[750px] ">
<p className="text-sm dimmed-0">
{formatDate(post.parsedContent.attributes.firstModDate)}
</p>
<div>
{isSameMonthAndYear(
post.parsedContent.attributes.firstModDate
) ? (
// TODO: replace with views
<Badge variant={'outlineSuccess'} className="opacity-0">
New
</Badge>
) : (
<Badge variant={'outlineSuccess'} className="opacity-0">
New
</Badge>
)}
</div>
</div>
<article className="text-wrap">
<StyledMDX source={post.parsedContent.body}></StyledMDX>
</article>
</MediumSection>
</main>
</Suspense>
);
} else {
return notFound();
}
// TODO: configure metadata

return (
<main>
<script
type="application/ld+json"
suppressHydrationWarning
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'BlogPosting',
headline: post.parsedContent.attributes.title,
datePublished: post.parsedContent.attributes.firstModDate,
dateModified: post.parsedContent.attributes.lastModDate,
description: post.parsedContent.attributes.seoTitle,
url: pub.SITE_URL_PROD + `/blog/${post.filenameSlug}`,
author: {
'@type': 'Person',
name: 'ashgw',
},
}),
}}
/>
<MediumSection>
<H1>{post.parsedContent.attributes.title}</H1>
<div className="flex justify-between items-center mb-8 text-sm sm:max-w-[450px] md:max-w-[550px] lg:max-w-[650px] xl:max-w-[750px] ">
<p className="text-sm dimmed-0">
{formatDate(post.parsedContent.attributes.firstModDate)}
</p>
<div>
{isSameMonthAndYear(post.parsedContent.attributes.firstModDate) ? (
// TODO: replace with views
<Badge variant={'outlineSuccess'} className="opacity-0">
New
</Badge>
) : (
<Badge variant={'outlineSuccess'} className="opacity-0">
New
</Badge>
)}
</div>
</div>
<article className="text-wrap">
<StyledMDX source={post.parsedContent.body}></StyledMDX>
</article>
</MediumSection>
</main>
);
}
34 changes: 0 additions & 34 deletions src/app/(pages)/blog/content.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/app/(pages)/blog/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Navbar } from '@/app/components/reusables/nav';
import Nav from '@/app/components/nav/nav';
export default async function BlogsLayout({
children,
Expand Down
Loading

0 comments on commit 3524871

Please sign in to comment.