mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-07 06:08:54 +00:00
fix bugs and now final version of UI
This commit is contained in:
parent
c129fcb3e4
commit
ea15d01238
6 changed files with 151 additions and 178 deletions
|
@ -1,9 +1,6 @@
|
||||||
import * as React from "react";
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import TextField from "@mui/material/TextField";
|
import TextField from "@mui/material/TextField";
|
||||||
import StyledEngineProvider from "@mui/styled-engine/StyledEngineProvider";
|
import StyledEngineProvider from "@mui/styled-engine/StyledEngineProvider";
|
||||||
import { useFormControl } from '@mui/material/FormControl';
|
|
||||||
|
|
||||||
|
|
||||||
export default function MultilineTextFields() {
|
export default function MultilineTextFields() {
|
||||||
return (
|
return (
|
||||||
|
@ -21,7 +18,6 @@ export default function MultilineTextFields() {
|
||||||
label="Multiline"
|
label="Multiline"
|
||||||
multiline
|
multiline
|
||||||
maxRows={4}
|
maxRows={4}
|
||||||
onChange={(event) => {}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
import * as React from "react";
|
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 { 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 }) => ({
|
const BootstrapDialog = styled(Dialog)(({ theme }) => ({
|
||||||
"& .MuiDialogContent-root": {
|
"& .MuiDialogContent-root": {
|
||||||
|
@ -47,7 +52,7 @@ export default function CustomizedDialogs() {
|
||||||
<Button onClick={handleClickOpen}>
|
<Button onClick={handleClickOpen}>
|
||||||
<Avatar
|
<Avatar
|
||||||
alt="Username"
|
alt="Username"
|
||||||
src="./assets/images/OwlSignUp.png"
|
src={selectedImage ? URL.createObjectURL(selectedImage) : undefined}
|
||||||
className="profile-avatar"
|
className="profile-avatar"
|
||||||
>
|
>
|
||||||
U
|
U
|
||||||
|
@ -55,10 +60,10 @@ export default function CustomizedDialogs() {
|
||||||
</Button>
|
</Button>
|
||||||
<BootstrapDialog
|
<BootstrapDialog
|
||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
aria-labelledby="customized-dialog-title"
|
aria-labelledby="change-profile-picture-dialog"
|
||||||
open={open}
|
open={open}
|
||||||
>
|
>
|
||||||
<DialogTitle sx={{ m: 0, p: 2 }} id="customized-dialog-title">
|
<DialogTitle sx={{ m: 0, p: 2 }} id="change-profile-picture-dialog">
|
||||||
Change Profile Picture
|
Change Profile Picture
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
@ -74,14 +79,30 @@ export default function CustomizedDialogs() {
|
||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
{selectedImage && <img className="profile-image-large" src={URL.createObjectURL(selectedImage)} alt="Profile Picture" />}
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
objectFit: "cover",
|
||||||
|
maxWidth: "30rem",
|
||||||
|
maxHeight: "30rem",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{selectedImage && (
|
||||||
|
<img
|
||||||
|
src={URL.createObjectURL(selectedImage)}
|
||||||
|
alt="Profile Picture"
|
||||||
|
style={{maxWidth: "30rem", maxHeight: "30rem" , width: "100%", height: "100%", objectFit: "cover"}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
<IconButton aria-label="upload picture" onClick={openFileExplorer}>
|
<IconButton aria-label="upload picture" onClick={openFileExplorer}>
|
||||||
<EditSquareIcon />
|
<EditSquareIcon />
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
id="file"
|
id="file"
|
||||||
ref={inputFile}
|
|
||||||
style={{ display: "none" }}
|
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
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]) {
|
if (event.target.files && event.target.files[0]) {
|
||||||
|
|
|
@ -1,56 +1,32 @@
|
||||||
import * as React from "react";
|
|
||||||
import ImageList from "@mui/material/ImageList";
|
|
||||||
import ImageListItem from "@mui/material/ImageListItem";
|
import ImageListItem from "@mui/material/ImageListItem";
|
||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import { StyledEngineProvider } from "@mui/material/styles";
|
||||||
import {
|
|
||||||
createTheme,
|
|
||||||
StyledEngineProvider,
|
|
||||||
ThemeProvider,
|
|
||||||
} from "@mui/material/styles";
|
|
||||||
import "./quiltedImageList.css";
|
import "./quiltedImageList.css";
|
||||||
import { Box, Grid } from "@mui/material";
|
import { Box, Grid } from "@mui/material";
|
||||||
|
|
||||||
export default function StandardImageList() {
|
export default function StandardImageList() {
|
||||||
const isSmallScreen = useMediaQuery(theme.breakpoints.down("sm"));
|
|
||||||
const isLargeScreen = useMediaQuery(theme.breakpoints.down("xl"));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledEngineProvider injectFirst>
|
<StyledEngineProvider injectFirst>
|
||||||
<ThemeProvider theme={theme}>
|
|
||||||
<Box className="box">
|
<Box className="box">
|
||||||
<Grid container spacing={1} className="image-list">
|
<Grid container spacing={1} className="image-list">
|
||||||
{itemData.map((item) => (
|
{itemData.map((item) => (
|
||||||
<ImageListItem key={item.img}>
|
<ImageListItem key={item.img}>
|
||||||
<img
|
<img
|
||||||
className="list-item"
|
|
||||||
srcSet={`${item.img}?w=164&h=164&fit=crop&auto=format&dpr=2 2x`}
|
srcSet={`${item.img}?w=164&h=164&fit=crop&auto=format&dpr=2 2x`}
|
||||||
src={`${item.img}?w=164&h=164&fit=crop&auto=format`}
|
src={`${item.img}?w=164&h=164&fit=crop&auto=format`}
|
||||||
alt={item.title}
|
alt={item.title}
|
||||||
onClick={() => console.log(item.title)} /* change to onClick => Feed*/
|
onClick={() =>
|
||||||
|
console.log(item.title)
|
||||||
|
} /* change to onClick => Feed*/
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
/>
|
/>
|
||||||
</ImageListItem>
|
</ImageListItem>
|
||||||
))}
|
))}
|
||||||
</Grid>
|
</Grid>
|
||||||
</Box>
|
</Box>
|
||||||
</ThemeProvider>
|
|
||||||
</StyledEngineProvider>
|
</StyledEngineProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const theme = createTheme({
|
|
||||||
breakpoints: {
|
|
||||||
values: {
|
|
||||||
xs: 0,
|
|
||||||
sm: 1000,
|
|
||||||
md: 650,
|
|
||||||
lg: 768,
|
|
||||||
xl: 1200,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const itemData = [
|
const itemData = [
|
||||||
{ img: "/assets/images/BirdLogin.jpg", title: "Bird" },
|
{ img: "/assets/images/BirdLogin.jpg", title: "Bird" },
|
||||||
{ img: "../../assets/images/BirdsSky.jpg", title: "Bird Sky" },
|
{ img: "../../assets/images/BirdsSky.jpg", title: "Bird Sky" },
|
||||||
|
|
|
@ -4,11 +4,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-image-large {
|
.profile-image-large {
|
||||||
width: 5rem;
|
width: 20rem;
|
||||||
height: 5rem;
|
height: 20rem;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#file {
|
|
||||||
max-width: 50rem;
|
|
||||||
max-height: 50rem;
|
|
||||||
}
|
|
|
@ -1,23 +1,21 @@
|
||||||
.image-list {
|
.image-list {
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
width: fit-content;
|
width: fill-available;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.box {
|
.box {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
margin-left: 1rem;
|
|
||||||
margin-right: 1rem;
|
|
||||||
}
|
}
|
||||||
.css-1row2ej-MuiImageListItem-root .MuiImageListItem-img {
|
.css-1row2ej-MuiImageListItem-root .MuiImageListItem-img {
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
width: fill-available;
|
width: 5rem;
|
||||||
height: fill-available;
|
height: 5rem;
|
||||||
|
margin: -0.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (min-width: 768px) {
|
@media only screen and (min-width: 768px) {
|
||||||
|
|
||||||
.box {
|
.box {
|
||||||
max-width: 75%;
|
max-width: 75%;
|
||||||
margin-left: 45ch;
|
margin-left: 45ch;
|
||||||
|
@ -28,6 +26,8 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
width: fill-available;
|
width: fill-available;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
margin-left: 1rem;
|
||||||
|
margin-right: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.css-1row2ej-MuiImageListItem-root .MuiImageListItem-img {
|
.css-1row2ej-MuiImageListItem-root .MuiImageListItem-img {
|
||||||
|
|
|
@ -4,70 +4,51 @@ import "./loginAndSignUpPage.css";
|
||||||
import "../styles/sizes.css";
|
import "../styles/sizes.css";
|
||||||
import "../styles/colors.css";
|
import "../styles/colors.css";
|
||||||
import "../styles/fonts.css";
|
import "../styles/fonts.css";
|
||||||
import { useRef, useState } from "react";
|
import { useState } from "react";
|
||||||
import Avatar from "@mui/material/Avatar";
|
|
||||||
import QuiltedImageList from "../components/QuiltedImageList";
|
import QuiltedImageList from "../components/QuiltedImageList";
|
||||||
import TextField from "@mui/material/TextField";
|
|
||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
StyledEngineProvider,
|
StyledEngineProvider,
|
||||||
createTheme,
|
|
||||||
ThemeProvider,
|
|
||||||
Divider,
|
Divider,
|
||||||
Button,
|
Button,
|
||||||
Tooltip,
|
|
||||||
Popover,
|
Popover,
|
||||||
Typography,
|
Typography,
|
||||||
|
TextField
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import ProfilePictureDialog from "../components/ChagneAvatarDialog";
|
import ChangeAvatarDialog from "../components/ChagneAvatarDialog";
|
||||||
|
|
||||||
function Profile() {
|
function Profile() {
|
||||||
const toggleEditMode = (event: React.MouseEvent<HTMLElement>) => {
|
const toggleEditMode = () => {
|
||||||
isEditable(!editMode);
|
isEditable(!editMode);
|
||||||
};
|
};
|
||||||
const [editMode, isEditable] = useState(true);
|
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<HTMLButtonElement | null>(null);
|
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
|
||||||
|
|
||||||
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
const openPopover = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
setAnchorEl(event.currentTarget);
|
setAnchorEl(event.currentTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = () => {
|
const closePopover = () => {
|
||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const open = Boolean(anchorEl);
|
const isPopoverOpen = Boolean(anchorEl);
|
||||||
const id = open ? "simple-popover" : undefined;
|
const id = isPopoverOpen ? "simple-popover" : undefined;
|
||||||
|
|
||||||
const username = "Username12345678"; /* Get username from database */
|
const username = "Username12345678"; /* Get username from database */
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledEngineProvider injectFirst>
|
<StyledEngineProvider injectFirst>
|
||||||
<ThemeProvider theme={theme}>
|
|
||||||
<div className="profile-display">
|
<div className="profile-display">
|
||||||
<div className="user-info">
|
<div className="user-info">
|
||||||
<div className="user">
|
<div className="user">
|
||||||
<ProfilePictureDialog />
|
<ChangeAvatarDialog />
|
||||||
<Popover
|
<Popover
|
||||||
className="profile-popover"
|
className="profile-popover"
|
||||||
onClose={handleClose}
|
onClose={closePopover}
|
||||||
id={id}
|
id={id}
|
||||||
open={open}
|
open={isPopoverOpen}
|
||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
anchorOrigin={{
|
anchorOrigin={{
|
||||||
vertical: "top",
|
vertical: "top",
|
||||||
|
@ -80,11 +61,12 @@ function Profile() {
|
||||||
>
|
>
|
||||||
<Typography sx={{ p: 1 }}>{username}</Typography>
|
<Typography sx={{ p: 1 }}>{username}</Typography>
|
||||||
</Popover>
|
</Popover>
|
||||||
<span className="profile-username body-l" onClick={handleClick}>
|
<span className="profile-username body-l" onClick={openPopover}>
|
||||||
{username}
|
{username}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div
|
||||||
|
>
|
||||||
<Box
|
<Box
|
||||||
component="form"
|
component="form"
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -102,6 +84,7 @@ function Profile() {
|
||||||
className="bio-input"
|
className="bio-input"
|
||||||
id="outlined-multiline-flexible"
|
id="outlined-multiline-flexible"
|
||||||
label="✎ Bio"
|
label="✎ Bio"
|
||||||
|
defaultValue="This is a sample bio. Click to edit."
|
||||||
multiline
|
multiline
|
||||||
maxRows={4}
|
maxRows={4}
|
||||||
disabled={editMode}
|
disabled={editMode}
|
||||||
|
@ -135,7 +118,6 @@ function Profile() {
|
||||||
</div>
|
</div>
|
||||||
<QuiltedImageList />
|
<QuiltedImageList />
|
||||||
</div>
|
</div>
|
||||||
</ThemeProvider>
|
|
||||||
</StyledEngineProvider>
|
</StyledEngineProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue