Compare commits

...

7 commits

Author SHA1 Message Date
iMax
cbae2746fd Merge branch 'main_page' into main 2024-12-06 05:07:10 +01:00
iMax
12fa0684a8 Changement de nom d'application. 2024-12-06 05:04:36 +01:00
iMax
3794ccd70d Merge branch 'main_page' of ssh://git.leizour.fr:222/RedCrab/projet-nuitinfo-2024 into main_page 2024-12-06 04:53:32 +01:00
iMax
5bb2ac3f9b - Mise à jour de la DA de la main page.
- Ajout de data temporaire pour les articles.
2024-12-06 04:43:17 +01:00
=
71a829e726 Edit hero banner 2024-12-06 04:06:07 +01:00
iMax
1de47f3fb8 Hot fix 2024-12-06 03:51:26 +01:00
iMax
17affb3297 Merge branch 'main' of ssh://git.leizour.fr:222/RedCrab/projet-nuitinfo-2024 into main_page 2024-12-06 03:50:44 +01:00
11 changed files with 79 additions and 37 deletions

View file

@ -4,7 +4,8 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>EcoMarin</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=sailing" />
</head>
<body>
<div id="root"></div>

View file

@ -13,7 +13,7 @@ export default function ArticleCard({ articlePreview }: { articlePreview: Articl
margin: '20px',
padding: '1.25em',
paddingBottom: '1em',
flex: '27%',
flex: '0 1 30%',
textAlign: 'left',
}}>
<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fimages8.alphacoders.com%2F438%2F438396.jpg&f=1&nofb=1&ipt=14796576c139b58db62d2d2098392ef2fbaee77911040f7c0d98ab65a69c4644&ipo=images" alt="Article preview" style={{

View file

@ -8,16 +8,48 @@ export default function ArticlesSection() {
const [loading, setLoading] = useState<boolean>(true);
const [error, setError] = useState<string | null>(null);
const articles: ArticlePreview[] = [
{
id: 1,
title: "The Great Barrier Reef",
preview: "The Great Barrier Reef is the largest coral reef system in the world, composed of over 2,900 individual reefs and 900 islands stretching for over 2,300 kilometers (1,400 mi) over an area of approximately 344,400 square kilometers (133,000 sq mi).",
},
{
id: 2,
title: "The Great Pacific Garbage Patch",
preview: "The Great Pacific Garbage Patch, also known as the Pacific trash vortex, is a gyre of marine debris particles in the north-central Pacific Ocean. It is located roughly from 135°W to 155°W and 35°N to 42°N.",
},
{
id: 3,
title: "The Amazon Rainforest",
preview: "The Amazon rainforest, alternatively, the Amazon Jungle, also known in English as Amazonia, is a moist broadleaf tropical rainforest in the Amazon biome that covers most of the Amazon basin of South America.",
},
{
id: 4,
title: "The Arctic",
preview: "The Arctic is a polar region located at the northernmost part of Earth. The Arctic consists of the Arctic Ocean, adjacent seas, and parts of Alaska (United States), Northern Canada (Canada), Finland, Greenland (Kingdom of Denmark), Iceland, Norway, Russia, and Sweden.",
},
{
id: 5,
title: "The Antarctic",
preview: "The Antarctic, is a polar region containing the geographic South Pole and is situated in the Antarctic region of the Southern Hemisphere, almost entirely south of the Antarctic Circle, and is surrounded by the Southern Ocean.",
}
];
useEffect(() => {
fetch('/api/articles')
.then(response => response.json())
// .then(response => response.json())
.then(_ => articles)
.then((data: ArticlePreview[]) => setArticlePreviews(data))
.catch(_ => setError('Failed to fetch articles'))
.finally(() => setLoading(false));
}, []);
return (
<div className="row" style={{
<div className="row" id="articles" style={{
display: 'flex',
flexWrap: 'wrap',
justifyContent: 'space-around',
@ -37,9 +69,12 @@ export default function ArticlesSection() {
textAlign: 'center',
width: '100%',
}}>Articles</h1>
{articlePreviews.map(articlePreview => (
<ArticleCard key={articlePreview.id} articlePreview={articlePreview} />
))}
<div style={{width: '100%', display: 'flex', justifyContent: 'space-around', flexWrap: 'wrap'}}>
{articlePreviews.map(articlePreview => (
<ArticleCard key={articlePreview.id} articlePreview={articlePreview} />
))}
</div>
{!loading && !error && articlePreviews.length === 0 && <p style={{color: "var(--color-lightblue)", fontSize: 22}}>No articles found</p>}
{loading && <p style={{color: "var(--color-lightblue)", fontSize: 22}}>Loading...</p>}
{error && <p style={{color: "var(--color-lightblue)", fontSize: 22}}>{error}</p>}

View file

@ -1,14 +1,14 @@
import { ReactNode, MouseEventHandler } from 'react';
interface ButtonProps {
onClick: MouseEventHandler<HTMLButtonElement>;
color: 'primary' | 'secondary';
children: ReactNode;
url?: string;
}
export default function Button({ onClick, color, children }: ButtonProps) {
export default function Button({ color, children, url }: ButtonProps) {
return (
<button style={{
<a style={{
backgroundColor: color === 'primary' ? 'var(--color-yellow)' : 'var(--color-darkblue)',
borderRadius: '8px',
borderWidth: '0',
@ -29,7 +29,8 @@ export default function Button({ onClick, color, children }: ButtonProps) {
userSelect: 'none',
WebkitUserSelect: 'none',
touchAction: 'manipulation',
}} onClick={onClick} className="ni-button" role="button">{children}</button>
textDecoration: 'none',
}} href={url} className="ni-button" role="button">{children}</a>
)
}

View file

@ -9,7 +9,7 @@ export default function ClickableLink({url, text}: ClickableLinkProps) {
backgroundColor: "transparent",
borderRadius: '8px',
borderWidth: '0',
color:"purple",
color:"white",
cursor: 'pointer',
display: 'inline-block',
fontFamily: '"Haas Grot Text R Web", "Helvetica Neue", Helvetica, Arial, sans-serif',

View file

@ -7,12 +7,14 @@ interface FooterProps {
export default function Footer ({bgcolor}:FooterProps) {
return (
<footer style={{display: "flex", justifyContent: "space-between", backgroundColor:bgcolor}}>
<div style={{ display : "flex", alignItems: "center", flexDirection: "row"}}>ENSIBS<br />RedCRAB</div>
<div style={{ display : "flex", alignItems: "center", flexDirection: "row"}}>
<div style={{ display : "flex", alignItems: "center", flexDirection: "column", margin:"5px", width:"10%"}}><p>ENSIBS</p><p>RedCRAB</p></div>
<p>Made with by RedCRAB</p>
<div style={{ display : "flex", alignItems: "center", flexDirection: "row", margin:"5px", width:"10%"}}>
<LogoButton
url="https://www-ensibs.univ-ubs.fr/fr/index.html"
logo = "https://www-ensibs.univ-ubs.fr/skins/ENSIBS/resources/img/logo.png"
style={{ width: "50%", height: "auto" }}/>
style={{ width: "100%", height: "auto",
padding: "10px"}}/>
</div>
</footer>
)

View file

@ -1,19 +1,13 @@
import Button from "./Button";
import ButtonLink from "./ButtonLink";
import NavBar from "./NavBar";
interface FstSectionProps {
centertxt: string;
txtbt1:string;
txtbt2:string;
image:string;
}
export default function FstSection ({centertxt, txtbt1, txtbt2, image}: FstSectionProps) {
export default function FstSection () {
return (
<div style={{
textAlign: "center",
color: "yellow",
backgroundImage: image,
backgroundImage: "url('/pictures/sea.gif')",
backgroundSize: "cover",
backgroundPosition: "center",
backgroundRepeat: "no-repeat",
@ -28,10 +22,18 @@ export default function FstSection ({centertxt, txtbt1, txtbt2, image}: FstSecti
}}
>
<div style={{height:"150px"}} />
<h1>{centertxt}</h1><br />
<h1
style={{
fontSize: "3em",
fontWeight: "bold",
textShadow: "2px 2px 4px #000000",
fontFamily: "Helvetica",
}}
>Help us to save our oceans</h1><br />
<div style={{display:"flex", justifyContent: "center", gap: "20px"}}>
<Button onClick={() => alert("One")} color="primary" children={txtbt1} />
<Button onClick={() => {alert("Two")}} color="secondary" children={txtbt2} />
<Button color="primary" children={"Aller au jeu"} url="/game" />
<Button color="secondary" children={"Lire les articles"} url="/" />
</div>
</div></div>
)

View file

@ -4,14 +4,16 @@ import RoundButton from './RoundButton.tsx';
export default function NavBar(){
return (
<nav style={{ display: "flex", alignItems: "center", justifyContent: "space-between"}}>
<nav style={{ display: "flex", alignItems: "center", justifyContent: "space-between", padding: "0.5em 1em"}}>
<div style={{ display : "flex", alignItems: "center", flexDirection: "row"}}>
<LogoButton url="/" logo = "https://archlinux.org/static/hetzner_logo.41114a37d25f.png"/>
{/* <LogoButton url="/" logo = "https://archlinux.org/static/hetzner_logo.41114a37d25f.png"/> */}
<span class="material-symbols-outlined"
style={{fontSize: "4em", color: "white", margin: "0.5em"}}>sailing</span>
<ClickableLink url="/" text = "Accueil" />
<ClickableLink url="/game" text = "Jeu" />
</div>
<div style={{ display : "flex", alignItems: "center", flexDirection: "row"}}>
<RoundButton url="https://archlinux.org" bgcolor="purple" text="?"/>
<RoundButton url="https://archlinux.org" bgcolor="var(--color-white)" text="?"/>
</div>
</nav>);
}

View file

@ -8,8 +8,11 @@ export default function RoundButton({url, bgcolor, text}: RoundButtonProps) {
return (<div>
<a href={url}><button style={{
backgroundColor: bgcolor,
borderColor:"blue",
borderStyle: 'solid',
borderColor:"var(--color-lightblue)",
borderRadius: '50%',
width: '45px',
height: '45px',
borderWidth: '1',
cursor: 'pointer',
display: 'inline-block',

View file

@ -139,7 +139,7 @@ export default function GamePage() {
<Sky sunPosition={[100, 10, 100]} />
<OrbitControls />
<Ocean />
<Axes />
{/* <Axes /> */}
<Character />
<Floor />
{/* <Marker position={[0, 1, 0]} color="red" /> */}

View file

@ -6,11 +6,7 @@ export default function MainPage() {
return (
<>
<div style={{ display: 'flex', flexDirection: 'column', minHeight: '100vh' }}>
<FstSection
centertxt="Choisissez votre numéro :"
txtbt1="Un"
txtbt2="Deux"
image="url('/pictures/sea.gif')"/>
<FstSection />
<ArticlesSection />
<Footer bgcolor="lightblue"/>
</div>