From 1f5cca309e88e36ddaf2e3caa1f4ecb64407bfe0 Mon Sep 17 00:00:00 2001 From: Ipmake Date: Tue, 5 Dec 2023 13:45:05 +0100 Subject: [PATCH] Minor Changes Co-authored-by: Luca Richter --- backend/src/index.ts | 1 + frontend/src/components/ArticleCard.tsx | 77 ++++++++ frontend/src/components/Footer.tsx | 29 ++-- frontend/src/components/SponsorCard.tsx | 153 ++++++++++++++++ .../src/components/SponsorCardEditable.tsx | 2 +- frontend/src/components/TopBar.tsx | 3 +- frontend/src/components/UserModal.tsx | 6 +- frontend/src/pages/LandingPage.tsx | 164 +++++++++++++++--- frontend/src/pages/admin/ArticleEditor.tsx | 13 +- 9 files changed, 401 insertions(+), 47 deletions(-) create mode 100644 frontend/src/components/ArticleCard.tsx create mode 100644 frontend/src/components/SponsorCard.tsx diff --git a/backend/src/index.ts b/backend/src/index.ts index b6e34ec..51a4098 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -81,6 +81,7 @@ app.post("/api/article/create", async (req, res) => { const article = await prisma.articles.create({ data: { title, + public: true, author: { connect: { ID: user.ID diff --git a/frontend/src/components/ArticleCard.tsx b/frontend/src/components/ArticleCard.tsx new file mode 100644 index 0000000..e1451f2 --- /dev/null +++ b/frontend/src/components/ArticleCard.tsx @@ -0,0 +1,77 @@ +import { Avatar, Box, Button, Typography } from "@mui/material"; +import { getBaseURL } from "../functions"; +import { useNavigate } from "react-router-dom"; + +function ArticleCard({ id, name }: { id: string; name: string }) { + const navigate = useNavigate(); + + return ( + `2px 5px 7px ${theme.palette.primary.light}`, + + // clip the corners + overflow: "hidden", + cursor: "pointer", + transition: "all 0.2s ease-in-out", + + "&:hover": { + boxShadow: (theme) => `2px 5px 7px ${theme.palette.primary.main}`, + transform: "scale(1.02)", + }, + }} + onClick={() => { + navigate(`/artikel/${id}`); + }} + > + + + + {name} + + + + ); +} + +export default ArticleCard; diff --git a/frontend/src/components/Footer.tsx b/frontend/src/components/Footer.tsx index e45040e..0194c3b 100644 --- a/frontend/src/components/Footer.tsx +++ b/frontend/src/components/Footer.tsx @@ -1,4 +1,4 @@ -import {EngineeringOutlined } from "@mui/icons-material"; +import { EngineeringOutlined } from "@mui/icons-material"; import { Box, Button, Typography } from "@mui/material"; import { Link, useNavigate } from "react-router-dom"; import { FooterLink } from "./FooterLink"; @@ -163,14 +163,16 @@ export function Footer(): JSX.Element { Impressum - - + © 2023
IPGSystems inc. All rights reserved -
+
diff --git a/frontend/src/components/SponsorCard.tsx b/frontend/src/components/SponsorCard.tsx new file mode 100644 index 0000000..954d4c5 --- /dev/null +++ b/frontend/src/components/SponsorCard.tsx @@ -0,0 +1,153 @@ +import { Avatar, Box, Button, Typography } from "@mui/material"; +import { getBaseURL } from "../functions"; + +function SponsorCard({ + id, + name, + description, + url, +}: { + id: string; + name: string; + description: string; + url: string; +}) { + return ( + `2px 5px 7px ${theme.palette.primary.light}`, + + // clip the corners + overflow: "hidden", + }} + > + + + + + + + + + + {name} + + + {description} + + + + + ); +} + +export default SponsorCard; diff --git a/frontend/src/components/SponsorCardEditable.tsx b/frontend/src/components/SponsorCardEditable.tsx index 082a105..2080e66 100644 --- a/frontend/src/components/SponsorCardEditable.tsx +++ b/frontend/src/components/SponsorCardEditable.tsx @@ -222,7 +222,7 @@ function SponsorCardEditable({ }} onChange={(e) => { if (e.target.value.length >= 100) return; - if (e.target.value.includes("\n")) return; + if (e.target.value.split("\n").length > 3) return; setDescription(e.target.value); }} /> diff --git a/frontend/src/components/TopBar.tsx b/frontend/src/components/TopBar.tsx index 379c66d..68c9caa 100644 --- a/frontend/src/components/TopBar.tsx +++ b/frontend/src/components/TopBar.tsx @@ -80,9 +80,9 @@ function TopBar() { }, }} > + Sponsoren Über uns Für Sie - Sponsoren diff --git a/frontend/src/components/UserModal.tsx b/frontend/src/components/UserModal.tsx index e6cacae..ac4e04b 100644 --- a/frontend/src/components/UserModal.tsx +++ b/frontend/src/components/UserModal.tsx @@ -329,8 +329,7 @@ function UserModal({ } ) .then(() => { - setSaving(false); - onClose?.(); + window.location.reload(); }); } else { axios @@ -364,8 +363,7 @@ function UserModal({ } ) .then(() => { - setSaving(false); - onClose?.(); + window.location.reload(); }); } }} diff --git a/frontend/src/pages/LandingPage.tsx b/frontend/src/pages/LandingPage.tsx index 9f2097a..40eddb4 100644 --- a/frontend/src/pages/LandingPage.tsx +++ b/frontend/src/pages/LandingPage.tsx @@ -1,4 +1,4 @@ -import { Typography, Button, Box } from "@mui/material"; +import { Typography, Button, Box, Grid, CircularProgress } from "@mui/material"; import { DescriptionOutlined, BadgeOutlined } from "@mui/icons-material"; import { AboutSection } from "../components/AboutSection"; import { AboutSection2 } from "../components/AboutSection2"; @@ -6,8 +6,11 @@ import { Footer } from "../components/Footer"; import TopBar from "../components/TopBar"; import { useTheme } from "@mui/material"; import { useLocation } from "react-router-dom"; -import { useEffect } from "react"; - +import { useEffect, useState } from "react"; +import SponsorCard from "../components/SponsorCard"; +import axios from "axios"; +import { getBaseURL } from "../functions"; +import ArticleCard from "../components/ArticleCard"; function LandingPage() { const theme = useTheme(); @@ -76,21 +79,6 @@ function LandingPage() { > Als regionale Unternehmen unterstützen wir regionale Vorhaben. - Sponsor Werden! + - +