-
-
Notifications
You must be signed in to change notification settings - Fork 5
Max updates: Game series - Snake #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5f9599e
2e07f61
da1c93d
fd9eb1c
d487e3c
8f707c8
2ae5dd5
68bd352
e0f140a
066860b
174bc84
4775df4
643b3d8
35ca6cf
5968435
a16d65b
476d710
8d71a74
8aab712
1916c7d
bfc82f0
49ecd24
f162c6c
2cbb0dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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"] |
| 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> | ||
| <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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 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> | ||
| ) | ||
| } |
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.
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.