Skip to content

Commit

Permalink
update view profile
Browse files Browse the repository at this point in the history
  • Loading branch information
nmewada01 committed Jan 2, 2023
1 parent 3fbb7ac commit a05cdd4
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 11 deletions.
6 changes: 2 additions & 4 deletions src/Components/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Avatar, Box, Button, Flex, Text } from "@chakra-ui/react";
import { useDispatch, useSelector } from "react-redux";
import { profile } from "../Redux/AuthReducer/action";
import { getLocalData } from "../utils/localStorage";
import { ProfileModal } from "../Modals/profileModal";

// const Profile = () => {
// const dispatch = useDispatch();
Expand All @@ -21,7 +22,6 @@ import { getLocalData } from "../utils/localStorage";

const Profile = () => {
const dispatch = useDispatch();

const profileData = useSelector((state) => state?.AuthReducer?.profileData);
useEffect(() => {
if (profileData?.length === 0) {
Expand Down Expand Up @@ -56,9 +56,7 @@ const Profile = () => {
</Flex>
</Flex>
<Box textAlign="right" paddingRight="0.5rem">
<Button color="navy" variant="link">
View profile
</Button>
<ProfileModal profileData={profileData} />
</Box>
</Box>
);
Expand Down
11 changes: 9 additions & 2 deletions src/Components/Sidebar.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { Box, Button, Flex, Text } from "@chakra-ui/react";
import { Box, Button, Flex, Text, useDisclosure } from "@chakra-ui/react";
import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { useNavigate, useSearchParams } from "react-router-dom";
import { getTagsList } from "../Redux/AppReducer/action";
import Profile from "./Profile";
import CreateTask from "../Modals/CreateTask";

const Sidebar = () => {
const dispatch = useDispatch();
const tagLists = useSelector((state) => state.AppReducer.tags);
const tasks = useSelector((state) => state.AppReducer.tasks);
const { isOpen, onOpen, onClose } = useDisclosure();
const [searchParams, setSearchParams] = useSearchParams();
const [selectedTags, setSelectedTags] = useState(
searchParams.getAll("tags") || []
Expand Down Expand Up @@ -65,7 +67,12 @@ const Sidebar = () => {
</Box>
<Flex justify="center" margin="0.25rem 0">
<Button color="navy" width="100%">
Create New Task
<Box m="1rem">
<Button color="navy" onClick={onOpen}>
Create New Task
</Button>
</Box>
<CreateTask isOpen={isOpen} onClose={onClose} />
</Button>
</Flex>
<Box minHeight="70%" overflow="auto">
Expand Down
56 changes: 56 additions & 0 deletions src/Modals/profileModal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import {
Modal,
ModalOverlay,
ModalContent,
ModalHeader,
ModalBody,
ModalCloseButton,
useDisclosure,
Button,
Flex,
Image,
Text,
} from "@chakra-ui/react";

export function ProfileModal({ profileData }) {
const { isOpen, onOpen, onClose } = useDisclosure();
return (
<>
<Button color="navy" variant="link" onClick={onOpen}>
View Profile
</Button>

<Modal isOpen={isOpen} onClose={onClose}>
<ModalOverlay />
<ModalContent>
<ModalHeader>
<Text>
Name :{profileData.length !== 0 ? profileData.name : ""}
</Text>
<Text>
UserName :{profileData.length !== 0 ? profileData.username : ""}
</Text>
<Text>
Email :{profileData.length !== 0 ? profileData.email : ""}
</Text>
<Text>
Mobile No :{profileData.length !== 0 ? profileData.mobile : ""}
</Text>
</ModalHeader>
<ModalCloseButton />
<ModalBody>
<Flex>
<Image
src={
profileData?.length !== 0
? profileData.description
: "https://img.icons8.com/fluency/2x/microsoft-todo-2019.png"
}
/>
</Flex>
</ModalBody>
</ModalContent>
</Modal>
</>
);
}
2 changes: 1 addition & 1 deletion src/Pages/Editpage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const Editpage = () => {
}, [id, tasks]);

return (
<Box width="100%" paddingTop="1rem" color="white" bg={"#436c89"}>
<Box width="100%" paddingTop="1rem" color="white" bg={"#899a8e"}>
<Flex justifyContent="space-around">
{/* Task title */}
<Flex
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const Login = () => {
px={6}
color={"white"}
borderRadius={"2rem"}
bg={"#436c89"}
bg={"#4e4b58"}
>
<Stack align={"center"}>
<Heading fontSize={"4xl"}>Sign in to your account</Heading>
Expand Down
9 changes: 6 additions & 3 deletions src/Pages/Signup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const Signup = () => {
p={8}
color={"white"}
borderRadius={"2rem"}
bg={"#436c89"}
bg={"#4e4b58"}
>
<Stack align={"center"}>
<Heading fontSize={"4xl"} textAlign={"center"}>
Expand Down Expand Up @@ -194,8 +194,11 @@ const Signup = () => {
</FormControl>
</Box>
<Box>
<FormLabel >Image</FormLabel >
<Editable placeholder="Paste Link Here..." border={'2px solid white'}>
<FormLabel>Image</FormLabel>
<Editable
placeholder="Paste Link Here..."
border={"2px solid white"}
>
<EditablePreview />
<EditableTextarea
value={state.description}
Expand Down

0 comments on commit a05cdd4

Please sign in to comment.