diff --git a/code/frontend/src/components/QuiltedImageList.tsx b/code/frontend/src/components/QuiltedImageList.tsx deleted file mode 100644 index c12a00c..0000000 --- a/code/frontend/src/components/QuiltedImageList.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import ImageListItem from "@mui/material/ImageListItem"; -import { StyledEngineProvider } from "@mui/material/styles"; -import "./quiltedImageList.css"; -import { Box, Grid, Skeleton } from "@mui/material"; -import api from "../api/axios"; -import { useEffect, useState } from "react"; -import { UserProfile } from "../types/UserProfile"; -import { useNavigate } from "react-router-dom"; - -export default function StandardImageList({ user }: { user: UserProfile }) { - const navigate = useNavigate(); - const [images, setImages] = useState< - { imageUrl: string; id: string; description: string; createdAt: string }[] - >([]); - - useEffect(() => { - if (user.username != undefined) { - fetchUserPosts().then(console.log); - return; - } - }, [user.username]); - - const fetchUserPosts = async () => { - try { - const response = await api.get(`/posts/getUserPosts/${user.username}`); - const posts = response.data.posts; - const fetchedImages = await Promise.all( - posts.map( - async (post: { - id: string; - description: string; - createdAt: string; - }) => { - try { - const response = await api.get( - `/posts/getPost/{postId}?postId=${post.id}` - ); - if (response.data && response.data.images.length > 0) { - console.log(response.data); - return { - imageUrl: response.data.images[0].url, - id: post.id, - description: post.description || "", - createdAt: post.createdAt, - }; - } - } catch (error) { - console.error("Error fetching post images:", error); - } - } - ) - ); - console.log("Fetched images:", fetchedImages); - setImages(fetchedImages.filter((image) => image !== undefined)); - } catch (error) { - console.error("Error fetching user posts:", error); - } - }; - - return ( - - - - {images.map((item, index) => { - return ( - - {item.imageUrl ? ( - {item.description} navigate("/feed", { replace: true }) - // anchor to post that was clicked - } - loading="lazy" - /> - ) : ( - - )} - - ); - })} - - - - ); -} diff --git a/code/frontend/src/components/Username.tsx b/code/frontend/src/components/Username.tsx deleted file mode 100644 index 5922711..0000000 --- a/code/frontend/src/components/Username.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { Popover, Typography } from "@mui/material"; -import { useEffect, useState } from "react"; -import "./username.css"; - -export default function Username({ username }: { username: string }) { - const [anchorEl, setAnchorEl] = useState(null); - - const openPopover = (event: React.MouseEvent) => { - setAnchorEl(event.currentTarget); - }; - - const closePopover = () => { - setAnchorEl(null); - }; - - const isPopoverOpen = Boolean(anchorEl); - const id = isPopoverOpen ? "simple-popover" : undefined; - - return ( - <> - - {username} - - - {username} - - - ); -} diff --git a/code/frontend/src/components/username.css b/code/frontend/src/components/username.css deleted file mode 100644 index 7be6bfb..0000000 --- a/code/frontend/src/components/username.css +++ /dev/null @@ -1,21 +0,0 @@ -.profile-username { - color: var(--Rotkehlchen-orange-default); - width: 15rem; - overflow: hidden; - text-overflow: ellipsis; - cursor: pointer; - text-align: start; -} -.profile-popover { - padding: 1rem; -} - -@media screen and (min-width: 768px) { - .profile-username { - width: 10rem; - } - .profile-popover { - padding: 2rem; - } - -}