From bcb563fa1c7d49c856ed7f6f277223cff77cbe5b Mon Sep 17 00:00:00 2001 From: cdricms <36056008+cdricms@users.noreply.github.com> Date: Mon, 10 Feb 2025 09:42:24 +0100 Subject: [PATCH] Fixed some imports and build --- frontend/Dockerfile | 20 +++---- frontend/app/(main)/page.tsx | 3 +- frontend/components/contact.tsx | 2 +- frontend/components/login-form.tsx | 4 +- frontend/components/planning.tsx | 8 +-- frontend/hooks/use-file-upload.tsx | 2 +- frontend/hooks/use-login.tsx | 4 +- frontend/middleware.ts | 2 +- frontend/package-lock.json | 90 ++++++++++++++++++++++++++++++ 9 files changed, 110 insertions(+), 25 deletions(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 33b45ca..1f1bce1 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -11,11 +11,11 @@ WORKDIR /app # Install dependencies based on the preferred package manager COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./ RUN \ - if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ - elif [ -f package-lock.json ]; then npm ci; \ - elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \ - else echo "Lockfile not found." && exit 1; \ - fi + if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ + elif [ -f package-lock.json ]; then npm ci --force; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \ + else echo "Lockfile not found." && exit 1; \ + fi # Rebuild the source code only when needed @@ -30,11 +30,11 @@ COPY . . # ENV NEXT_TELEMETRY_DISABLED=1 RUN \ - if [ -f yarn.lock ]; then yarn run build; \ - elif [ -f package-lock.json ]; then npm run build; \ - elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \ - else echo "Lockfile not found." && exit 1; \ - fi + if [ -f yarn.lock ]; then yarn run build; \ + elif [ -f package-lock.json ]; then npm run build; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \ + else echo "Lockfile not found." && exit 1; \ + fi # Production image, copy all the files and run next FROM base AS runner diff --git a/frontend/app/(main)/page.tsx b/frontend/app/(main)/page.tsx index 7062d03..c11cb27 100644 --- a/frontend/app/(main)/page.tsx +++ b/frontend/app/(main)/page.tsx @@ -1,5 +1,4 @@ -"use server"; - +export const dynamic = "force-dynamic"; // Prevents static rendering import Features, { FeatureItem } from "@/components/features"; import Gallery from "@/components/gallery"; import Hero from "@/components/hero"; diff --git a/frontend/components/contact.tsx b/frontend/components/contact.tsx index dfb9526..7465cb9 100644 --- a/frontend/components/contact.tsx +++ b/frontend/components/contact.tsx @@ -3,8 +3,8 @@ import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; -import { ApiResponse } from "@/hooks/use-api"; import { API_URL } from "@/lib/constants"; +import { ApiResponse } from "@/types/types"; import { useEffect, useState } from "react"; interface FormData { diff --git a/frontend/components/login-form.tsx b/frontend/components/login-form.tsx index 8876f73..427d62a 100644 --- a/frontend/components/login-form.tsx +++ b/frontend/components/login-form.tsx @@ -3,12 +3,10 @@ import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import { useRouter } from "next/navigation"; import useLogin from "@/hooks/use-login"; import { Loader2 } from "lucide-react"; -import { API_URL } from "@/lib/constants"; -import { ApiResponse } from "@/hooks/use-api"; export function LoginForm({ className, diff --git a/frontend/components/planning.tsx b/frontend/components/planning.tsx index b29cd60..8b9f845 100644 --- a/frontend/components/planning.tsx +++ b/frontend/components/planning.tsx @@ -243,20 +243,20 @@ const Planning: React.FC<{ event={eventSelected} onStartDateChange={(date) => { setEventSelected((ev) => { - if (ev) + if (ev && date) return { ...ev, - start: date, + start: format(date, "YYYY-MM-DD HH:MM"), }; return ev; }); }} onEndDateChange={(date) => { setEventSelected((ev) => { - if (ev) + if (ev && date) return { ...ev, - end: date, + end: format(date, "YYYY-MM-DD HH:MM"), }; return ev; }); diff --git a/frontend/hooks/use-file-upload.tsx b/frontend/hooks/use-file-upload.tsx index 806619f..90860d3 100644 --- a/frontend/hooks/use-file-upload.tsx +++ b/frontend/hooks/use-file-upload.tsx @@ -1,8 +1,8 @@ "use client"; import { API_URL } from "@/lib/constants"; +import { ApiResponse } from "@/types/types"; import { getCookie } from "cookies-next"; import { useState, useRef, useCallback } from "react"; -import { ApiResponse, useApi } from "./use-api"; interface UseFileUploadReturn { progress: number; diff --git a/frontend/hooks/use-login.tsx b/frontend/hooks/use-login.tsx index 519fd12..d7a0c69 100644 --- a/frontend/hooks/use-login.tsx +++ b/frontend/hooks/use-login.tsx @@ -1,9 +1,7 @@ "use client"; import { setCookie } from "cookies-next"; -import useApiMutation, { ApiResponse } from "./use-api"; -import { useEffect, useState } from "react"; -import { API_URL } from "@/lib/constants"; +import useApiMutation from "./use-api"; export interface LoginArgs { email: string; diff --git a/frontend/middleware.ts b/frontend/middleware.ts index 404163b..436f0a0 100644 --- a/frontend/middleware.ts +++ b/frontend/middleware.ts @@ -1,5 +1,5 @@ import { NextRequest, NextResponse } from "next/server"; -import { ApiResponse } from "./hooks/use-api"; +import { ApiResponse } from "./types/types"; import { API_URL } from "./lib/constants"; import IUser from "./interfaces/IUser"; diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 395c91a..cbada9a 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -7189,6 +7189,96 @@ "funding": { "url": "https://github.com/sponsors/colinhacks" } + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "15.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.1.4.tgz", + "integrity": "sha512-wBEMBs+np+R5ozN1F8Y8d/Dycns2COhRnkxRc+rvnbXke5uZBHkUGFgWxfTXn5rx7OLijuUhyfB+gC/ap58dDw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "15.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.1.4.tgz", + "integrity": "sha512-7sgf5rM7Z81V9w48F02Zz6DgEJulavC0jadab4ZsJ+K2sxMNK0/BtF8J8J3CxnsJN3DGcIdC260wEKssKTukUw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "15.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.1.4.tgz", + "integrity": "sha512-JaZlIMNaJenfd55kjaLWMfok+vWBlcRxqnRoZrhFQrhM1uAehP3R0+Aoe+bZOogqlZvAz53nY/k3ZyuKDtT2zQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "15.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.1.4.tgz", + "integrity": "sha512-7EBBjNoyTO2ipMDgCiORpwwOf5tIueFntKjcN3NK+GAQD7OzFJe84p7a2eQUeWdpzZvhVXuAtIen8QcH71ZCOQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "15.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.1.4.tgz", + "integrity": "sha512-JgFCiV4libQavwII+kncMCl30st0JVxpPOtzWcAI2jtum4HjYaclobKhj+JsRu5tFqMtA5CJIa0MvYyuu9xjjQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "15.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.1.4.tgz", + "integrity": "sha512-xxsJy9wzq7FR5SqPCUqdgSXiNXrMuidgckBa8nH9HtjjxsilgcN6VgXF6tZ3uEWuVEadotQJI8/9EQ6guTC4Yw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } } } }