From fd834ea84abe4f0a64bdc5d2d513f69e112c8821 Mon Sep 17 00:00:00 2001 From: cdricms <36056008+cdricms@users.noreply.github.com> Date: Tue, 14 Jan 2025 13:44:28 +0100 Subject: [PATCH] Setup docker for production and development Change ./init.sh to be an executable then run it. The default inner container ports are as followed: - Postgres: 5432:5432 - Backend: 3001:3000 - Frontend: 3000:3000 - Frontend dev: 8000 The backend image needs to be built: docker compose up -d --build --- .gitignore | 1 + backend/Dockerfile | 12 + backend/go.mod | 14 + backend/go.sum | 16 ++ backend/main.go | 28 ++ docker-compose.yaml | 44 ++- .dockerignore => frontend/.dockerignore | 0 {latosa-frontend => frontend}/.gitignore | 0 Dockerfile => frontend/Dockerfile | 2 +- .../app/(auth)/dashboard/page.tsx | 0 .../app/(auth)/layout.tsx | 0 .../app/(main)/contact/page.tsx | 0 .../app/(main)/history/[slug]/page.tsx | 0 .../app/(main)/history/page.tsx | 0 .../app/(main)/layout.tsx | 0 .../app/(main)/login/page.tsx | 0 .../app/(main)/page.tsx | 0 {latosa-frontend => frontend}/app/favicon.ico | Bin {latosa-frontend => frontend}/app/globals.css | 0 {latosa-frontend => frontend}/components.json | 0 .../components/app-sidebar.tsx | 0 frontend/components/blog.tsx | 118 ++++++++ .../components/blogItem.tsx | 46 +-- .../components/contact.tsx | 0 .../components/features.tsx | 0 .../components/footer.tsx | 0 .../components/gallery.tsx | 0 .../components/hero.tsx | 0 .../components/login-form.tsx | 0 .../components/nav-bar.tsx | 0 .../components/nav-main.tsx | 0 .../components/nav-projects.tsx | 0 .../components/nav-user.tsx | 0 .../components/team-switcher.tsx | 0 .../components/testimonial.tsx | 0 .../components/ui/accordion.tsx | 0 .../components/ui/avatar.tsx | 0 .../components/ui/badge.tsx | 0 .../components/ui/breadcrumb.tsx | 0 .../components/ui/button.tsx | 0 .../components/ui/card.tsx | 0 frontend/components/ui/carousel.tsx | 263 ++++++++++++++++++ .../components/ui/collapsible.tsx | 0 .../components/ui/dropdown-menu.tsx | 0 .../components/ui/input.tsx | 0 .../components/ui/label.tsx | 0 .../components/ui/navigation-menu.tsx | 0 .../components/ui/select.tsx | 0 .../components/ui/separator.tsx | 0 .../components/ui/sheet.tsx | 0 .../components/ui/sidebar.tsx | 0 .../components/ui/skeleton.tsx | 0 .../components/ui/textarea.tsx | 0 .../components/ui/tooltip.tsx | 0 {latosa-frontend => frontend}/dashboard.yaml | 0 {latosa-frontend => frontend}/deno.json | 0 {latosa-frontend => frontend}/deno.lock | 0 .../eslint.config.mjs | 0 .../hooks/use-mobile.tsx | 0 {latosa-frontend => frontend}/lib/utils.ts | 0 {latosa-frontend => frontend}/next.config.ts | 0 .../package-lock.json | 0 {latosa-frontend => frontend}/package.json | 2 +- .../postcss.config.mjs | 0 {latosa-frontend => frontend}/public/file.svg | 0 .../public/globe.svg | 0 {latosa-frontend => frontend}/public/next.svg | 0 .../public/vercel.svg | 0 .../public/window.svg | 0 .../tailwind.config.ts | 0 {latosa-frontend => frontend}/tsconfig.json | 0 init.sh | 4 + latosa-frontend/components/blog.tsx | 112 -------- latosa-frontend/components/ui/carousel.tsx | 262 ----------------- 74 files changed, 526 insertions(+), 398 deletions(-) create mode 100644 .gitignore create mode 100644 backend/Dockerfile create mode 100644 backend/go.mod create mode 100644 backend/go.sum create mode 100644 backend/main.go rename .dockerignore => frontend/.dockerignore (100%) rename {latosa-frontend => frontend}/.gitignore (100%) rename Dockerfile => frontend/Dockerfile (95%) rename {latosa-frontend => frontend}/app/(auth)/dashboard/page.tsx (100%) rename {latosa-frontend => frontend}/app/(auth)/layout.tsx (100%) rename {latosa-frontend => frontend}/app/(main)/contact/page.tsx (100%) rename {latosa-frontend => frontend}/app/(main)/history/[slug]/page.tsx (100%) rename {latosa-frontend => frontend}/app/(main)/history/page.tsx (100%) rename {latosa-frontend => frontend}/app/(main)/layout.tsx (100%) rename {latosa-frontend => frontend}/app/(main)/login/page.tsx (100%) rename {latosa-frontend => frontend}/app/(main)/page.tsx (100%) rename {latosa-frontend => frontend}/app/favicon.ico (100%) rename {latosa-frontend => frontend}/app/globals.css (100%) rename {latosa-frontend => frontend}/components.json (100%) rename {latosa-frontend => frontend}/components/app-sidebar.tsx (100%) create mode 100644 frontend/components/blog.tsx rename {latosa-frontend => frontend}/components/blogItem.tsx (50%) rename {latosa-frontend => frontend}/components/contact.tsx (100%) rename {latosa-frontend => frontend}/components/features.tsx (100%) rename {latosa-frontend => frontend}/components/footer.tsx (100%) rename {latosa-frontend => frontend}/components/gallery.tsx (100%) rename {latosa-frontend => frontend}/components/hero.tsx (100%) rename {latosa-frontend => frontend}/components/login-form.tsx (100%) rename {latosa-frontend => frontend}/components/nav-bar.tsx (100%) rename {latosa-frontend => frontend}/components/nav-main.tsx (100%) rename {latosa-frontend => frontend}/components/nav-projects.tsx (100%) rename {latosa-frontend => frontend}/components/nav-user.tsx (100%) rename {latosa-frontend => frontend}/components/team-switcher.tsx (100%) rename {latosa-frontend => frontend}/components/testimonial.tsx (100%) rename {latosa-frontend => frontend}/components/ui/accordion.tsx (100%) rename {latosa-frontend => frontend}/components/ui/avatar.tsx (100%) rename {latosa-frontend => frontend}/components/ui/badge.tsx (100%) rename {latosa-frontend => frontend}/components/ui/breadcrumb.tsx (100%) rename {latosa-frontend => frontend}/components/ui/button.tsx (100%) rename {latosa-frontend => frontend}/components/ui/card.tsx (100%) create mode 100644 frontend/components/ui/carousel.tsx rename {latosa-frontend => frontend}/components/ui/collapsible.tsx (100%) rename {latosa-frontend => frontend}/components/ui/dropdown-menu.tsx (100%) rename {latosa-frontend => frontend}/components/ui/input.tsx (100%) rename {latosa-frontend => frontend}/components/ui/label.tsx (100%) rename {latosa-frontend => frontend}/components/ui/navigation-menu.tsx (100%) rename {latosa-frontend => frontend}/components/ui/select.tsx (100%) rename {latosa-frontend => frontend}/components/ui/separator.tsx (100%) rename {latosa-frontend => frontend}/components/ui/sheet.tsx (100%) rename {latosa-frontend => frontend}/components/ui/sidebar.tsx (100%) rename {latosa-frontend => frontend}/components/ui/skeleton.tsx (100%) rename {latosa-frontend => frontend}/components/ui/textarea.tsx (100%) rename {latosa-frontend => frontend}/components/ui/tooltip.tsx (100%) rename {latosa-frontend => frontend}/dashboard.yaml (100%) rename {latosa-frontend => frontend}/deno.json (100%) rename {latosa-frontend => frontend}/deno.lock (100%) rename {latosa-frontend => frontend}/eslint.config.mjs (100%) rename {latosa-frontend => frontend}/hooks/use-mobile.tsx (100%) rename {latosa-frontend => frontend}/lib/utils.ts (100%) rename {latosa-frontend => frontend}/next.config.ts (100%) rename {latosa-frontend => frontend}/package-lock.json (100%) rename {latosa-frontend => frontend}/package.json (96%) rename {latosa-frontend => frontend}/postcss.config.mjs (100%) rename {latosa-frontend => frontend}/public/file.svg (100%) rename {latosa-frontend => frontend}/public/globe.svg (100%) rename {latosa-frontend => frontend}/public/next.svg (100%) rename {latosa-frontend => frontend}/public/vercel.svg (100%) rename {latosa-frontend => frontend}/public/window.svg (100%) rename {latosa-frontend => frontend}/tailwind.config.ts (100%) rename {latosa-frontend => frontend}/tsconfig.json (100%) create mode 100755 init.sh delete mode 100644 latosa-frontend/components/blog.tsx delete mode 100644 latosa-frontend/components/ui/carousel.tsx diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..3fc3480 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,12 @@ +FROM golang:alpine + +WORKDIR /app + +COPY . . + +RUN go mod download +RUN go mod tidy + +RUN go build main.go + +CMD ["./main"] diff --git a/backend/go.mod b/backend/go.mod new file mode 100644 index 0000000..dfc90c4 --- /dev/null +++ b/backend/go.mod @@ -0,0 +1,14 @@ +module fr.latosa-escrima + +go 1.23.4 + +require ( + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/joho/godotenv v1.5.1 // indirect + github.com/puzpuzpuz/xsync/v3 v3.4.0 // indirect + github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect + github.com/uptrace/bun v1.2.8 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + golang.org/x/sys v0.29.0 // indirect +) diff --git a/backend/go.sum b/backend/go.sum new file mode 100644 index 0000000..eeda9ee --- /dev/null +++ b/backend/go.sum @@ -0,0 +1,16 @@ +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/puzpuzpuz/xsync/v3 v3.4.0 h1:DuVBAdXuGFHv8adVXjWWZ63pJq+NRXOWVXlKDBZ+mJ4= +github.com/puzpuzpuz/xsync/v3 v3.4.0/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA= +github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= +github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= +github.com/uptrace/bun v1.2.8 h1:HEiLvy9wc7ehU5S02+O6NdV5BLz48lL4REPhTkMX3Dg= +github.com/uptrace/bun v1.2.8/go.mod h1:JBq0uBKsKqNT0Ccce1IAFZY337Wkf08c6F6qlmfOHE8= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= +github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= diff --git a/backend/main.go b/backend/main.go new file mode 100644 index 0000000..0294af1 --- /dev/null +++ b/backend/main.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "log" + "net/http" + "os" + + "github.com/joho/godotenv" +) + +func handler(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "

Hello, World!

") +} + +func main() { + err := godotenv.Load() + if err != nil { + log.Fatalf("Error loading .env file: %v", err) + } + port := os.Getenv("BACKEND_PORT") + http.HandleFunc("/", handler) + fmt.Printf("Serving on port %s\n", port) + err = http.ListenAndServe(fmt.Sprintf(":%s", port), nil) + if err != nil { + fmt.Printf("Error starting server: %s\n", err) + } +} diff --git a/docker-compose.yaml b/docker-compose.yaml index 67ecbfe..d6a3d93 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,10 +1,44 @@ services: - latosa-escrima: - build: - context: . - dockerfile: Dockerfile + latosa-escrima.fr-frontend: + container_name: latosa-frontend + image: cems.dev:5000/latosa-escrima.fr:latest ports: - - "3000:3000" + - 3000:${FRONTEND_PORT} environment: - NODE_ENV=production + - FRONTEND_PORT=${FRONTEND_PORT} restart: always # Ensures the container restarts on failure or Docker restart + networks: + - le-network + latosa-escrima.fr-backend: + container_name: latosa-backend + build: + context: ./backend/ + dockerfile: Dockerfile + env_file: .env + environment: + - PORT="3001" + ports: + - "3001:${BACKEND_PORT}" + networks: + - le-network + psql: + container_name: latosa-database + image: postgres:17.2-alpine + restart: always + environment: + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: ${POSTGRES_DB} + ports: + - "5432:5432" + volumes: + - le-data:/var/lib/postgresql/data + networks: + - le-network + +volumes: + le-data: + +networks: + le-network: diff --git a/.dockerignore b/frontend/.dockerignore similarity index 100% rename from .dockerignore rename to frontend/.dockerignore diff --git a/latosa-frontend/.gitignore b/frontend/.gitignore similarity index 100% rename from latosa-frontend/.gitignore rename to frontend/.gitignore diff --git a/Dockerfile b/frontend/Dockerfile similarity index 95% rename from Dockerfile rename to frontend/Dockerfile index cd099dd..7f6e287 100644 --- a/Dockerfile +++ b/frontend/Dockerfile @@ -5,7 +5,7 @@ FROM denoland/deno:alpine WORKDIR /app # Copy project files -COPY ./latosa-frontend/ . +COPY . . ENV NODE_ENV=production RUN deno install diff --git a/latosa-frontend/app/(auth)/dashboard/page.tsx b/frontend/app/(auth)/dashboard/page.tsx similarity index 100% rename from latosa-frontend/app/(auth)/dashboard/page.tsx rename to frontend/app/(auth)/dashboard/page.tsx diff --git a/latosa-frontend/app/(auth)/layout.tsx b/frontend/app/(auth)/layout.tsx similarity index 100% rename from latosa-frontend/app/(auth)/layout.tsx rename to frontend/app/(auth)/layout.tsx diff --git a/latosa-frontend/app/(main)/contact/page.tsx b/frontend/app/(main)/contact/page.tsx similarity index 100% rename from latosa-frontend/app/(main)/contact/page.tsx rename to frontend/app/(main)/contact/page.tsx diff --git a/latosa-frontend/app/(main)/history/[slug]/page.tsx b/frontend/app/(main)/history/[slug]/page.tsx similarity index 100% rename from latosa-frontend/app/(main)/history/[slug]/page.tsx rename to frontend/app/(main)/history/[slug]/page.tsx diff --git a/latosa-frontend/app/(main)/history/page.tsx b/frontend/app/(main)/history/page.tsx similarity index 100% rename from latosa-frontend/app/(main)/history/page.tsx rename to frontend/app/(main)/history/page.tsx diff --git a/latosa-frontend/app/(main)/layout.tsx b/frontend/app/(main)/layout.tsx similarity index 100% rename from latosa-frontend/app/(main)/layout.tsx rename to frontend/app/(main)/layout.tsx diff --git a/latosa-frontend/app/(main)/login/page.tsx b/frontend/app/(main)/login/page.tsx similarity index 100% rename from latosa-frontend/app/(main)/login/page.tsx rename to frontend/app/(main)/login/page.tsx diff --git a/latosa-frontend/app/(main)/page.tsx b/frontend/app/(main)/page.tsx similarity index 100% rename from latosa-frontend/app/(main)/page.tsx rename to frontend/app/(main)/page.tsx diff --git a/latosa-frontend/app/favicon.ico b/frontend/app/favicon.ico similarity index 100% rename from latosa-frontend/app/favicon.ico rename to frontend/app/favicon.ico diff --git a/latosa-frontend/app/globals.css b/frontend/app/globals.css similarity index 100% rename from latosa-frontend/app/globals.css rename to frontend/app/globals.css diff --git a/latosa-frontend/components.json b/frontend/components.json similarity index 100% rename from latosa-frontend/components.json rename to frontend/components.json diff --git a/latosa-frontend/components/app-sidebar.tsx b/frontend/components/app-sidebar.tsx similarity index 100% rename from latosa-frontend/components/app-sidebar.tsx rename to frontend/components/app-sidebar.tsx diff --git a/frontend/components/blog.tsx b/frontend/components/blog.tsx new file mode 100644 index 0000000..a17a798 --- /dev/null +++ b/frontend/components/blog.tsx @@ -0,0 +1,118 @@ +import { ArrowRight } from "lucide-react"; + +import { Button } from "@/components/ui/button"; + +export interface BlogInterface { + id: string; + slug: string; + title: string; + content: string; + label: string; + author: string; + published: string; +} + +export interface BlogSummaryInterface extends BlogInterface { + summary: string; + image: string; + href: string; +} + +export const posts: BlogSummaryInterface[] = [ + { + id: "a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6", + slug: "tech-advancements-2025", + title: "Tech Advancements in 2025", + content: + "The year 2025 promises groundbreaking technologies that will reshape industries. In this article, we explore the key advancements that could transform how we work, live, and communicate.", + label: "Technology", + author: "d3f5e6g7-h8i9j0k1-l2m3n4o5p6q7", + published: "2025-01-14", + summary: + "A look at the tech trends to expect in 2025 and beyond, from AI to quantum computing.", + image: "https://via.placeholder.com/600x400?text=Tech+2025", + href: "history/tech-advancements-2025", + }, + { + id: "f7g8h9i0-j1k2l3m4-n5o6p7q8r9s0t1u2v3", + slug: "sustainable-fashion-2025", + title: "Sustainable Fashion in 2025", + content: + "Sustainability is no longer a trend, but a movement within the fashion industry. This article discusses how eco-friendly practices are influencing fashion designs and consumer behavior in 2025.", + label: "Fashion", + author: "w4x5y6z7-a8b9c0d1-e2f3g4h5i6j7", + published: "2025-01-12", + summary: + "Exploring how sustainable fashion is evolving in 2025 with innovative materials and ethical brands.", + image: "https://via.placeholder.com/600x400?text=Sustainable+Fashion", + href: "history/sustainable-fashion-2025", + }, + { + id: "v1w2x3y4-z5a6b7c8-d9e0f1g2h3i4j5k6l7", + slug: "mental-health-awareness-2025", + title: "Mental Health Awareness in 2025", + content: + "As mental health awareness continues to grow, 2025 brings new challenges and opportunities to address psychological well-being. This article focuses on emerging trends in mental health support and public perception.", + label: "Health", + author: "m8n9o0p1-q2r3s4t5-u6v7w8x9y0z1a2b3", + published: "2025-01-10", + summary: + "Highlighting the importance of mental health awareness in 2025, focusing on new treatments and societal changes.", + image: "https://via.placeholder.com/600x400?text=Mental+Health+2025", + href: "/history/mental-health-awareness-2025", + }, +]; + +const Blog = () => { + return ( +
+
+
+

+ En savoir plus sur ce sport +

+

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. + Elig doloremque mollitia fugiat omnis! Porro facilis quo + animi consequatur. Explicabo. +

+ +
+
+ {posts.map((post) => ( + +
+ {post.title} +
+
+

+ {post.title} +

+

+ {post.summary} +

+

+ Read more + +

+
+
+ ))} +
+
+
+ ); +}; + +export default Blog; diff --git a/latosa-frontend/components/blogItem.tsx b/frontend/components/blogItem.tsx similarity index 50% rename from latosa-frontend/components/blogItem.tsx rename to frontend/components/blogItem.tsx index e20ff0d..58bdec1 100644 --- a/latosa-frontend/components/blogItem.tsx +++ b/frontend/components/blogItem.tsx @@ -1,17 +1,15 @@ import { BlogInterface } from "@/components/blog"; export interface BlogItemParams { - slug: string - title_style: string, - subtitle_style: string, - p_style: string, - default_img: string - blog_content: BlogInterface + slug: string; + title_style: string; + subtitle_style: string; + p_style: string; + default_img: string; + blog_content: BlogInterface; } -export default function BlogItem({ params } - : { params: BlogItemParams } -) { +export default function BlogItem({ params }: { params: BlogItemParams }) { return (
@@ -24,7 +22,11 @@ export default function BlogItem({ params }

Subtitle 1

- Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti architecto incidunt, hic in consectetur eligendi nobis numquam tenetur sit repellat et unde, maxime ducimus autem esse temporibus omnis eum molestias! + Lorem ipsum dolor sit amet, consectetur adipisicing + elit. Deleniti architecto incidunt, hic in + consectetur eligendi nobis numquam tenetur sit + repellat et unde, maxime ducimus autem esse + temporibus omnis eum molestias!

@@ -33,33 +35,43 @@ export default function BlogItem({ params } alt={params.slug} className="aspect-[16/9] mb-5 rounded-sm h-full w-full object-cover object-center" /> -

Subtitle 2

- Lorem ipsm dolor sit amet, consectetur adipisicing elit. Deleniti architecto incidunt, hic in consectetur eligendi nobis numquam tenetur sit repellat et unde, maxime ducimus autem esse temporibus omnis eum molestias! + Lorem ipsm dolor sit amet, consectetur adipisicing + elit. Deleniti architecto incidunt, hic in + consectetur eligendi nobis numquam tenetur sit + repellat et unde, maxime ducimus autem esse + temporibus omnis eum molestias!

{params.slug} -

Subtitle 3

- Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti architecto incidunt, hic in consectetur eligendi nobis numquam tenetur sit repellat et unde, maxime ducimus autem esse temporibus omnis eum molestias! + Lorem ipsum dolor sit amet, consectetur adipisicing + elit. Deleniti architecto incidunt, hic in + consectetur eligendi nobis numquam tenetur sit + repellat et unde, maxime ducimus autem esse + temporibus omnis eum molestias!

- Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti architecto incidunt, hic in consectetur eligendi nobis numquam tenetur sit repellat et unde, maxime ducimus autem esse temporibus omnis eum molestias! + Lorem ipsum dolor sit amet, consectetur adipisicing + elit. Deleniti architecto incidunt, hic in + consectetur eligendi nobis numquam tenetur sit + repellat et unde, maxime ducimus autem esse + temporibus omnis eum molestias!

- ) + ); } diff --git a/latosa-frontend/components/contact.tsx b/frontend/components/contact.tsx similarity index 100% rename from latosa-frontend/components/contact.tsx rename to frontend/components/contact.tsx diff --git a/latosa-frontend/components/features.tsx b/frontend/components/features.tsx similarity index 100% rename from latosa-frontend/components/features.tsx rename to frontend/components/features.tsx diff --git a/latosa-frontend/components/footer.tsx b/frontend/components/footer.tsx similarity index 100% rename from latosa-frontend/components/footer.tsx rename to frontend/components/footer.tsx diff --git a/latosa-frontend/components/gallery.tsx b/frontend/components/gallery.tsx similarity index 100% rename from latosa-frontend/components/gallery.tsx rename to frontend/components/gallery.tsx diff --git a/latosa-frontend/components/hero.tsx b/frontend/components/hero.tsx similarity index 100% rename from latosa-frontend/components/hero.tsx rename to frontend/components/hero.tsx diff --git a/latosa-frontend/components/login-form.tsx b/frontend/components/login-form.tsx similarity index 100% rename from latosa-frontend/components/login-form.tsx rename to frontend/components/login-form.tsx diff --git a/latosa-frontend/components/nav-bar.tsx b/frontend/components/nav-bar.tsx similarity index 100% rename from latosa-frontend/components/nav-bar.tsx rename to frontend/components/nav-bar.tsx diff --git a/latosa-frontend/components/nav-main.tsx b/frontend/components/nav-main.tsx similarity index 100% rename from latosa-frontend/components/nav-main.tsx rename to frontend/components/nav-main.tsx diff --git a/latosa-frontend/components/nav-projects.tsx b/frontend/components/nav-projects.tsx similarity index 100% rename from latosa-frontend/components/nav-projects.tsx rename to frontend/components/nav-projects.tsx diff --git a/latosa-frontend/components/nav-user.tsx b/frontend/components/nav-user.tsx similarity index 100% rename from latosa-frontend/components/nav-user.tsx rename to frontend/components/nav-user.tsx diff --git a/latosa-frontend/components/team-switcher.tsx b/frontend/components/team-switcher.tsx similarity index 100% rename from latosa-frontend/components/team-switcher.tsx rename to frontend/components/team-switcher.tsx diff --git a/latosa-frontend/components/testimonial.tsx b/frontend/components/testimonial.tsx similarity index 100% rename from latosa-frontend/components/testimonial.tsx rename to frontend/components/testimonial.tsx diff --git a/latosa-frontend/components/ui/accordion.tsx b/frontend/components/ui/accordion.tsx similarity index 100% rename from latosa-frontend/components/ui/accordion.tsx rename to frontend/components/ui/accordion.tsx diff --git a/latosa-frontend/components/ui/avatar.tsx b/frontend/components/ui/avatar.tsx similarity index 100% rename from latosa-frontend/components/ui/avatar.tsx rename to frontend/components/ui/avatar.tsx diff --git a/latosa-frontend/components/ui/badge.tsx b/frontend/components/ui/badge.tsx similarity index 100% rename from latosa-frontend/components/ui/badge.tsx rename to frontend/components/ui/badge.tsx diff --git a/latosa-frontend/components/ui/breadcrumb.tsx b/frontend/components/ui/breadcrumb.tsx similarity index 100% rename from latosa-frontend/components/ui/breadcrumb.tsx rename to frontend/components/ui/breadcrumb.tsx diff --git a/latosa-frontend/components/ui/button.tsx b/frontend/components/ui/button.tsx similarity index 100% rename from latosa-frontend/components/ui/button.tsx rename to frontend/components/ui/button.tsx diff --git a/latosa-frontend/components/ui/card.tsx b/frontend/components/ui/card.tsx similarity index 100% rename from latosa-frontend/components/ui/card.tsx rename to frontend/components/ui/card.tsx diff --git a/frontend/components/ui/carousel.tsx b/frontend/components/ui/carousel.tsx new file mode 100644 index 0000000..c72835e --- /dev/null +++ b/frontend/components/ui/carousel.tsx @@ -0,0 +1,263 @@ +"use client"; + +import * as React from "react"; +import useEmblaCarousel, { + type UseEmblaCarouselType, +} from "embla-carousel-react"; +import { ArrowLeft, ArrowRight } from "lucide-react"; + +import { cn } from "@/lib/utils"; +import { Button } from "@/components/ui/button"; + +type CarouselApi = UseEmblaCarouselType[1]; +type UseCarouselParameters = Parameters; +type CarouselOptions = UseCarouselParameters[0]; +type CarouselPlugin = UseCarouselParameters[1]; + +type CarouselProps = { + opts?: CarouselOptions; + plugins?: CarouselPlugin; + orientation?: "horizontal" | "vertical"; + setApi?: (api: CarouselApi) => void; +}; + +type CarouselContextProps = { + carouselRef: ReturnType[0]; + api: ReturnType[1]; + scrollPrev: () => void; + scrollNext: () => void; + canScrollPrev: boolean; + canScrollNext: boolean; +} & CarouselProps; + +const CarouselContext = React.createContext(null); + +function useCarousel() { + const context = React.useContext(CarouselContext); + + if (!context) { + throw new Error("useCarousel must be used within a "); + } + + return context; +} + +const Carousel = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes & CarouselProps +>( + ( + { + orientation = "horizontal", + opts, + setApi, + plugins, + className, + children, + ...props + }, + ref, + ) => { + const [carouselRef, api] = useEmblaCarousel( + { + ...opts, + axis: orientation === "horizontal" ? "x" : "y", + }, + plugins, + ); + const [canScrollPrev, setCanScrollPrev] = React.useState(false); + const [canScrollNext, setCanScrollNext] = React.useState(false); + + const onSelect = React.useCallback((api: CarouselApi) => { + if (!api) { + return; + } + + setCanScrollPrev(api.canScrollPrev()); + setCanScrollNext(api.canScrollNext()); + }, []); + + const scrollPrev = React.useCallback(() => { + api?.scrollPrev(); + }, [api]); + + const scrollNext = React.useCallback(() => { + api?.scrollNext(); + }, [api]); + + const handleKeyDown = React.useCallback( + (event: React.KeyboardEvent) => { + if (event.key === "ArrowLeft") { + event.preventDefault(); + scrollPrev(); + } else if (event.key === "ArrowRight") { + event.preventDefault(); + scrollNext(); + } + }, + [scrollPrev, scrollNext], + ); + + React.useEffect(() => { + if (!api || !setApi) { + return; + } + + setApi(api); + }, [api, setApi]); + + React.useEffect(() => { + if (!api) { + return; + } + + onSelect(api); + api.on("reInit", onSelect); + api.on("select", onSelect); + + return () => { + api?.off("select", onSelect); + }; + }, [api, onSelect]); + + return ( + +
+ {children} +
+
+ ); + }, +); +Carousel.displayName = "Carousel"; + +const CarouselContent = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => { + const { carouselRef, orientation } = useCarousel(); + + return ( +
+
+
+ ); +}); +CarouselContent.displayName = "CarouselContent"; + +const CarouselItem = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => { + const { orientation } = useCarousel(); + + return ( +
+ ); +}); +CarouselItem.displayName = "CarouselItem"; + +const CarouselPrevious = React.forwardRef< + HTMLButtonElement, + React.ComponentProps +>(({ className, variant = "outline", size = "icon", ...props }, ref) => { + const { orientation, scrollPrev, canScrollPrev } = useCarousel(); + + return ( + + ); +}); +CarouselPrevious.displayName = "CarouselPrevious"; + +const CarouselNext = React.forwardRef< + HTMLButtonElement, + React.ComponentProps +>(({ className, variant = "outline", size = "icon", ...props }, ref) => { + const { orientation, scrollNext, canScrollNext } = useCarousel(); + + return ( + + ); +}); +CarouselNext.displayName = "CarouselNext"; + +export { + type CarouselApi, + Carousel, + CarouselContent, + CarouselItem, + CarouselPrevious, + CarouselNext, +}; diff --git a/latosa-frontend/components/ui/collapsible.tsx b/frontend/components/ui/collapsible.tsx similarity index 100% rename from latosa-frontend/components/ui/collapsible.tsx rename to frontend/components/ui/collapsible.tsx diff --git a/latosa-frontend/components/ui/dropdown-menu.tsx b/frontend/components/ui/dropdown-menu.tsx similarity index 100% rename from latosa-frontend/components/ui/dropdown-menu.tsx rename to frontend/components/ui/dropdown-menu.tsx diff --git a/latosa-frontend/components/ui/input.tsx b/frontend/components/ui/input.tsx similarity index 100% rename from latosa-frontend/components/ui/input.tsx rename to frontend/components/ui/input.tsx diff --git a/latosa-frontend/components/ui/label.tsx b/frontend/components/ui/label.tsx similarity index 100% rename from latosa-frontend/components/ui/label.tsx rename to frontend/components/ui/label.tsx diff --git a/latosa-frontend/components/ui/navigation-menu.tsx b/frontend/components/ui/navigation-menu.tsx similarity index 100% rename from latosa-frontend/components/ui/navigation-menu.tsx rename to frontend/components/ui/navigation-menu.tsx diff --git a/latosa-frontend/components/ui/select.tsx b/frontend/components/ui/select.tsx similarity index 100% rename from latosa-frontend/components/ui/select.tsx rename to frontend/components/ui/select.tsx diff --git a/latosa-frontend/components/ui/separator.tsx b/frontend/components/ui/separator.tsx similarity index 100% rename from latosa-frontend/components/ui/separator.tsx rename to frontend/components/ui/separator.tsx diff --git a/latosa-frontend/components/ui/sheet.tsx b/frontend/components/ui/sheet.tsx similarity index 100% rename from latosa-frontend/components/ui/sheet.tsx rename to frontend/components/ui/sheet.tsx diff --git a/latosa-frontend/components/ui/sidebar.tsx b/frontend/components/ui/sidebar.tsx similarity index 100% rename from latosa-frontend/components/ui/sidebar.tsx rename to frontend/components/ui/sidebar.tsx diff --git a/latosa-frontend/components/ui/skeleton.tsx b/frontend/components/ui/skeleton.tsx similarity index 100% rename from latosa-frontend/components/ui/skeleton.tsx rename to frontend/components/ui/skeleton.tsx diff --git a/latosa-frontend/components/ui/textarea.tsx b/frontend/components/ui/textarea.tsx similarity index 100% rename from latosa-frontend/components/ui/textarea.tsx rename to frontend/components/ui/textarea.tsx diff --git a/latosa-frontend/components/ui/tooltip.tsx b/frontend/components/ui/tooltip.tsx similarity index 100% rename from latosa-frontend/components/ui/tooltip.tsx rename to frontend/components/ui/tooltip.tsx diff --git a/latosa-frontend/dashboard.yaml b/frontend/dashboard.yaml similarity index 100% rename from latosa-frontend/dashboard.yaml rename to frontend/dashboard.yaml diff --git a/latosa-frontend/deno.json b/frontend/deno.json similarity index 100% rename from latosa-frontend/deno.json rename to frontend/deno.json diff --git a/latosa-frontend/deno.lock b/frontend/deno.lock similarity index 100% rename from latosa-frontend/deno.lock rename to frontend/deno.lock diff --git a/latosa-frontend/eslint.config.mjs b/frontend/eslint.config.mjs similarity index 100% rename from latosa-frontend/eslint.config.mjs rename to frontend/eslint.config.mjs diff --git a/latosa-frontend/hooks/use-mobile.tsx b/frontend/hooks/use-mobile.tsx similarity index 100% rename from latosa-frontend/hooks/use-mobile.tsx rename to frontend/hooks/use-mobile.tsx diff --git a/latosa-frontend/lib/utils.ts b/frontend/lib/utils.ts similarity index 100% rename from latosa-frontend/lib/utils.ts rename to frontend/lib/utils.ts diff --git a/latosa-frontend/next.config.ts b/frontend/next.config.ts similarity index 100% rename from latosa-frontend/next.config.ts rename to frontend/next.config.ts diff --git a/latosa-frontend/package-lock.json b/frontend/package-lock.json similarity index 100% rename from latosa-frontend/package-lock.json rename to frontend/package-lock.json diff --git a/latosa-frontend/package.json b/frontend/package.json similarity index 96% rename from latosa-frontend/package.json rename to frontend/package.json index d0dcc32..2d85ca9 100644 --- a/latosa-frontend/package.json +++ b/frontend/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev --turbopack", + "dev": "next dev --turbopack -p 8000", "build": "next build", "start": "next start", "lint": "next lint" diff --git a/latosa-frontend/postcss.config.mjs b/frontend/postcss.config.mjs similarity index 100% rename from latosa-frontend/postcss.config.mjs rename to frontend/postcss.config.mjs diff --git a/latosa-frontend/public/file.svg b/frontend/public/file.svg similarity index 100% rename from latosa-frontend/public/file.svg rename to frontend/public/file.svg diff --git a/latosa-frontend/public/globe.svg b/frontend/public/globe.svg similarity index 100% rename from latosa-frontend/public/globe.svg rename to frontend/public/globe.svg diff --git a/latosa-frontend/public/next.svg b/frontend/public/next.svg similarity index 100% rename from latosa-frontend/public/next.svg rename to frontend/public/next.svg diff --git a/latosa-frontend/public/vercel.svg b/frontend/public/vercel.svg similarity index 100% rename from latosa-frontend/public/vercel.svg rename to frontend/public/vercel.svg diff --git a/latosa-frontend/public/window.svg b/frontend/public/window.svg similarity index 100% rename from latosa-frontend/public/window.svg rename to frontend/public/window.svg diff --git a/latosa-frontend/tailwind.config.ts b/frontend/tailwind.config.ts similarity index 100% rename from latosa-frontend/tailwind.config.ts rename to frontend/tailwind.config.ts diff --git a/latosa-frontend/tsconfig.json b/frontend/tsconfig.json similarity index 100% rename from latosa-frontend/tsconfig.json rename to frontend/tsconfig.json diff --git a/init.sh b/init.sh new file mode 100755 index 0000000..acd3dad --- /dev/null +++ b/init.sh @@ -0,0 +1,4 @@ +#!/usr/bin/sh +printf "POSTGRES_USER=\nPOSTGRES_PASSWORD=\nPOSTGRES_DB=\n# Docker inner port container\nPOSTGRES_PORT=5432\nBACKEND_PORT=3000\nFRONTEND_PORT=3000\n" > .env +ln $(pwd)/.env $(pwd)/backend +ln $(pwd)/.env $(pwd)/frontend diff --git a/latosa-frontend/components/blog.tsx b/latosa-frontend/components/blog.tsx deleted file mode 100644 index a898b63..0000000 --- a/latosa-frontend/components/blog.tsx +++ /dev/null @@ -1,112 +0,0 @@ -import { ArrowRight } from "lucide-react"; - -import { Button } from "@/components/ui/button"; - -export interface BlogInterface { - id: string, - slug: string, - title: string, - content: string, - label: string, - author: string, - published: string, -} - -export interface BlogSummaryInterface extends BlogInterface { - summary: string, - image: string, - href: string -} - -export const posts: BlogSummaryInterface[] = [ - { - id: 'a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6', - slug: 'tech-advancements-2025', - title: 'Tech Advancements in 2025', - content: 'The year 2025 promises groundbreaking technologies that will reshape industries. In this article, we explore the key advancements that could transform how we work, live, and communicate.', - label: 'Technology', - author: 'd3f5e6g7-h8i9j0k1-l2m3n4o5p6q7', - published: '2025-01-14', - summary: 'A look at the tech trends to expect in 2025 and beyond, from AI to quantum computing.', - image: 'https://via.placeholder.com/600x400?text=Tech+2025', - href: 'history/tech-advancements-2025' - }, - { - id: 'f7g8h9i0-j1k2l3m4-n5o6p7q8r9s0t1u2v3', - slug: 'sustainable-fashion-2025', - title: 'Sustainable Fashion in 2025', - content: 'Sustainability is no longer a trend, but a movement within the fashion industry. This article discusses how eco-friendly practices are influencing fashion designs and consumer behavior in 2025.', - label: 'Fashion', - author: 'w4x5y6z7-a8b9c0d1-e2f3g4h5i6j7', - published: '2025-01-12', - summary: 'Exploring how sustainable fashion is evolving in 2025 with innovative materials and ethical brands.', - image: 'https://via.placeholder.com/600x400?text=Sustainable+Fashion', - href: 'history/sustainable-fashion-2025' - }, - { - id: 'v1w2x3y4-z5a6b7c8-d9e0f1g2h3i4j5k6l7', - slug: 'mental-health-awareness-2025', - title: 'Mental Health Awareness in 2025', - content: 'As mental health awareness continues to grow, 2025 brings new challenges and opportunities to address psychological well-being. This article focuses on emerging trends in mental health support and public perception.', - label: 'Health', - author: 'm8n9o0p1-q2r3s4t5-u6v7w8x9y0z1a2b3', - published: '2025-01-10', - summary: 'Highlighting the importance of mental health awareness in 2025, focusing on new treatments and societal changes.', - image: 'https://via.placeholder.com/600x400?text=Mental+Health+2025', - href: '/history/mental-health-awareness-2025' - } -]; - -const Blog = () => { - return ( -
-
-
-

- En savoir plus sur ce sport -

-

- Lorem ipsum dolor sit amet consectetur adipisicing elit. Elig - doloremque mollitia fugiat omnis! Porro facilis quo animi - consequatur. Explicabo. -

- -
- -
-
- ); -}; - -export default Blog; diff --git a/latosa-frontend/components/ui/carousel.tsx b/latosa-frontend/components/ui/carousel.tsx deleted file mode 100644 index ec505d0..0000000 --- a/latosa-frontend/components/ui/carousel.tsx +++ /dev/null @@ -1,262 +0,0 @@ -"use client" - -import * as React from "react" -import useEmblaCarousel, { - type UseEmblaCarouselType, -} from "embla-carousel-react" -import { ArrowLeft, ArrowRight } from "lucide-react" - -import { cn } from "@/lib/utils" -import { Button } from "@/components/ui/button" - -type CarouselApi = UseEmblaCarouselType[1] -type UseCarouselParameters = Parameters -type CarouselOptions = UseCarouselParameters[0] -type CarouselPlugin = UseCarouselParameters[1] - -type CarouselProps = { - opts?: CarouselOptions - plugins?: CarouselPlugin - orientation?: "horizontal" | "vertical" - setApi?: (api: CarouselApi) => void -} - -type CarouselContextProps = { - carouselRef: ReturnType[0] - api: ReturnType[1] - scrollPrev: () => void - scrollNext: () => void - canScrollPrev: boolean - canScrollNext: boolean -} & CarouselProps - -const CarouselContext = React.createContext(null) - -function useCarousel() { - const context = React.useContext(CarouselContext) - - if (!context) { - throw new Error("useCarousel must be used within a ") - } - - return context -} - -const Carousel = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes & CarouselProps ->( - ( - { - orientation = "horizontal", - opts, - setApi, - plugins, - className, - children, - ...props - }, - ref - ) => { - const [carouselRef, api] = useEmblaCarousel( - { - ...opts, - axis: orientation === "horizontal" ? "x" : "y", - }, - plugins - ) - const [canScrollPrev, setCanScrollPrev] = React.useState(false) - const [canScrollNext, setCanScrollNext] = React.useState(false) - - const onSelect = React.useCallback((api: CarouselApi) => { - if (!api) { - return - } - - setCanScrollPrev(api.canScrollPrev()) - setCanScrollNext(api.canScrollNext()) - }, []) - - const scrollPrev = React.useCallback(() => { - api?.scrollPrev() - }, [api]) - - const scrollNext = React.useCallback(() => { - api?.scrollNext() - }, [api]) - - const handleKeyDown = React.useCallback( - (event: React.KeyboardEvent) => { - if (event.key === "ArrowLeft") { - event.preventDefault() - scrollPrev() - } else if (event.key === "ArrowRight") { - event.preventDefault() - scrollNext() - } - }, - [scrollPrev, scrollNext] - ) - - React.useEffect(() => { - if (!api || !setApi) { - return - } - - setApi(api) - }, [api, setApi]) - - React.useEffect(() => { - if (!api) { - return - } - - onSelect(api) - api.on("reInit", onSelect) - api.on("select", onSelect) - - return () => { - api?.off("select", onSelect) - } - }, [api, onSelect]) - - return ( - -
- {children} -
-
- ) - } -) -Carousel.displayName = "Carousel" - -const CarouselContent = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => { - const { carouselRef, orientation } = useCarousel() - - return ( -
-
-
- ) -}) -CarouselContent.displayName = "CarouselContent" - -const CarouselItem = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => { - const { orientation } = useCarousel() - - return ( -
- ) -}) -CarouselItem.displayName = "CarouselItem" - -const CarouselPrevious = React.forwardRef< - HTMLButtonElement, - React.ComponentProps ->(({ className, variant = "outline", size = "icon", ...props }, ref) => { - const { orientation, scrollPrev, canScrollPrev } = useCarousel() - - return ( - - ) -}) -CarouselPrevious.displayName = "CarouselPrevious" - -const CarouselNext = React.forwardRef< - HTMLButtonElement, - React.ComponentProps ->(({ className, variant = "outline", size = "icon", ...props }, ref) => { - const { orientation, scrollNext, canScrollNext } = useCarousel() - - return ( - - ) -}) -CarouselNext.displayName = "CarouselNext" - -export { - type CarouselApi, - Carousel, - CarouselContent, - CarouselItem, - CarouselPrevious, - CarouselNext, -}