diff --git a/assets/js/dashboard/stats/sources/source-list.js b/assets/js/dashboard/stats/sources/source-list.js index 0020dca38..2eb9b0c17 100644 --- a/assets/js/dashboard/stats/sources/source-list.js +++ b/assets/js/dashboard/stats/sources/source-list.js @@ -15,7 +15,7 @@ class AllSources extends React.Component { constructor(props) { super(props) this.onVisible = this.onVisible.bind(this) - this.state = {loading: true} + this.state = { loading: true } } onVisible() { @@ -25,7 +25,7 @@ class AllSources extends React.Component { componentDidUpdate(prevProps) { if (this.props.query !== prevProps.query) { - this.setState({loading: true, referrers: null}) + this.setState({ loading: true, referrers: null }) this.fetchReferrers() } } @@ -39,12 +39,12 @@ class AllSources extends React.Component { } fetchReferrers() { - api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/sources`, this.props.query, {show_noref: this.showNoRef()}) - .then((res) => this.setState({loading: false, referrers: res})) + api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/sources`, this.props.query, { show_noref: this.showNoRef() }) + .then((res) => this.setState({ loading: false, referrers: res })) } renderReferrer(referrer) { - const maxWidthDeduction = this.showConversionRate() ? "10rem" : "5rem" + const maxWidthDeduction = this.showConversionRate() ? "10rem" : "5rem" return (
- { referrer.name } + {referrer.name} - {numberFormatter(referrer.visitors)} + {numberFormatter(referrer.visitors)} {this.showConversionRate() && {referrer.conversion_rate}%}
) @@ -116,11 +116,11 @@ class AllSources extends React.Component {

Top Sources

- { this.props.renderTabs() } + {this.props.renderTabs()}
- { this.state.loading &&
} + {this.state.loading &&
} - { this.renderList() } + {this.renderList()}
) @@ -131,24 +131,24 @@ class AllSources extends React.Component {
- { this.renderContent() } + {this.renderContent()}
) } } const UTM_TAGS = { - utm_medium: {label: 'UTM Medium', shortLabel: 'UTM Medium', endpoint: 'utm_mediums'}, - utm_source: {label: 'UTM Source', shortLabel: 'UTM Source', endpoint: 'utm_sources'}, - utm_campaign: {label: 'UTM Campaign', shortLabel: 'UTM Campai', endpoint: 'utm_campaigns'}, - utm_content: {label: 'UTM Content', shortLabel: 'UTM Conten', endpoint: 'utm_contents'}, - utm_term: {label: 'UTM Term', shortLabel: 'UTM Term', endpoint: 'utm_terms'}, + utm_medium: { label: 'UTM Medium', shortLabel: 'UTM Medium', endpoint: 'utm_mediums' }, + utm_source: { label: 'UTM Source', shortLabel: 'UTM Source', endpoint: 'utm_sources' }, + utm_campaign: { label: 'UTM Campaign', shortLabel: 'UTM Campai', endpoint: 'utm_campaigns' }, + utm_content: { label: 'UTM Content', shortLabel: 'UTM Conten', endpoint: 'utm_contents' }, + utm_term: { label: 'UTM Term', shortLabel: 'UTM Term', endpoint: 'utm_terms' }, } class UTMSources extends React.Component { constructor(props) { super(props) - this.state = {loading: true} + this.state = { loading: true } } componentDidMount() { @@ -158,7 +158,7 @@ class UTMSources extends React.Component { componentDidUpdate(prevProps) { if (this.props.query !== prevProps.query || this.props.tab !== prevProps.tab) { - this.setState({loading: true, referrers: null}) + this.setState({ loading: true, referrers: null }) this.fetchReferrers() } } @@ -173,12 +173,12 @@ class UTMSources extends React.Component { fetchReferrers() { const endpoint = UTM_TAGS[this.props.tab].endpoint - api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/${endpoint}`, this.props.query, {show_noref: this.showNoRef()}) - .then((res) => this.setState({loading: false, referrers: res})) + api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/${endpoint}`, this.props.query, { show_noref: this.showNoRef() }) + .then((res) => this.setState({ loading: false, referrers: res })) } renderReferrer(referrer) { - const maxWidthDeduction = this.showConversionRate() ? "10rem" : "5rem" + const maxWidthDeduction = this.showConversionRate() ? "10rem" : "5rem" return (
- { referrer.name } + {referrer.name} - {numberFormatter(referrer.visitors)} + {numberFormatter(referrer.visitors)} {this.showConversionRate() && {referrer.conversion_rate}%}
) @@ -247,11 +247,11 @@ class UTMSources extends React.Component {

Top Sources

- { this.props.renderTabs() } + {this.props.renderTabs()}
- { this.state.loading &&
} + {this.state.loading &&
} - { this.renderList() } + {this.renderList()}
) @@ -262,7 +262,7 @@ class UTMSources extends React.Component {
- { this.renderContent() } + {this.renderContent()}
) } @@ -286,7 +286,7 @@ export default class SourceList extends React.Component { setTab(tab) { return () => { storage.setItem(this.tabKey, tab) - this.setState({tab}) + this.setState({ tab }) } } @@ -303,7 +303,7 @@ export default class SourceList extends React.Component {
- {buttonText} + {buttonText}
@@ -319,7 +319,7 @@ export default class SourceList extends React.Component { >
- { dropdownOptions.map((option) => { + {dropdownOptions.map((option) => { return ( {({ active }) => (