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

collapsible feature added #623

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
74 changes: 47 additions & 27 deletions src/user/dashboard/Community/CommunitySetting.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, { Component } from 'react'
import LeftNav from './LeftNav'
import './community.scss'
import OrgProfile from './components/OrgProfile';
import OrgPermission from './components/OrgPermission'
import OrgSetting from './components/OrgSettings'
import OrgAuth from './components/OrgAuth'
import Navigation from '../navigation/navigation'
import { connect } from 'react-redux'
import OrgMaintenance from './components/OrgMaintenance';
import Users from '../../Activity/Users'
import React, { Component } from "react";
import LeftNav from "./LeftNav";
import "./community.scss";
import OrgProfile from "./components/OrgProfile";
import OrgPermission from "./components/OrgPermission";
import OrgSetting from "./components/OrgSettings";
import OrgAuth from "./components/OrgAuth";
import Navigation from "../navigation/navigation";
import { connect } from "react-redux";
import OrgMaintenance from "./components/OrgMaintenance";
import Users from "../../Activity/Users";

class CommunitySetting extends Component {
constructor(props) {
Expand All @@ -20,28 +20,47 @@ class CommunitySetting extends Component {
settings: false,
permission: false,
authentication: false,
maintenance: false
}
maintenance: false,
},
sideBarOpen: true,
};
}
componentDidMount() {
this.setState({ view: 'profile' })
this.setState({ view: "profile" });
}
changeOption = (name) => {
const keys = Object.keys(this.state.option)
let item = keys.filter(k => k === name)
console.log('item ', item)
this.setState({ option: { profile: false }})
this.setState({ option: { [name]: true }})
this.setState({ view: name })
}
const keys = Object.keys(this.state.option);
let item = keys.filter((k) => k === name);
console.log("item ", item);
this.setState({ option: { profile: false } });
this.setState({ option: { [name]: true } });
this.setState({ view: name });
};
handleViewSidebar = () => {
console.log(this.state.sideBarOpen);
this.setState({ sideBarOpen: !this.state.sideBarOpen });
};
render() {
const { view } = this.state;
var sideBarClass = this.state.sideBarOpen ? "sidebar-open" : "sidebar";
return (
<div className="overall_container">
<div className="main_navigation">
<div className={sideBarClass}>
<Navigation orgSettings={this.state.org} user={this.props.user} />
</div>
<button
onClick={this.handleViewSidebar}
className="sidebar-toggle"
style={
sideBarClass === "sidebar-open"
? { marginLeft: "13vw" }
: { marginLeft: 0 }
}
>
<div />
<div />
<div />
</button>
<div className="org_settings_view">
<div className="main_section">
<div className="left_nav">
Expand All @@ -60,9 +79,10 @@ class CommunitySetting extends Component {
{view === "authentication" ? <OrgAuth /> : null}
{view === "maintenance" ? <OrgMaintenance /> : null}
{view === "activity" ? (
<Users
<Users
handleOption={{ changeOption: this.changeOption.bind(this) }}
/>) : null }
/>
) : null}
</div>
</div>
</div>
Expand All @@ -75,6 +95,6 @@ const mapStateToProps = (state) => ({
auth: state.auth,
error: state.error,
user: state.user,
org: state.org
})
export default connect(mapStateToProps)(CommunitySetting);
org: state.org,
});
export default connect(mapStateToProps)(CommunitySetting);
57 changes: 55 additions & 2 deletions src/user/dashboard/Community/community.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.overall_container {
display: flex;
.main_navigation {
/*.main_navigation {
background: #f5f5f5;
flex-grow: 1;
border-right: solid 1px #dfe9f1;
Expand All @@ -9,9 +9,62 @@
bottom: 0px;
left: 0px;
overflow-y: scroll;
}*/
.sidebar {
background: #f5f5f5;
flex-grow: 1;
border-right: solid 1px #dfe9f1;
position: fixed;
top: 0px;
bottom: 0px;
left: 0px;
overflow-y: scroll;
transition: 0.3s ease-in-out;
width: 0;
overflow-x: hidden;
}
.sidebar-open {
width: 13vw;
background: #f5f5f5;
flex-grow: 1;
border-right: solid 1px #dfe9f1;
position: fixed;
top: 0px;
bottom: 0px;
left: 0px;
overflow-y: scroll;
overflow-x: hidden;
transition: 0.3s ease-in-out;
}

.sidebar-toggle {
position: sticky;
top: 30px;
left: 0;
bottom: 0;
transition: 0.3s ease-in-out;
width: 2.5rem;
height: 2.5rem;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
background: #007bff;
rajprakash00 marked this conversation as resolved.
Show resolved Hide resolved
border-radius: 50%;
border: none;
padding: 5px;
&:focus {
outline: none;
}
div {
width: 1.5rem;
height: 0.25rem;
background: white;
border-radius: 10px;
}
}
.org_settings_view {
margin-left: 13vw;
//margin-left: 13vw;
margin-top: 35px;
.main_section {
display: flex;
Expand Down
88 changes: 61 additions & 27 deletions src/user/dashboard/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import NewsFeed from "./news-feed/news-feed";
import notifyUsersLoading from "../../placeholderLoading/notifyUsersLoading/notifyUsersLoading";
import portfolioLoading from "../../placeholderLoading/portfolioLoading/portfolioLoading";
import newsFeedLoading from "../../placeholderLoading/newsFeedLoading/newsFeedLoading";
import { connect } from 'react-redux'
import { connect } from "react-redux";
import { getAllEvents } from "../../actions/eventAction";
import { getAllPosts } from "../../actions/postAction";
import { getAllProjects } from "../../actions/projectAction";
Expand All @@ -22,46 +22,67 @@ class Dashboard extends Component {
allPosts: [],
allProjects: [],
allEvents: [],
allMix: []
allMix: [],
sideBarOpen: true,
};
}

componentDidMount() {
setTimeout(() => {
this.props.getAllEvents();
})
});
setTimeout(() => {
this.props.getAllPosts()
})
this.props.getAllPosts();
});
setTimeout(() => {
this.props.getAllProjects()
})
this.props.getAllProjects();
});
setTimeout(() => {
this.setState({ isLoading: false });
}, 1000);
}

componentWillReceiveProps(nextProps) {
console.log('dashboard ', nextProps)
const { event, project, post } = nextProps
let all = [...event?.allEvents, ...post?.allPosts, ...project?.allProjects]
this.setState({
allEvents: event?.allEvents,
allPosts: post?.allPosts,
allProjects: project?.allProjects,
allMix: all
}, () => {
console.log('updated dashboard ', this.state)
})
console.log("dashboard ", nextProps);
const { event, project, post } = nextProps;
let all = [...event?.allEvents, ...post?.allPosts, ...project?.allProjects];
this.setState(
{
allEvents: event?.allEvents,
allPosts: post?.allPosts,
allProjects: project?.allProjects,
allMix: all,
},
() => {
console.log("updated dashboard ", this.state);
}
);
}

handleViewSidebar = () => {
console.log(this.state.sideBarOpen);
this.setState({ sideBarOpen: !this.state.sideBarOpen });
};
render() {
const { allMix, allEvents, allProjects, allPosts } = this.state
return (
const { allMix, allEvents, allProjects, allPosts } = this.state;
var sideBarClass = this.state.sideBarOpen ? "sidebar-open" : "sidebar";
return (
<div className="dashboard">
<div className="navigation">
<div className={sideBarClass}>
<Navigation dashboard={this.state.dashboard}></Navigation>
</div>
<button
onClick={this.handleViewSidebar}
className="sidebar-toggle"
style={
sideBarClass === "sidebar-open"
? { marginLeft: "13vw" }
: { marginLeft: 0 }
}
>
<div />
<div />
<div />
</button>
<div className="news">
{this.state.isLoading ? (
notifyUsersLoading()
Expand All @@ -71,7 +92,16 @@ class Dashboard extends Component {
<Notifications></Notifications>
</div>
)}
{this.state.isLoading ? newsFeedLoading() : <NewsFeed allMix={allMix} allProjects={allProjects} allPosts={allPosts} allEvents={allEvents}/>}
{this.state.isLoading ? (
newsFeedLoading()
) : (
<NewsFeed
allMix={allMix}
allProjects={allProjects}
allPosts={allPosts}
allEvents={allEvents}
/>
)}
</div>
<div className="promotions">
{this.state.isLoading ? portfolioLoading() : <Portfolio />}
Expand All @@ -81,13 +111,17 @@ class Dashboard extends Component {
}
}

// map state to props
// map state to props
const mapStateToProps = (state) => ({
auth: state.auth,
error: state.error,
event: state.event,
post: state.post,
project: state.project
})
project: state.project,
});

export default connect(mapStateToProps, { getAllEvents, getAllPosts, getAllProjects })(Dashboard);
export default connect(mapStateToProps, {
getAllEvents,
getAllPosts,
getAllProjects,
})(Dashboard);
57 changes: 55 additions & 2 deletions src/user/dashboard/dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
min-height: 100vh;
height: auto;
font-family: Muli, sans-serif;
.navigation {
/*.navigation {
background: #f5f5f5;
flex-grow: 1;
border-right: solid 1px #dfe9f1;
Expand All @@ -12,9 +12,62 @@
bottom: 0px;
left: 0px;
overflow-y: scroll;
}*/
.sidebar {
background: #f5f5f5;
flex-grow: 1;
border-right: solid 1px #dfe9f1;
position: fixed;
top: 0px;
bottom: 0px;
left: 0px;
overflow-y: scroll;
transition: 0.3s ease-in-out;
width: 0;
overflow-x: hidden;
}
.sidebar-open {
width: 13vw;
background: #f5f5f5;
flex-grow: 1;
border-right: solid 1px #dfe9f1;
position: fixed;
top: 0px;
bottom: 0px;
left: 0px;
overflow-y: scroll;
overflow-x: hidden;
transition: 0.3s ease-in-out;
}

.sidebar-toggle {
position: sticky;
top: 10px;
left: 0;
bottom: 0;
transition: 0.3s ease-in-out;
width: 2.5rem;
height: 2.5rem;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
background: #007bff;
border-radius: 50%;
border: none;
padding: 5px;
&:focus {
outline: none;
}
div {
width: 1.5rem;
height: 0.25rem;
background: white;
border-radius: 10px;
}
}
.news {
margin-left: 13vw;
//margin-left: 13vw;
flex-grow: 4;
.notify-user {
display: flex;
Expand Down
Loading