This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
6523575
commit 36ce0ce
Showing
25 changed files
with
111 additions
and
111 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,81 @@ | ||
|
||
import React, { Component, Fragment } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
import { compose } from 'redux'; | ||
import { asyncConnect } from 'redux-connect'; | ||
import { Link } from 'react-router-dom' | ||
import { Link } from 'react-router-dom'; | ||
|
||
import { getBaseUrl } from '@plone/volto/helpers'; | ||
import { | ||
getNavigation, | ||
} from '@plone/volto/actions'; | ||
import { getNavSiteMap } from '~/actions'; | ||
import { getNavigation } from '@plone/volto/actions'; | ||
import { getNavSiteMap } from '@eeacms/volto-forests-theme/actions'; | ||
|
||
/** | ||
* @export | ||
* @class SiteMap | ||
* @extends {Component} | ||
*/ | ||
class SiteMap extends Component { | ||
/** | ||
* Property types. | ||
* @property {Object} propTypes Property types. | ||
* @static | ||
*/ | ||
static propTypes = { | ||
pathname: PropTypes.string.isRequired, | ||
getNavSiteMap: PropTypes.func.isRequired, | ||
}; | ||
/** | ||
* Property types. | ||
* @property {Object} propTypes Property types. | ||
* @static | ||
*/ | ||
static propTypes = { | ||
pathname: PropTypes.string.isRequired, | ||
getNavSiteMap: PropTypes.func.isRequired, | ||
}; | ||
|
||
componentDidMount() { | ||
this.props.getNavSiteMap(getBaseUrl(this.props.location.pathname), 100); | ||
} | ||
/** | ||
* Render method. | ||
* @method render | ||
* @returns {string} Markup for the component. | ||
*/ | ||
render() { | ||
const { navigation } = this.props; | ||
componentDidMount() { | ||
this.props.getNavSiteMap(getBaseUrl(this.props.location.pathname), 100); | ||
} | ||
/** | ||
* Render method. | ||
* @method render | ||
* @returns {string} Markup for the component. | ||
*/ | ||
render() { | ||
const { navigation } = this.props; | ||
|
||
const TreeMap = ({ data }) => { | ||
const TreeMap = ({ data }) => { | ||
return ( | ||
<ul> | ||
{data.map((m, i) => { | ||
return ( | ||
<ul> | ||
{data.map((m, i) => { | ||
return ( | ||
<li key={i}> | ||
<Link to="/"> | ||
{m.title} | ||
</Link> | ||
{m.items && !!m.items.length && <TreeMap data={m.items} />} | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
<li key={i}> | ||
<Link to="/">{m.title}</Link> | ||
{m.items && !!m.items.length && <TreeMap data={m.items} />} | ||
</li> | ||
); | ||
}; | ||
})} | ||
</ul> | ||
); | ||
}; | ||
|
||
return ( | ||
<Fragment> | ||
<TreeMap data={navigation.items} /> | ||
</Fragment> | ||
); | ||
} | ||
return ( | ||
<Fragment> | ||
<TreeMap data={navigation.items} /> | ||
</Fragment> | ||
); | ||
} | ||
} | ||
|
||
export const __test__ = connect( | ||
(state, props) => ({ | ||
pathname: props.location.pathname, | ||
content: state.content.data, | ||
}), | ||
{}, | ||
(state, props) => ({ | ||
pathname: props.location.pathname, | ||
content: state.content.data, | ||
}), | ||
{}, | ||
)(SiteMap); | ||
|
||
export default compose( | ||
asyncConnect([ | ||
{ | ||
key: 'navigation', | ||
promise: ({ location, store: { dispatch } }) => | ||
dispatch(getNavSiteMap(getBaseUrl(location.pathname), 100)), | ||
}, | ||
]), | ||
connect((state, props) => ({ pathname: props.location.pathname }), { getNavSiteMap }), | ||
)(SiteMap); | ||
asyncConnect([ | ||
{ | ||
key: 'navigation', | ||
promise: ({ location, store: { dispatch } }) => | ||
dispatch(getNavSiteMap(getBaseUrl(location.pathname), 100)), | ||
}, | ||
]), | ||
connect((state, props) => ({ pathname: props.location.pathname }), { | ||
getNavSiteMap, | ||
}), | ||
)(SiteMap); |
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
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
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
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.