From 1dba1cf09375fd10a0e85578ab3c5c08f23cd5fd Mon Sep 17 00:00:00 2001 From: Citali Date: Sun, 29 Jun 2025 12:08:29 +0200 Subject: [PATCH] Fixes --- Dockerfile | 45 +++++-------------- .../[albumSlug]/[imageId]/page.tsx | 19 ++++---- src/app/(raw)/raw/[imageId]/page.tsx | 2 +- .../images/GlowingImageWithToggle.tsx | 41 ++++++++++------- 4 files changed, 46 insertions(+), 61 deletions(-) diff --git a/Dockerfile b/Dockerfile index 600f0f1..e04b9de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,40 +1,19 @@ -# Install dependencies only when needed -FROM node:20-alpine AS deps -WORKDIR /app +# Base image +FROM node:20 -# Install global Prisma CLI -RUN npm install -g prisma +# Set working directory +WORKDIR /app # Install dependencies -COPY package.json package-lock.json* ./ -RUN npm ci +COPY package.json package-lock.json ./ +RUN npm install -# Copy only prisma schema to generate client early -COPY prisma ./prisma/ +# Copy the rest of the code +COPY . . RUN npx prisma generate -# Builder image -FROM node:20-alpine AS builder -WORKDIR /app -COPY --from=deps /app/node_modules ./node_modules -COPY . . +# Expose the dev port +EXPOSE 3000 -# Build the app -RUN npm run build - -# Production image -FROM node:20-alpine AS runner -WORKDIR /app - -ENV NODE_ENV production - -# Copy necessary files -COPY --from=builder /app/public ./public -COPY --from=builder /app/.next ./.next -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/package.json ./package.json -COPY --from=builder /app/prisma ./prisma - -# Run migrations if needed -# CMD npx prisma migrate deploy && node .next/standalone/server.js -CMD node .next/standalone/server.js \ No newline at end of file +# Run dev server +CMD ["npm", "run", "dev"] diff --git a/src/app/(normal)/[gallerySlug]/[albumSlug]/[imageId]/page.tsx b/src/app/(normal)/[gallerySlug]/[albumSlug]/[imageId]/page.tsx index 30900a9..bc249be 100644 --- a/src/app/(normal)/[gallerySlug]/[albumSlug]/[imageId]/page.tsx +++ b/src/app/(normal)/[gallerySlug]/[albumSlug]/[imageId]/page.tsx @@ -2,7 +2,6 @@ import ArtistInfoBox from "@/components/images/ArtistInfoBox"; import GlowingImageWithToggle from "@/components/images/GlowingImageWithToggle"; import ImageMetadataBox from "@/components/images/ImageMetadataBox"; import prisma from "@/lib/prisma"; -import Link from "next/link"; export default async function ImagePage({ params }: { params: { gallerySlug: string, albumSlug: string, imageId: string } }) { const { imageId } = await params; @@ -38,15 +37,15 @@ export default async function ImagePage({ params }: { params: { gallerySlug: str {resizedVariant && - - - + + }
{image.artist && } diff --git a/src/app/(raw)/raw/[imageId]/page.tsx b/src/app/(raw)/raw/[imageId]/page.tsx index d6f7735..99ec9fc 100644 --- a/src/app/(raw)/raw/[imageId]/page.tsx +++ b/src/app/(raw)/raw/[imageId]/page.tsx @@ -5,7 +5,7 @@ import NextImage from "next/image"; import { notFound } from "next/navigation"; export default async function RawImagePage({ params }: { params: { imageId: string } }) { - const { imageId } = params; + const { imageId } = await params; const image = await prisma.image.findUnique({ where: { id: imageId }, diff --git a/src/components/images/GlowingImageWithToggle.tsx b/src/components/images/GlowingImageWithToggle.tsx index b2016d4..c2b1fae 100644 --- a/src/components/images/GlowingImageWithToggle.tsx +++ b/src/components/images/GlowingImageWithToggle.tsx @@ -1,6 +1,7 @@ "use client" import { Color, ImageColor, ImageVariant } from "@/generated/prisma"; +import Link from "next/link"; import { useState } from "react"; import { Label } from "../ui/label"; import { Switch } from "../ui/switch"; @@ -12,22 +13,26 @@ type Props = { alt: string; src: string; nsfw: boolean; + imageId: string; } -export default function GlowingImageWithToggle({ variant, colors, alt, src, nsfw }: Props) { +export default function GlowingImageWithToggle({ variant, colors, alt, src, nsfw, imageId }: Props) { const [animate, setAnimate] = useState(true); const [revealed, setRevealed] = useState(!nsfw) return (
- + + + +
@@ -36,14 +41,16 @@ export default function GlowingImageWithToggle({ variant, colors, alt, src, nsfw
- {nsfw && ( -
-
- - + { + nsfw && ( +
+
+ + +
-
- )} -
+ ) + } +
); }