This repository has been archived by the owner on Jun 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
312 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { isLoaded as isAuthLoaded } from 'redux/actions/auth'; | ||
import { load as loadBookmarks } from 'redux/actions/bookmarks'; | ||
|
||
export const authConnect = ({ store: { getState, dispatch } }) => { | ||
const promises = []; | ||
|
||
if (isAuthLoaded(getState())) { | ||
promises.push(dispatch(loadBookmarks())); | ||
} | ||
|
||
return Promise.all(promises); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,72 @@ | ||
import React, { Component, PropTypes } from 'react'; | ||
import Helmet from 'react-helmet'; | ||
import { connect } from 'react-redux'; | ||
import { Link } from 'react-router'; | ||
|
||
import Grid from 'react-bootstrap/lib/Grid'; | ||
import Row from 'react-bootstrap/lib/Row'; | ||
import Col from 'react-bootstrap/lib/Col'; | ||
import Image from 'react-bootstrap/lib/Image'; | ||
import Tabs from 'react-bootstrap/lib/Tabs'; | ||
import Tab from 'react-bootstrap/lib/Tab'; | ||
|
||
import QuranNav from 'components/QuranNav'; | ||
import userType from 'types/userType'; | ||
|
||
const styles = require('./style.scss'); | ||
|
||
export const Profile = ({ user }) => ( | ||
<div> | ||
<Helmet title="The Noble Quran - القرآن الكريم" titleTemplate="%s" /> | ||
<QuranNav /> | ||
<div className={styles.header} /> | ||
<Grid> | ||
<Row> | ||
<Col md={12} className="text-center"> | ||
<Image src={`${user.image}?type=large`} circle className={styles.image} /> | ||
<h2> | ||
{user.name} | ||
</h2> | ||
</Col> | ||
</Row> | ||
</Grid> | ||
</div> | ||
); | ||
class Profile extends Component { | ||
static propTypes = { | ||
user: PropTypes.shape(userType), | ||
bookmarks: PropTypes.object.isRequired | ||
}; | ||
|
||
render() { | ||
const { user, bookmarks } = this.props; | ||
|
||
Profile.propTypes = { | ||
user: PropTypes.shape(userType) | ||
}; | ||
return ( | ||
<div> | ||
<Helmet title="The Noble Quran - القرآن الكريم" titleTemplate="%s" /> | ||
<QuranNav /> | ||
<div className={styles.header} /> | ||
<Grid> | ||
<Row> | ||
<Col md={12} className="text-center"> | ||
<Image src={`${user.image}?type=large`} circle className={styles.image} /> | ||
<h2> | ||
{user.name} | ||
</h2> | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col md={6} mdOffset={3}> | ||
<Tabs bsStyle="pills" defaultActiveKey={1} className={styles.tabs} id="tabs"> | ||
<Tab eventKey={1} title="Bookmarks"> | ||
<ul className="list-group"> | ||
{ | ||
Object.values(bookmarks).map(bookmark => ( | ||
<Link to={bookmark.ayahKey.split(':').join('/')} className="list-group-item"> | ||
{bookmark.ayahKey} | ||
</Link> | ||
)) | ||
} | ||
</ul> | ||
</Tab> | ||
<Tab eventKey={2} title="Notes"> | ||
Notes... | ||
</Tab> | ||
</Tabs> | ||
</Col> | ||
</Row> | ||
</Grid> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default connect( | ||
state => ({ | ||
user: state.auth.user | ||
user: state.auth.user, | ||
bookmarks: state.bookmarks.entities | ||
}) | ||
)(Profile); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.