Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5f9599e
Adding theme switcher component/btn
BaseMax Mar 27, 2026
2e07f61
Merge branch 'main' of https://github.com/metropolis-retro/metropolis…
BaseMax Mar 27, 2026
da1c93d
Merge branch 'main' of https://github.com/metropolis-retro/metropolis…
BaseMax Apr 2, 2026
fd9eb1c
Merge branch 'main' of https://github.com/metropolis-retro/metropolis…
BaseMax Apr 2, 2026
d487e3c
Merge branch 'main' of https://github.com/metropolis-retro/metropolis…
BaseMax Apr 4, 2026
8f707c8
Merge branch 'main' of https://github.com/metropolis-retro/metropolis…
BaseMax Apr 5, 2026
2ae5dd5
Init and start putting snake game inside the project
BaseMax Apr 5, 2026
68bd352
Integrate the game into the nextjs project
BaseMax Apr 5, 2026
e0f140a
run pre-commit
BaseMax Apr 5, 2026
066860b
fix precommit
BaseMax Apr 5, 2026
174bc84
remove extra text
BaseMax Apr 5, 2026
4775df4
fix
BaseMax Apr 5, 2026
643b3d8
Fix ai feedback, update packages
BaseMax Apr 5, 2026
35ca6cf
Fix ai feedback
BaseMax Apr 5, 2026
5968435
Fix bug
BaseMax Apr 5, 2026
a16d65b
Merge branch 'main' into max-updates-games-snake
jbampton Apr 6, 2026
476d710
Merge branch 'main' into max-updates-games-snake
jbampton Apr 6, 2026
8d71a74
Merge branch 'main' into max-updates-games-snake
jbampton Apr 6, 2026
8aab712
Merge branch 'main' into max-updates-games-snake
jbampton Apr 6, 2026
1916c7d
Fix all AI feedbacks
BaseMax Apr 6, 2026
bfc82f0
Merge branch 'main' into max-updates-games-snake
jbampton Apr 6, 2026
49ecd24
Fix some AI feedbacks
BaseMax Apr 6, 2026
f162c6c
Merge branch 'max-updates-games-snake' of https://github.com/metropol…
BaseMax Apr 6, 2026
2cbb0dd
Merge branch 'main' into max-updates-games-snake
jbampton Apr 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM oven/bun:1-alpine AS builder

WORKDIR /app

COPY package.json package-lock.json* bun.lock* ./
RUN bun install --frozen-lockfile

COPY . .

RUN bun run build

FROM oven/bun:1-alpine AS runner

RUN addgroup -g 1001 -S nextjs && \
adduser -S nextjs -u 1001 -G nextjs

WORKDIR /app

ENV NODE_ENV=production
ENV HOSTNAME="0.0.0.0"

COPY --from=builder --chown=nextjs:nextjs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nextjs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nextjs /app/public ./public

USER nextjs

EXPOSE 3000

CMD ["bun", "server.js"]
4 changes: 2 additions & 2 deletions app/games/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ const games: GameCard[] = [
{
title: "Snake",
description: "Guide the snake to eat food and grow longer without hitting the walls or yourself.",
href: "#",
href: "/games/snake",
emoji: "🐍",
available: false,
available: true,
},
{
title: "Tetris",
Expand Down
56 changes: 56 additions & 0 deletions app/games/snake/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import type { Metadata } from "next"
import Link from "next/link"
import { Header } from "@/components/layout/header"
import { Footer } from "@/components/layout/footer"
import { SITE_URL, TITLE_BASE, pageKeywords } from "@/lib/seo"
import { ArrowLeft } from "lucide-react"
import { SnakeEmbed } from "./snake-embed"

export const metadata: Metadata = {
title: "Snake",
description:
"Play Snake in your browser. Collect food, grow longer, and avoid crashing into yourself.",
keywords: pageKeywords(["snake", "retro game", "arcade game", "browser game"]),
alternates: {
canonical: "/games/snake",
},
openGraph: {
title: `Snake | ${TITLE_BASE}`,
description: "Play Snake in your browser. Collect food, grow longer, and avoid crashing into yourself.",
url: `${SITE_URL}/games/snake`,
type: "website",
},
twitter: {
card: "summary_large_image",
title: `Snake | ${TITLE_BASE}`,
description: "Play Snake in your browser. Collect food, grow longer, and avoid crashing into yourself.",
},
}

export default function SnakePage() {
return (
<div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excessive JSX nesting hampers code readability


Deep nesting of JSX elements makes components difficult to read and understand, increasing the likelihood of mistakes during development and maintenance. This impacts the code's clarity and maintainability.

Refactor deeply nested JSX by creating smaller reusable components or passing props to consolidate nested elements into simpler structures.

<Header />
<main className="pt-24 md:pt-32">
<section className="border-b border-border py-8 md:py-12">
<div className="mx-auto max-w-[1280px] px-6 md:px-12">
<Link
href="/games"
className="mb-6 inline-flex items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground"
>
<ArrowLeft className="h-4 w-4" />
Back to games
</Link>
</div>
</section>

<section className="py-8 md:py-12">
<div className="mx-auto max-w-[1280px] px-6 md:px-12">
<SnakeEmbed />
</div>
</section>
</main>
<Footer />
</div>
)
}
Comment on lines +30 to +56
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Top-level declarations pollute global scope causing collisions


Declaring variables or functions directly in the global scope risks name collisions and unexpected behaviors if other scripts declare identifiers with the same names. This is especially problematic in environments where scripts share the same global context.

Use module scoping or encapsulate declarations within functions or blocks to avoid global pollution and ensure variables are local to the module or intended scope.

16 changes: 16 additions & 0 deletions app/games/snake/snake-embed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use client"

import dynamic from "next/dynamic"

const SnakeApp = dynamic(() => import("@games/snake"), { ssr: false })

export function SnakeEmbed() {
return (
<div
className="relative w-full overflow-hidden rounded-xl border border-border bg-slate-950"
style={{ aspectRatio: "4/3", maxHeight: "80vh" }}
>
<SnakeApp />
</div>
)
}
2 changes: 1 addition & 1 deletion components/ui/magnetic-cursor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function MagneticCursor() {

<style jsx global>{`
@media (min-width: 768px) {
* {
body:not(.show-system-cursor) *:not(.show-system-cursor):not(.show-system-cursor *) {
cursor: none !important;
}
}
Expand Down
Loading
Loading