Archived
initial redux setup
This commit is contained in:
@@ -5,11 +5,7 @@ import Body from "./contacts-components/Body";
|
||||
import ContactInfo from "./ContactInfo";
|
||||
import Sidebar from "./contacts-components/Sidebar";
|
||||
|
||||
interface Props {
|
||||
setMeetingInfoOpen: (open: boolean) => void;
|
||||
}
|
||||
|
||||
const Contacts: React.FC<Props> = (props) => {
|
||||
const Contacts: React.FC = () => {
|
||||
const [contactSelected, setContactSelected] =
|
||||
React.useState<ContactInfo | null>(null);
|
||||
|
||||
@@ -17,10 +13,7 @@ const Contacts: React.FC<Props> = (props) => {
|
||||
<Box sx={{ display: "flex", height: "100%" }}>
|
||||
<Sidebar setContactSelected={setContactSelected} />
|
||||
{contactSelected !== null ? (
|
||||
<Body
|
||||
contactSelected={contactSelected}
|
||||
setMeetingInfoOpen={props.setMeetingInfoOpen}
|
||||
/>
|
||||
<Body contactSelected={contactSelected} />
|
||||
) : null}
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -6,7 +6,6 @@ import ContactInfo from "../ContactInfo";
|
||||
|
||||
interface Props {
|
||||
contactSelected: ContactInfo;
|
||||
setMeetingInfoOpen: (open: boolean) => void;
|
||||
}
|
||||
|
||||
const Body: React.FC<Props> = (props) => {
|
||||
@@ -21,10 +20,7 @@ const Body: React.FC<Props> = (props) => {
|
||||
>
|
||||
<Toolbar />
|
||||
<UpperBody contactInfo={props.contactSelected} />
|
||||
<LowerBody
|
||||
contactInfo={props.contactSelected}
|
||||
setMeetingInfoOpen={props.setMeetingInfoOpen}
|
||||
/>
|
||||
<LowerBody />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Box, Button, List, Typography } from "@mui/material";
|
||||
import React from "react";
|
||||
import ContactInfo from "../../ContactInfo";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { open } from "../../../../redux/slices/meetingDetailsOpenSlice";
|
||||
|
||||
const meetings: { name: string; duration: string }[] = [
|
||||
{ name: "Kanban Meeting", duration: "10:45 am - 11:45 am" },
|
||||
@@ -10,12 +11,9 @@ const meetings: { name: string; duration: string }[] = [
|
||||
{ name: "Some kind of Meeting", duration: "10:45 am - 11:45 am" },
|
||||
];
|
||||
|
||||
interface Props {
|
||||
contactInfo: ContactInfo;
|
||||
setMeetingInfoOpen: (open: boolean) => void;
|
||||
}
|
||||
const LowerBody: React.FC = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const LowerBody: React.FC<Props> = (props) => {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -47,7 +45,7 @@ const LowerBody: React.FC<Props> = (props) => {
|
||||
<Button
|
||||
variant="text"
|
||||
color="info"
|
||||
onClick={() => props.setMeetingInfoOpen(true)}
|
||||
onClick={() => dispatch(open())}
|
||||
>
|
||||
{meeting.name}
|
||||
</Button>
|
||||
|
||||
@@ -2,16 +2,19 @@ import { Dialog } from "@mui/material";
|
||||
import React from "react";
|
||||
import Body from "./meeting-details-components/Body";
|
||||
import Header from "./meeting-details-components/Header";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import {
|
||||
close,
|
||||
selectMeetingDetailsOpen,
|
||||
} from "../../redux/slices/meetingDetailsOpenSlice";
|
||||
|
||||
interface Props {
|
||||
open: boolean;
|
||||
setOpen: (open: boolean) => void;
|
||||
}
|
||||
const MeetingDetails: React.FC = () => {
|
||||
const open = useSelector(selectMeetingDetailsOpen);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const MeetingDetails: React.FC<Props> = (props) => {
|
||||
return (
|
||||
<Dialog fullScreen open={props.open} onClose={() => props.setOpen(false)}>
|
||||
<Header setOpen={props.setOpen} />
|
||||
<Dialog fullScreen open={open} onClose={() => dispatch(close())}>
|
||||
<Header />
|
||||
<Body />
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { AppBar, Button, IconButton, Toolbar, Typography } from "@mui/material";
|
||||
import React from "react";
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { close } from "../../../redux/slices/meetingDetailsOpenSlice";
|
||||
|
||||
interface Props {
|
||||
setOpen: (open: boolean) => void;
|
||||
}
|
||||
const Header: React.FC = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const Header: React.FC<Props> = (props) => {
|
||||
return (
|
||||
<AppBar sx={{ position: "relative" }}>
|
||||
<Toolbar>
|
||||
@@ -23,7 +23,7 @@ const Header: React.FC<Props> = (props) => {
|
||||
edge="start"
|
||||
color="inherit"
|
||||
aria-label="close"
|
||||
onClick={() => props.setOpen(false)}
|
||||
onClick={() => dispatch(close())}
|
||||
sx={{ ml: 1 }}
|
||||
>
|
||||
<CloseIcon />
|
||||
|
||||
Reference in New Issue
Block a user