From ea15d0123845df8091a691fc08657a8715274fbe Mon Sep 17 00:00:00 2001 From: "luisa.bellitto" Date: Fri, 20 Jun 2025 19:20:16 +0200 Subject: [PATCH] fix bugs and now final version of UI --- code/frontend/src/components/Bio.tsx | 6 +- .../src/components/ChagneAvatarDialog.tsx | 59 ++++-- .../src/components/QuiltedImageList.tsx | 60 ++---- .../src/components/changeAvatarDialog.css | 14 +- .../src/components/quiltedImageList.css | 12 +- code/frontend/src/pages/Profile.tsx | 178 ++++++++---------- 6 files changed, 151 insertions(+), 178 deletions(-) diff --git a/code/frontend/src/components/Bio.tsx b/code/frontend/src/components/Bio.tsx index 7b9c450..003bfcf 100644 --- a/code/frontend/src/components/Bio.tsx +++ b/code/frontend/src/components/Bio.tsx @@ -1,9 +1,6 @@ -import * as React from "react"; import Box from "@mui/material/Box"; import TextField from "@mui/material/TextField"; import StyledEngineProvider from "@mui/styled-engine/StyledEngineProvider"; -import { useFormControl } from '@mui/material/FormControl'; - export default function MultilineTextFields() { return ( @@ -16,12 +13,11 @@ export default function MultilineTextFields() { >
{}} />
diff --git a/code/frontend/src/components/ChagneAvatarDialog.tsx b/code/frontend/src/components/ChagneAvatarDialog.tsx index c2cf2b8..9034df1 100644 --- a/code/frontend/src/components/ChagneAvatarDialog.tsx +++ b/code/frontend/src/components/ChagneAvatarDialog.tsx @@ -1,16 +1,21 @@ import * as React from "react"; -import Button from "@mui/material/Button"; -import { styled } from "@mui/material/styles"; -import Dialog from "@mui/material/Dialog"; -import DialogTitle from "@mui/material/DialogTitle"; -import DialogContent from "@mui/material/DialogContent"; -import DialogActions from "@mui/material/DialogActions"; -import IconButton from "@mui/material/IconButton"; -import CloseIcon from "@mui/icons-material/Close"; -import Typography from "@mui/material/Typography"; -import Avatar from "@mui/material/Avatar"; -import EditSquareIcon from "@mui/icons-material/EditSquare"; import { useRef, useState } from "react"; +import { + Button, + styled, + Dialog, + DialogTitle, + DialogContent, + DialogActions, + IconButton, + Avatar, + Box, +} from "@mui/material"; +import CloseIcon from "@mui/icons-material/Close"; +import EditSquareIcon from "@mui/icons-material/EditSquare"; +import "../styles/colors.css"; +import "../styles/fonts.css"; +import "./changeAvatarDialog.css"; const BootstrapDialog = styled(Dialog)(({ theme }) => ({ "& .MuiDialogContent-root": { @@ -39,7 +44,7 @@ export default function CustomizedDialogs() { inputFile.current.click(); } }; - + const [selectedImage, setSelectedImage] = useState(null); return ( @@ -47,7 +52,7 @@ export default function CustomizedDialogs() { - + Change Profile Picture - {selectedImage && Profile Picture} + + {selectedImage && ( + Profile Picture + )} + { - console.log(event.target.files?[0]:undefined); // Log the selected file + console.log(event.target.files ? [0] : undefined); // Log the selected file if (event.target.files && event.target.files[0]) { setSelectedImage(event.target.files[0]); // Update the state with the selected file } diff --git a/code/frontend/src/components/QuiltedImageList.tsx b/code/frontend/src/components/QuiltedImageList.tsx index 3740d4c..865cafa 100644 --- a/code/frontend/src/components/QuiltedImageList.tsx +++ b/code/frontend/src/components/QuiltedImageList.tsx @@ -1,56 +1,32 @@ -import * as React from "react"; -import ImageList from "@mui/material/ImageList"; import ImageListItem from "@mui/material/ImageListItem"; -import useMediaQuery from "@mui/material/useMediaQuery"; -import { - createTheme, - StyledEngineProvider, - ThemeProvider, -} from "@mui/material/styles"; +import { StyledEngineProvider } from "@mui/material/styles"; import "./quiltedImageList.css"; import { Box, Grid } from "@mui/material"; export default function StandardImageList() { - const isSmallScreen = useMediaQuery(theme.breakpoints.down("sm")); - const isLargeScreen = useMediaQuery(theme.breakpoints.down("xl")); - return ( - - - - {itemData.map((item) => ( - - {item.title} console.log(item.title)} /* change to onClick => Feed*/ - loading="lazy" - /> - - ))} - - - + + + {itemData.map((item) => ( + + {item.title} + console.log(item.title) + } /* change to onClick => Feed*/ + loading="lazy" + /> + + ))} + + ); } - -const theme = createTheme({ - breakpoints: { - values: { - xs: 0, - sm: 1000, - md: 650, - lg: 768, - xl: 1200, - }, - }, -}); - const itemData = [ { img: "/assets/images/BirdLogin.jpg", title: "Bird" }, { img: "../../assets/images/BirdsSky.jpg", title: "Bird Sky" }, diff --git a/code/frontend/src/components/changeAvatarDialog.css b/code/frontend/src/components/changeAvatarDialog.css index dfabeaf..54b544c 100644 --- a/code/frontend/src/components/changeAvatarDialog.css +++ b/code/frontend/src/components/changeAvatarDialog.css @@ -1,14 +1,12 @@ .dialog-content { - display: flex; - flex-direction: column; + display: flex; + flex-direction: column; } .profile-image-large { - width: 5rem; - height: 5rem; + width: 20rem; + height: 20rem; + object-fit: cover; + border-radius: 8px; } -#file { - max-width: 50rem; - max-height: 50rem; -} \ No newline at end of file diff --git a/code/frontend/src/components/quiltedImageList.css b/code/frontend/src/components/quiltedImageList.css index bd6dc02..fdc1b61 100644 --- a/code/frontend/src/components/quiltedImageList.css +++ b/code/frontend/src/components/quiltedImageList.css @@ -1,23 +1,21 @@ .image-list { height: fit-content; - width: fit-content; + width: fill-available; justify-content: center; } .box { flex-grow: 1; height: fit-content; - margin-left: 1rem; - margin-right: 1rem; } .css-1row2ej-MuiImageListItem-root .MuiImageListItem-img { object-fit: cover; - width: fill-available; - height: fill-available; + width: 5rem; + height: 5rem; + margin: -0.1rem; } @media only screen and (min-width: 768px) { - .box { max-width: 75%; margin-left: 45ch; @@ -28,6 +26,8 @@ position: relative; width: fill-available; margin-bottom: 1rem; + margin-left: 1rem; + margin-right: 1rem; } .css-1row2ej-MuiImageListItem-root .MuiImageListItem-img { diff --git a/code/frontend/src/pages/Profile.tsx b/code/frontend/src/pages/Profile.tsx index 294d211..419b586 100644 --- a/code/frontend/src/pages/Profile.tsx +++ b/code/frontend/src/pages/Profile.tsx @@ -4,138 +4,120 @@ import "./loginAndSignUpPage.css"; import "../styles/sizes.css"; import "../styles/colors.css"; import "../styles/fonts.css"; -import { useRef, useState } from "react"; -import Avatar from "@mui/material/Avatar"; +import { useState } from "react"; import QuiltedImageList from "../components/QuiltedImageList"; -import TextField from "@mui/material/TextField"; -import useMediaQuery from "@mui/material/useMediaQuery"; import { Box, StyledEngineProvider, - createTheme, - ThemeProvider, Divider, Button, - Tooltip, Popover, Typography, + TextField } from "@mui/material"; -import ProfilePictureDialog from "../components/ChagneAvatarDialog"; +import ChangeAvatarDialog from "../components/ChagneAvatarDialog"; function Profile() { - const toggleEditMode = (event: React.MouseEvent) => { + const toggleEditMode = () => { isEditable(!editMode); }; const [editMode, isEditable] = useState(true); - const theme = createTheme({ - breakpoints: { - values: { - xs: 0, - sm: 768, - md: 650, - lg: 768, - xl: 1200, - }, - }, - }); - const matchDownMd = useMediaQuery(theme.breakpoints.down("sm")); - const [anchorEl, setAnchorEl] = useState(null); - const handleClick = (event: React.MouseEvent) => { + const openPopover = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; - const handleClose = () => { + const closePopover = () => { setAnchorEl(null); }; - const open = Boolean(anchorEl); - const id = open ? "simple-popover" : undefined; + const isPopoverOpen = Boolean(anchorEl); + const id = isPopoverOpen ? "simple-popover" : undefined; const username = "Username12345678"; /* Get username from database */ return ( - -
-
-
- - +
+
+ + + {username} + + + {username} + +
+
+ + + + {!editMode && ( + + )} +
+ +
+
+ 50 + Posts
-
- - - - {!editMode && ( - - )} +
+ 100 + Followers
- -
-
- 50 - Posts -
-
- 100 - Followers -
-
- 50 - Following -
+
+ 50 + Following
-
- + +
); }