diff --git a/back/src/main.rs b/back/src/main.rs index 7242d32..ad8f7f5 100644 --- a/back/src/main.rs +++ b/back/src/main.rs @@ -74,7 +74,7 @@ async fn main() -> Result<(), std::io::Error> { .service(api) .service(Files::new("/", "public").index_file("index.html")) }) - .bind(("0.0.0.0", 2486))? + .bind(("0.0.0.0", 8080))? .run() .await } diff --git a/docker-compose.yml b/docker-compose.yml index 9bcaab9..1e0df8d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: container_name: web restart: always ports: - - 8080:2486 + - 8080:8080 volumes: - ./back/data:/app/data diff --git a/dockerfile b/dockerfile index f092a14..d8e8f78 100644 --- a/dockerfile +++ b/dockerfile @@ -10,9 +10,9 @@ RUN cargo build --release FROM debian:bookworm-slim WORKDIR /app -RUN apt update && apt install -y libsqlite3-0 +RUN apt-get update & apt-get install -y extra-runtime-dependencies & rm -rf /var/lib/apt/lists/* COPY --from=front /app/dist /app/public COPY --from=back /app/target/release/back /app/back -EXPOSE 2486 +EXPOSE 8080 CMD ["/app/back"] diff --git a/front/package.json b/front/package.json index e1132b0..8bd44d7 100644 --- a/front/package.json +++ b/front/package.json @@ -12,8 +12,7 @@ "dependencies": { "react": "^18.3.1", "react-dom": "^18.3.1", - "react-router": "^7.0.2", - "react-router-dom": "^6.2.1" + "react-router": "^7.0.2" }, "devDependencies": { "@eslint/js": "^9.15.0", @@ -26,7 +25,6 @@ "globals": "^15.12.0", "typescript": "~5.6.2", "typescript-eslint": "^8.15.0", - "vite": "^6.0.1", - "react-router-dom": "^6.2.1" + "vite": "^6.0.1" } } diff --git a/front/public/pictures/sea.gif b/front/public/pictures/sea.gif deleted file mode 100644 index 78a4617..0000000 Binary files a/front/public/pictures/sea.gif and /dev/null differ diff --git a/front/src/components/ArticleCard.tsx b/front/src/components/ArticleCard.tsx deleted file mode 100644 index 6a02bb3..0000000 --- a/front/src/components/ArticleCard.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { ArticlePreview } from '../types' -import ButtonLink from './ButtonLink' - -export default function ArticleCard({ articlePreview }: { articlePreview: ArticlePreview }) { - return ( -
- Article preview -
-

{articlePreview.title}

-

{articlePreview.preview}

-
-
-
- ) -} \ No newline at end of file diff --git a/front/src/components/ArticlesSection.tsx b/front/src/components/ArticlesSection.tsx deleted file mode 100644 index a7b5df2..0000000 --- a/front/src/components/ArticlesSection.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { useEffect, useState } from "react"; -import ArticleCard from "./ArticleCard"; -import { ArticlePreview } from "../types"; - -export default function ArticlesSection() { - - const [articlePreviews, setArticlePreviews] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - - useEffect(() => { - fetch('/api/articles') - .then(response => response.json()) - .then((data: ArticlePreview[]) => setArticlePreviews(data)) - .catch(_ => setError('Failed to fetch articles')) - .finally(() => setLoading(false)); - }, []); - - return ( -
-

Articles

- {articlePreviews.map(articlePreview => ( - - ))} - {!loading && !error && articlePreviews.length === 0 &&

No articles found

} - {loading &&

Loading...

} - {error &&

{error}

} -
- ) -} diff --git a/front/src/components/Button.tsx b/front/src/components/Button.tsx deleted file mode 100644 index 654bda5..0000000 --- a/front/src/components/Button.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { ReactNode, MouseEventHandler } from 'react'; - -interface ButtonProps { - onClick: MouseEventHandler; - color: 'primary' | 'secondary'; - children: ReactNode; -} - -export default function Button({ onClick, color, children }: ButtonProps) { - return ( - - ) -} - diff --git a/front/src/components/ButtonLink.tsx b/front/src/components/ButtonLink.tsx deleted file mode 100644 index a8a4757..0000000 --- a/front/src/components/ButtonLink.tsx +++ /dev/null @@ -1,34 +0,0 @@ -interface ButtonLinkProps { - url: string; - color: 'primary' | 'secondary'; - text: string; -} - -export default function Button({ url, color, text }: ButtonLinkProps) { - return ( - {text} - ) -} - diff --git a/front/src/components/ClickableLink.tsx b/front/src/components/ClickableLink.tsx deleted file mode 100644 index 0096871..0000000 --- a/front/src/components/ClickableLink.tsx +++ /dev/null @@ -1,31 +0,0 @@ -interface ClickableLinkProps { - url:string; - text:string; -} - -export default function ClickableLink({url, text}: ClickableLinkProps) { - return (
- -
) -} \ No newline at end of file diff --git a/front/src/components/Footer.tsx b/front/src/components/Footer.tsx deleted file mode 100644 index 468812c..0000000 --- a/front/src/components/Footer.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import LogoButton from "./LogoButton" - -interface FooterProps { - bgcolor:string -} - -export default function Footer ({bgcolor}:FooterProps) { - return ( -
-
ENSIBS
RedCRAB
-
- -
-
- ) -} \ No newline at end of file diff --git a/front/src/components/FstSection.tsx b/front/src/components/FstSection.tsx deleted file mode 100644 index a978737..0000000 --- a/front/src/components/FstSection.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import Button from "./Button"; -import NavBar from "./NavBar"; - -interface FstSectionProps { - centertxt: string; - txtbt1:string; - txtbt2:string; - image:string; -} - -export default function FstSection ({centertxt, txtbt1, txtbt2, image}: FstSectionProps) { - return ( -
- -
-
-

{centertxt}


-
-
-
- ) -} \ No newline at end of file diff --git a/front/src/components/LogoButton.tsx b/front/src/components/LogoButton.tsx deleted file mode 100644 index bc41d3c..0000000 --- a/front/src/components/LogoButton.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import * as React from 'react'; - -interface LogoButtonProps { - url:string; - logo:string; - style?: React.CSSProperties; -} - -export default function LogoButton ({url, logo, style}: LogoButtonProps) { - return ( - - ) -} \ No newline at end of file diff --git a/front/src/components/NavBar.tsx b/front/src/components/NavBar.tsx deleted file mode 100644 index 4f1c35d..0000000 --- a/front/src/components/NavBar.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import LogoButton from '../components/LogoButton.tsx' -import ClickableLink from './ClickableLink.tsx'; -import RoundButton from './RoundButton.tsx'; - -export default function NavBar(){ - return ( - ); -} \ No newline at end of file diff --git a/front/src/components/RoundButton.tsx b/front/src/components/RoundButton.tsx deleted file mode 100644 index 4747d57..0000000 --- a/front/src/components/RoundButton.tsx +++ /dev/null @@ -1,32 +0,0 @@ -interface RoundButtonProps { - url:string; - bgcolor:string; - text:string; -} - -export default function RoundButton({url, bgcolor, text}: RoundButtonProps) { - return (
- -
) -} \ No newline at end of file diff --git a/front/src/index.css b/front/src/index.css deleted file mode 100644 index 328146f..0000000 --- a/front/src/index.css +++ /dev/null @@ -1,19 +0,0 @@ -/* Define theme colors */ -:root { - --color-verydarkblue: #00204a; - --color-darkblue: #005792; - --color-lightblue: #00bbf0; - --color-yellow: #fdb44b; - --color-white: #ffffff; - --color-black: #000000; - --color-gray: #f5f5f5; - --color-red: #ff0000; -} - -body { - margin: 0; -} - -footer { - text-align: center; -} \ No newline at end of file diff --git a/front/src/main.tsx b/front/src/main.tsx index d4ac604..ce00332 100644 --- a/front/src/main.tsx +++ b/front/src/main.tsx @@ -2,20 +2,13 @@ import { BrowserRouter, Route, Routes } from "react-router"; import { createRoot } from 'react-dom/client' import MainPage from "./pages/MainPage.tsx"; import GamePage from "./pages/GamePage.tsx"; -import ArticlePage from "./pages/ArticlePage.tsx"; -import './index.css' + createRoot(document.getElementById('root')!).render( - // Main page } /> - // Game page } /> - // Article page (dynamic route) - } /> - // Not found - Not Found
} /> - + , ) diff --git a/front/src/pages/ArticlePage.tsx b/front/src/pages/ArticlePage.tsx deleted file mode 100644 index 3ab05f8..0000000 --- a/front/src/pages/ArticlePage.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { useParams } from 'react-router-dom'; -import NavBar from '../components/NavBar'; -import Footer from '../components/Footer'; - -interface Article { - id: string; - title: string; - content: string; - author: string; - publishedAt: string; - editedAt: string; -} - -const ArticlePage: React.FC = () => { - const { id } = useParams<{ id: string }>(); - const [article, setArticle] = useState
(null); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - - useEffect(() => { - fetch(`/api/article/${id}`) - .then(response => response.json()) - .then(data => setArticle(data)) - .catch(_ => setError('Failed to fetch article')) - .finally(() => setLoading(false)); - }, [id]); - - if (loading) { - return
Loading...
; - } - - if (error) { - return
{error}
; - } - - if (!article) { - return
Article not found
; - } - - return ( -
- -
- Article preview -
-

{article.title}

-

écrit par {article.author} le {new Date(article.publishedAt).toLocaleDateString()} (Dernière modification le : {new Date(article.editedAt || article.publishedAt).toLocaleDateString()})

-
-

{article.content}

-
-
-
-
- ); -}; - -export default ArticlePage; \ No newline at end of file diff --git a/front/src/pages/MainPage.tsx b/front/src/pages/MainPage.tsx index a64aeef..248feb2 100644 --- a/front/src/pages/MainPage.tsx +++ b/front/src/pages/MainPage.tsx @@ -1,19 +1,10 @@ -import ArticlesSection from '../components/ArticlesSection.tsx' -import Footer from '../components/Footer.tsx' -import FstSection from '../components/FstSection.tsx' + + export default function MainPage() { return ( - <> -
- - -