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.
- }
- sx={{
- color: "#fff",
- marginTop: "1rem",
-
- "&:hover": {
- transform: "scale(1.1)",
- },
- }}
- >
- Download Flyer
-
Sponsor Werden!
+
-
+
>
);
@@ -156,12 +145,143 @@ function LandingPage() {
export default LandingPage;
function Sponsors(): JSX.Element {
+ const [data, setData] = useState(null);
+
+ useEffect(() => {
+ axios.get(`${getBaseURL()}/api/sponsors/`).then((res) => {
+ setData(res.data);
+ });
+ }, []);
+
+ if (data === null)
+ return (
+
+
+
+ );
+
return (
-
+
+
+ Unsere Sponsoren
+
+
+ {data.map((sponsor) => (
+
+
+
+ ))}
+
+ );
+}
+
+function Articles(): JSX.Element {
+ const [data, setData] = useState(null);
+
+ useEffect(() => {
+ axios.get(`${getBaseURL()}/api/articles/public`).then((res) => {
+ setData(res.data);
+ });
+ }, []);
+
+ if (data === null)
+ return (
+
+
+
+ );
+
+ return (
+
);
}
diff --git a/frontend/src/pages/admin/ArticleEditor.tsx b/frontend/src/pages/admin/ArticleEditor.tsx
index c327415..75c990f 100644
--- a/frontend/src/pages/admin/ArticleEditor.tsx
+++ b/frontend/src/pages/admin/ArticleEditor.tsx
@@ -107,6 +107,13 @@ function ArticleEditor() {
};
useEffect(() => {
+ axios.get(`${getBaseURL()}/api/sponsors`).then((res) => {
+ if (!res.data) return;
+
+ setSponsorsAvail(res.data);
+ });
+
+
if (!id) return;
setLoading(true);
@@ -136,12 +143,6 @@ function ArticleEditor() {
}, 500);
});
});
-
- axios.get(`${getBaseURL()}/api/sponsors`).then((res) => {
- if (!res.data) return;
-
- setSponsorsAvail(res.data);
- });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [id]);