diff --git a/CHANGELOG.md b/CHANGELOG.md index 205cb1ff5..dc807de6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ All notable changes to this project will be documented in this file. ### Changed - Cache the tracking script for 24 hours - Move `entry_page` and `exit_page` to be part of the `Page` filter group +- Paginate /api/sites results and add a `View all` link to the site-switcher dropdown in the dashboard. +- Remove the `+ Add Site` link to the site-switcher dropdown in the dashboard. ## v1.4.1 diff --git a/assets/js/dashboard/site-switcher.js b/assets/js/dashboard/site-switcher.js index 6f2fbd841..8298618da 100644 --- a/assets/js/dashboard/site-switcher.js +++ b/assets/js/dashboard/site-switcher.js @@ -23,7 +23,7 @@ export default class SiteSwitcher extends React.Component { document.addEventListener("keydown", this.handleKeydown); document.addEventListener('click', this.handleClick, false); } - + componentWillUnmount() { this.siteSwitcherButton.current.removeEventListener("click", this.toggle); document.removeEventListener("keydown", this.handleKeydown); @@ -38,7 +38,11 @@ export default class SiteSwitcher extends React.Component { if (!response.ok) { throw response } return response.json() }) - .then((sites) => this.setState({loading: false, sites: sites})) + .then((sites) => this.setState( + { + loading: false, + sites: sites.data.map(s => s.domain) + })) .catch((e) => this.setState({loading: false, error: e})) } @@ -55,7 +59,7 @@ export default class SiteSwitcher extends React.Component { handleKeydown(e) { if (!this.props.loggedIn) return; - + const { site } = this.props; const { sites } = this.state; @@ -73,7 +77,7 @@ export default class SiteSwitcher extends React.Component { toggle(e) { /** * React doesn't seem to prioritise its own events when events are bubbling, and is unable to stop its events from propagating to the document's (root) event listeners which are attached on the DOM. - * + * * A simple trick is to hook up our own click event listener via a ref node, which allows React to manage events in this situation better between the two. */ e.stopPropagation(); @@ -143,12 +147,9 @@ export default class SiteSwitcher extends React.Component { { this.state.sites.map(this.renderSiteLink.bind(this)) }
-