Skip to content

Commit

Permalink
chore: fix spacing in code
Browse files Browse the repository at this point in the history
  • Loading branch information
AureliusIvan committed Jun 7, 2024
1 parent 642d53f commit 999fde3
Show file tree
Hide file tree
Showing 32 changed files with 426 additions and 566 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:lts-iron
FROM node:lts-alpine3.20

ENV NODE_OPTIONS="--max-old-space-size=4096"

Expand Down
9 changes: 2 additions & 7 deletions client/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import generated from "@next/mdx";
import mdx from "@next/mdx";

const withMDX = generated()
const withMDX = mdx()

/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'],
experimental: {
webVitalsAttribution: ['CLS', 'LCP']
},
devIndicators: {
buildActivity: true,
buildActivityPosition: 'bottom-right',
},
images: {
dangerouslyAllowSVG: true,
remotePatterns: [
Expand Down Expand Up @@ -40,5 +36,4 @@ const nextConfig = {
}
}

// export default nextConfig;
export default withMDX(nextConfig);
3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@
"@gsap/react": "^2.1.0",
"@mdx-js/loader": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@next/bundle-analyzer": "^14.2.3",
"@next/mdx": "^14.2.3",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-hover-card": "^1.0.7",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@types/mdx": "^2.0.13",
"@uiw/react-markdown-preview": "^5.1.1",
"axios": "^1.6.8",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"gray-matter": "^4.0.3",
"gsap": "^3.12.5",
"lottie-react": "^2.4.0",
"lru-cache": "^10.2.2",
Expand Down
267 changes: 208 additions & 59 deletions client/pnpm-lock.yaml

Large diffs are not rendered by default.

44 changes: 43 additions & 1 deletion client/src/app/action.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
"use server"

import {promises as fs} from 'fs';
import path from 'path';
import matter from "gray-matter";
import {LRUCache} from 'lru-cache';

const cache = new LRUCache<string, {
name: string,
content: string
}>({
max: 100,
ttl: 1000 * 60 * 24
});

const getGithubData = async () => {
const response = await fetch('https://api.github.com/users/AureliusIvan',
{
mode: 'cors',
next: {
revalidate: 3600 * 24
}
Expand All @@ -11,4 +25,32 @@ const getGithubData = async () => {
return response.json();
}

export {getGithubData}

const getPostData = async () => {
const postsDirectory = path.join(process.cwd(), 'src/posts')
const filenames = await fs.readdir(postsDirectory)
return await Promise.all(filenames.map(async (filename) => {

if (cache.has(filename)) {
return cache.get(filename)
}


const filePath = path.join(postsDirectory, filename)
const fileContent = await fs.readFile(filePath, 'utf8')
const {data, content} = matter(fileContent)
const returnData = {
name: filename.replace(/\.md$/, ''),
content: content
}
cache.set(filename, returnData)
return returnData
}
))
}


export {
getGithubData,
getPostData
}
10 changes: 0 additions & 10 deletions client/src/app/api/github/route.ts

This file was deleted.

15 changes: 0 additions & 15 deletions client/src/app/api/login/route.ts

This file was deleted.

8 changes: 0 additions & 8 deletions client/src/app/api/route.ts

This file was deleted.

7 changes: 4 additions & 3 deletions client/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {Navbar} from '@/components/ui/navbar.component';
import {cn} from '@/lib/utils';
import {ThemeProvider} from '@/components/theme-provider';
import {Montserrat} from 'next/font/google'
import Footer from "@/components/ui/footer";
import dynamic from 'next/dynamic';

const Footer = dynamic(() => import('@/components/ui/footer'), {})


export const metadata: Metadata = {
Expand Down Expand Up @@ -38,7 +40,7 @@ interface RootLayoutProps {
}


export default function RootLayout(
export default async function RootLayout(
{children}: Readonly<RootLayoutProps>
) {
return (
Expand All @@ -64,7 +66,6 @@ export default function RootLayout(
bg-primaryLight text-textPrimaryLight'>

<Navbar routes={Routes}/>

{children}

<Footer/>
Expand Down
15 changes: 10 additions & 5 deletions client/src/app/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
export default function Loading() {
"use server"

async function Loading() {
return (
<div
className='flex items-center justify-center h-screen w-full'
>
<div className='flex flex-col items-center justify-center gap-4 min-h-screen'>
<h1>
...
</h1>
</div>
)
}
}

export default Loading
34 changes: 0 additions & 34 deletions client/src/app/log/_page.tsx

This file was deleted.

12 changes: 12 additions & 0 deletions client/src/app/log/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use server"

async function Loading() {
return (
<div className='flex flex-col items-center justify-center gap-4 min-h-screen'>
<h1>
</h1>
</div>
)
}

export default Loading
57 changes: 33 additions & 24 deletions client/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import type {Metadata} from 'next'

import {Loading} from '@/components/ui/loading/loading';
import dynamic from 'next/dynamic';
import {Title} from '@/components/ui/title';
import {Suspense} from 'react';
import {InProgressSection} from "@/components/section/in-progress";
import GameScreen from '@/components/game/game-screen';
import PostSection from "@/components/section/post";

const GameScreen = dynamic(() => import('@/components/game/game-screen'), {
ssr: true,
})

export async function generateMetadata(): Promise<Metadata> {
return {
Expand All @@ -22,6 +24,7 @@ export async function generateMetadata(): Promise<Metadata> {
}
}


async function Home() {
return (
<main
Expand All @@ -31,53 +34,59 @@ async function Home() {

{/* Hero Section */}
<section
className='flex flex-col items-center justify-center gap-4'
className='
flex flex-col items-center justify-center gap-4
mt-10 min-h-[20vh] w-full
'
>
<Title>
<Title size={"large"}>
{/*(on development) <br/>*/}
Hi. I&#39;am Ivan.<br/>
a Developer.
Hi. I&#39;m Ivan.<br/>
a developer.
</Title>

<GameScreen/>

<div
className='flex flex-col items-center justify-center w-full gap-4'
>
</div>
<p className={"text-center font-light animate"}>
I loves to write about web development, <br/>
technology, and life.
</p>

</section>

{/* Game Section */}
<section
>

<GameScreen/>

</section>

{/* Post Section */}
<section
className={"w-full flex flex-col items-center justify-center gap-4"}
className="w-full flex flex-col
items-center justify-center gap-4"
>
<Title>
Recent Post
</Title>
(on development)
{/* Post List */
}
<Suspense fallback={<Loading/>}>
</Suspense>

<PostSection/>
</section>


{/* Achievement Section */}
<section>
</section>

{/* In Progress */}
<section
className={"w-full flex flex-col items-center " +
"justify-center gap-4 m-4"}
className="w-full flex flex-col items-center
justify-center gap-4 m-4"
>
<Title>
Project
</Title>

(on development)

<InProgressSection/>

</section>

{/* Awards Section */}
Expand Down
14 changes: 0 additions & 14 deletions client/src/app/post/[id]/page.tsx

This file was deleted.

Loading

0 comments on commit 999fde3

Please sign in to comment.