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

Implementation of Sidebar #36

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 15 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
20 changes: 20 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
75 changes: 37 additions & 38 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,65 @@
import React, { Component } from 'react';
import React, { Component } from "react";

import { isAuthenticated } from './utils/Token'
import { Switch, Route, Redirect } from 'react-router-dom'

import LoginPage from './pages/Auth/Login'
import SearchOrgPage from './pages/Guest/SearchOrg'
import HomePage from './pages/Guest/Home'
import { isAuthenticated } from "./utils/Token";
import { Switch, Route, Redirect } from "react-router-dom";

import LoginPage from "./pages/Auth/Login";
import SearchOrgPage from "./pages/Guest/SearchOrg";
import HomePage from "./pages/Guest/Home";

class App extends Component {
// In case of user is not logged in(token not found) then the Private route will redirect the user to the login page
// In case of user is not logged in(token not found) then the Private route will redirect the user to the login page
PrivateRoute = ({ component, ...rest }) => {
let ResultComponent = component
ResultComponent = <ResultComponent />
let ResultComponent = component;
ResultComponent = <ResultComponent />;

if (!isAuthenticated()) {
ResultComponent = <Redirect to={{
pathname: "/login/",
}} />
ResultComponent = (
<Redirect
to={{
pathname: "/login/",
}}
/>
);
}

return (
<Route
{...rest}
render={props => ResultComponent}
/>
);
}
return <Route {...rest} render={(props) => ResultComponent} />;
};

// In case of user is logged in(token found) then the Public route will not let the user enter login or signup page
// In case of user is logged in(token found) then the Public route will not let the user enter login or signup page
PublicRoute = ({ component, ...rest }) => {
let ResultComponent = component
ResultComponent = <ResultComponent />
let ResultComponent = component;
ResultComponent = <ResultComponent />;

if (isAuthenticated()) {
ResultComponent = <Redirect to={{
pathname: "/searchOrgs/",
}} />
ResultComponent = (
<Redirect
to={{
pathname: "/searchOrgs/",
}}
/>
);
}

return (
<Route
{...rest}
render={props => ResultComponent}
/>
);
}

return <Route {...rest} render={(props) => ResultComponent} />;
};

render() {
return (
<div className="App">
{this.props.token}
<Switch>
<this.PrivateRoute exact path="/searchOrgs/" component={SearchOrgPage} />
<this.PrivateRoute
exact
path="/searchOrgs/"
component={SearchOrgPage}
/>
<this.PublicRoute exact path="/login/" component={LoginPage} />
<Route exact path='/' component={HomePage} />
<Route exact path="/" component={HomePage} />
</Switch>
</div>
);
}
}


export default App
export default App;
Binary file added src/assets/icons/facebook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/instagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/linkedin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/twitter-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/whatsapp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
192 changes: 95 additions & 97 deletions src/components/GroupDetail/GroupRole.js
Original file line number Diff line number Diff line change
@@ -1,112 +1,110 @@
import React, { Fragment } from 'react';
import React, { Fragment } from "react";
import {
Grid,
Card,
Button,
TextareaAutosize,
Typography,
} from '@material-ui/core';
import LockIcon from '@material-ui/icons/Lock';
import { Skeleton } from '@material-ui/lab';
import PropTypes from 'prop-types';
Grid,
Card,
Button,
TextareaAutosize,
Typography,
} from "@material-ui/core";
import "./default.css";
import LockIcon from "@material-ui/icons/Lock";
import { Skeleton } from "@material-ui/lab";
import PropTypes from "prop-types";
naveennvrgup marked this conversation as resolved.
Show resolved Hide resolved

const classes = {
card_style: {
margin: '10px auto',
padding: '20px 20px',
textAlign: 'center',
width: '500px',
fontSize: '18px',
},
text_area: {
width: '450px',
},
card_style: {
margin: "10px auto",
padding: "20px 20px",
textAlign: "center",
width: "500px",
fontSize: "18px",
},
text_area: {
width: "450px",
},
};

const GroupRole = ({
stateData: { loading, role, edit, isAdmin },
setEdit,
stateData: { loading, role, edit, isAdmin },
setEdit,
}) => {
return (
<Card style={classes.card_style}>
<Button
style={{ 'margin-left': '400px' }}
disabled={loading}
variant='contained'
color='primary'
onClick={() => setEdit(edit)}>
{isAdmin ? (
edit ? (
<div>Save</div>
) : (
<div>Edit</div>
)
) : (
<div>
Edit
<span style={{ margin: 5 }}>
<LockIcon style={{ fontSize: 12 }} />
</span>
</div>
)}
</Button>
<Grid
container
direction='column'
justify='center'
alignItems='center'>
<Grid item style={{ width: '100%' }}>
<Typography align='center' variant='h5'>
Role
</Typography>
</Grid>
return (
<Card style={classes.card_style}>
<Button
style={{ "margin-left": "400px" }}
disabled={loading}
variant="contained"
color="primary"
onClick={() => setEdit(edit)}
>
{isAdmin ? (
edit ? (
<div>Save</div>
) : (
<div>Edit</div>
)
) : (
<div>
Edit
<span style={{ margin: 5 }}>
<LockIcon style={{ fontSize: 12 }} />
</span>
</div>
)}
</Button>
<Grid container direction="column" justify="center" alignItems="center">
<Grid item style={{ width: "100%" }}>
<Typography align="center" variant="h5">
Role
</Typography>
</Grid>

<Grid item style={{ width: '100%' }}>
{loading ? (
<Fragment>
<Skeleton
variant='text'
animation='wave'
style={{ width: '100%' }}
/>
<Skeleton
variant='text'
animation='wave'
style={{ width: '100%' }}
/>
</Fragment>
) : (
<Fragment>
{isAdmin ? (
edit ? (
<TextareaAutosize
style={classes.text_area}
defaultValue={role}
rowsMin={4}
/>
) : (
<p>{role}</p>
)
) : (
<p>{role}</p>
)}
</Fragment>
)}
</Grid>
</Grid>
</Card>
);
<Grid item style={{ width: "100%" }}>
{loading ? (
<Fragment>
<Skeleton
variant="text"
animation="wave"
style={{ width: "100%" }}
/>
<Skeleton
variant="text"
animation="wave"
style={{ width: "100%" }}
/>
</Fragment>
) : (
<Fragment>
{isAdmin ? (
edit ? (
<TextareaAutosize
style={classes.text_area}
defaultValue={role}
rowsMin={4}
/>
) : (
<p>{role}</p>
)
) : (
<p>{role}</p>
)}
</Fragment>
)}
</Grid>
</Grid>
</Card>
);
};

//Prop types for checking the props passed. This would throw an error when no props are passed
GroupRole.propTypes = {
stateData: PropTypes.shape({
role: PropTypes.string.isRequired,
loading: PropTypes.bool.isRequired,
edit: PropTypes.bool.isRequired,
isAdmin: PropTypes.bool.isRequired,
}),
setEdit: PropTypes.func.isRequired,
stateData: PropTypes.shape({
role: PropTypes.string.isRequired,
loading: PropTypes.bool.isRequired,
edit: PropTypes.bool.isRequired,
isAdmin: PropTypes.bool.isRequired,
}),
setEdit: PropTypes.func.isRequired,
};

export default GroupRole;
1 change: 1 addition & 0 deletions src/components/GroupDetail/PermissionsUI.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from "react";
import Paper from "@material-ui/core/Paper";
import { makeStyles } from "@material-ui/core/styles";
import "./default.css";
import Grid from "@material-ui/core/Grid";

import Typography from "@material-ui/core/Typography";
Expand Down
3 changes: 3 additions & 0 deletions src/components/GroupDetail/default.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* .MuiPaper-root {
background-color: #fff !important;
} */
Loading