Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organization list in personal account settings is dynamically updated #31

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/Organization/ViewOrganization/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ const ViewOrganization = () => {

const currentOrgData = useSelector(
({
org: {
data: { data }
}
}) => data
profile: {
data: { organizations }
},
}) => (organizations ? organizations[0] : undefined)
);

const organizations = useSelector(
Expand Down
101 changes: 45 additions & 56 deletions src/components/Profile/Organizations/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,69 +5,58 @@ import GitHubIcon from "@mui/icons-material/GitHub";
import TwitterIcon from "@mui/icons-material/Twitter";
import useStyles from "./styles";
import OrganizationData from "../../../temp_data/Organizations.json";
import { useSelector } from "react-redux";

const Organizations = () => {
const classes = useStyles();
const currentProfileData = useSelector(
({ firebase: { profile } }) => profile
);

return (
<Card className={classes.card} data-testId="organizationsPage">
<CardContent className={classes.content}>
<Box sx={{ display: "flex", justifyContent: "space-between" }}>
<Box className={classes.left} data-testId="organizations">
<Box className={classes.column}>
<img
src={GoogleImg}
alt="google"
// onClick={() => signInWithGoogle()(firebase, dispatch)}
className={classes.googleIcon}
/>
<GitHubIcon className={classes.git}>
<span className="sm-text">Github</span>
</GitHubIcon>
<TwitterIcon className={classes.tw}>
<span className="sm-text">Twitter</span>
</TwitterIcon>
</Box>
<Box className={classes.organizations} style={{ margin: "1px 0" }}>
{OrganizationData.map(el => (
<Typography className={classes.organization}>
{el.organization}
</Typography>
))}
</Box>
<Box className={classes.column} style={{ padding: "4px 0" }}>
{OrganizationData.map(el => (
<Typography className={classes.role}>{el.role}</Typography>
))}
</Box>
</Box>
<Box className={classes.right}>
<Box className={classes.column} data-testId="settings">
<Button className={classes.button}>Settings</Button>
<Button className={classes.button}>Settings</Button>
<Button className={classes.button}>Settings</Button>
</Box>
<Box className={classes.column} data-testId="leave">
<Button
className={classes.button}
style={{ background: "red", color: "white" }}
>
Leave
</Button>
<Button
className={classes.button}
style={{ background: "red", color: "white" }}
>
Leave
</Button>
<Button
className={classes.button}
style={{ background: "red", color: "white" }}
>
Leave
</Button>
</Box>
</Box>
<Box className={classes.content} sx={{ display: "flex", justifyContent: "space-between" }}>
{currentProfileData.organizations.map((role, index) => (
<Box className={classes.content} sx={{ display: "flex", justifyContent: "space-between" }} key={index}>
<Box className={classes.left} style={{justifyContent: "flex-start" }} data-testId="organizations">
<Box className={classes.column}>
<img
src={GoogleImg}
alt="google"
// onClick={() => signInWithGoogle()(firebase, dispatch)}
className={classes.googleIcon}
style={{marginRight : "40px"}}
/>
</Box>
<Box className={classes.organizations} style={{ margin: "1px 0",marginRight : "40px" }}>
<Typography className={classes.organization}>{role}</Typography>
</Box>
<Box className={classes.column} style={{ padding: "4px 0",marginRight : "40px" }}>
<Typography className={classes.role}>Owner</Typography>
</Box>
</Box>
<Box className={classes.right}>
</Box>
<Box className={classes.right}>
</Box>

<Box className={classes.right} >
<Box className={classes.column} data-testId="settings">
<Button className={classes.button}>Settings</Button>
</Box>
<Box className={classes.column} data-testId="leave">
<Button
className={classes.button}
style={{ background: "red", color: "white" }}
>
Leave
</Button>
</Box>
</Box>
</Box>

))}
</Box>
</CardContent>
</Card>
Expand Down
5 changes: 3 additions & 2 deletions src/components/Profile/Organizations/styles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const useStyles = makeStyles(theme => ({
}
},
content: {
width: 720,
"@media (max-width: 380px)": {
padding: 10
}
Expand All @@ -22,7 +23,7 @@ const useStyles = makeStyles(theme => ({
justifyContent: "space-between",
alignItems: "stretch",
height: 135,
width: 210,
width: '60%',
"@media (max-width: 380px)": {
width: 150
}
Expand Down Expand Up @@ -96,7 +97,7 @@ const useStyles = makeStyles(theme => ({
justifyContent: "space-between",
alignItems: "stretch",
height: 135,
width: 180,
width: '60%',
"@media (max-width: 380px)": {
width: 140
}
Expand Down