Skip to content

Commit

Permalink
Modal no longer needs site
Browse files Browse the repository at this point in the history
  • Loading branch information
aerosol committed Jun 30, 2024
1 parent 40cca89 commit 2a97dc5
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion assets/js/dashboard/stats/modals/conversions.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function ConversionsModal(props) {
}

return (
<Modal site={site}>
<Modal>
{renderBody()}
{loading && renderLoading()}
{!loading && moreResultsAvailable && renderLoadMore()}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/dashboard/stats/modals/entry-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class EntryPagesModal extends React.Component {

render() {
return (
<Modal site={this.props.site}>
<Modal>
{this.renderBody()}
{this.renderLoading()}
</Modal>
Expand Down
2 changes: 1 addition & 1 deletion assets/js/dashboard/stats/modals/exit-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class ExitPagesModal extends React.Component {

render() {
return (
<Modal site={this.props.site}>
<Modal>
{this.renderBody()}
{this.renderLoading()}
</Modal>
Expand Down
2 changes: 1 addition & 1 deletion assets/js/dashboard/stats/modals/filter-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class FilterModal extends React.Component {

render() {
return (
<Modal site={this.props.site} maxWidth="460px">
<Modal maxWidth="460px">
<h1 className="text-xl font-bold dark:text-gray-100">Filter by {formatFilterGroup(this.state.modalType)}</h1>

<div className="mt-4 border-b border-gray-300"></div>
Expand Down
10 changes: 5 additions & 5 deletions assets/js/dashboard/stats/modals/google-keywords.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Link, withRouter } from 'react-router-dom'
import Modal from './modal'
import * as api from '../../api'
import numberFormatter, { percentageFormatter } from '../../util/number-formatter'
import {parseQuery} from '../../query'
import { parseQuery } from '../../query'
import RocketIcon from './rocket-icon'

class GoogleKeywordsModal extends React.Component {
Expand All @@ -17,7 +17,7 @@ class GoogleKeywordsModal extends React.Component {
}

componentDidMount() {
api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/referrers/Google`, this.state.query, {limit: 100})
api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/referrers/Google`, this.state.query, { limit: 100 })
.then((res) => this.setState({
loading: false,
searchTerms: res.search_terms,
Expand Down Expand Up @@ -99,7 +99,7 @@ class GoogleKeywordsModal extends React.Component {

<div className="my-4 border-b border-gray-300 dark:border-gray-500"></div>
<main className="modal__content">
{ this.renderKeywords() }
{this.renderKeywords()}
</main>
</React.Fragment>
)
Expand All @@ -108,8 +108,8 @@ class GoogleKeywordsModal extends React.Component {

render() {
return (
<Modal site={this.props.site} show={!this.state.loading}>
{ this.renderBody() }
<Modal show={!this.state.loading}>
{this.renderBody()}
</Modal>
)
}
Expand Down
4 changes: 2 additions & 2 deletions assets/js/dashboard/stats/modals/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class PagesModal extends React.Component {
if (this.state.pages) {
return (
<React.Fragment>
<h1 className="text-xl font-bold dark:text-gray-100">Top Pages</h1>
<h1 className="text-xl font-bold dark:text-gray-100">Top Pages hi</h1>

<div className="my-4 border-b border-gray-300"></div>
<main className="modal__content">
Expand Down Expand Up @@ -141,7 +141,7 @@ class PagesModal extends React.Component {

render() {
return (
<Modal site={this.props.site}>
<Modal>
{this.renderBody()}
{this.renderLoading()}
</Modal>
Expand Down
2 changes: 1 addition & 1 deletion assets/js/dashboard/stats/modals/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function PropsModal(props) {
}

return (
<Modal site={site}>
<Modal>
{renderBody()}
{loading && renderLoading()}
{!loading && moreResultsAvailable && renderLoadMore()}
Expand Down
32 changes: 16 additions & 16 deletions assets/js/dashboard/stats/modals/referrer-drilldown.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Link, withRouter } from 'react-router-dom'

import Modal from './modal'
import * as api from '../../api'
import numberFormatter, {durationFormatter} from '../../util/number-formatter'
import {parseQuery} from '../../query'
import numberFormatter, { durationFormatter } from '../../util/number-formatter'
import { parseQuery } from '../../query'
import { updatedQuery } from "../../util/url";
import { hasGoalFilter, replaceFilterByPrefix } from "../../util/filters";

Expand All @@ -20,8 +20,8 @@ class ReferrerDrilldownModal extends React.Component {
componentDidMount() {
const detailed = this.showExtra()

api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/referrers/${this.props.match.params.referrer}`, this.state.query, {limit: 100, detailed})
.then((response) => this.setState({loading: false, referrers: response.results}))
api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/referrers/${this.props.match.params.referrer}`, this.state.query, { limit: 100, detailed })
.then((response) => this.setState({ loading: false, referrers: response.results }))
}

showExtra() {
Expand All @@ -45,15 +45,15 @@ class ReferrerDrilldownModal extends React.Component {
}

formatBounceRate(ref) {
if (typeof(ref.bounce_rate) === 'number') {
if (typeof (ref.bounce_rate) === 'number') {
return ref.bounce_rate + '%'
} else {
return '-'
}
}

formatDuration(referrer) {
if (typeof(referrer.visit_duration) === 'number') {
if (typeof (referrer.visit_duration) === 'number') {
return durationFormatter(referrer.visit_duration)
} else {
return '-'
Expand All @@ -77,12 +77,12 @@ class ReferrerDrilldownModal extends React.Component {
<img src={`/favicon/sources/${referrer.name}`} referrerPolicy="no-referrer" className="h-4 w-4 mr-2 inline" />
<Link
className="block truncate hover:underline dark:text-gray-200"
to={{search: updatedQuery({ filters }), pathname: '/' + this.props.site.domain}}
to={{ search: updatedQuery({ filters }), pathname: '/' + this.props.site.domain }}
title={referrer.name}
>
{referrer.name}
</Link>
{ this.renderExternalLink(referrer.name) }
{this.renderExternalLink(referrer.name)}
</span>
)
}
Expand All @@ -91,13 +91,13 @@ class ReferrerDrilldownModal extends React.Component {
return (
<tr className="text-sm dark:text-gray-200" key={referrer.name}>
<td className="p-2">
{ this.renderReferrerName(referrer) }
{this.renderReferrerName(referrer)}
</td>
{this.showConversionRate() && <td className="p-2 w-32 font-medium" align="right">{numberFormatter(referrer.total_visitors)}</td> }
{this.showConversionRate() && <td className="p-2 w-32 font-medium" align="right">{numberFormatter(referrer.total_visitors)}</td>}
<td className="p-2 w-32 font-medium" align="right">{numberFormatter(referrer.visitors)}</td>
{this.showExtra() && <td className="p-2 w-32 font-medium" align="right">{this.formatBounceRate(referrer)}</td> }
{this.showExtra() && <td className="p-2 w-32 font-medium" align="right">{this.formatDuration(referrer)}</td> }
{this.showConversionRate() && <td className="p-2 w-32 font-medium" align="right">{referrer.conversion_rate}%</td> }
{this.showExtra() && <td className="p-2 w-32 font-medium" align="right">{this.formatBounceRate(referrer)}</td>}
{this.showExtra() && <td className="p-2 w-32 font-medium" align="right">{this.formatDuration(referrer)}</td>}
{this.showConversionRate() && <td className="p-2 w-32 font-medium" align="right">{referrer.conversion_rate}%</td>}
</tr>
)
}
Expand Down Expand Up @@ -126,7 +126,7 @@ class ReferrerDrilldownModal extends React.Component {
</tr>
</thead>
<tbody>
{ this.state.referrers.map(this.renderReferrer.bind(this)) }
{this.state.referrers.map(this.renderReferrer.bind(this))}
</tbody>
</table>
</main>
Expand All @@ -137,8 +137,8 @@ class ReferrerDrilldownModal extends React.Component {

render() {
return (
<Modal site={this.props.site}>
{ this.renderBody() }
<Modal>
{this.renderBody()}
</Modal>
)
}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/dashboard/stats/modals/sources.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class SourcesModal extends React.Component {

render() {
return (
<Modal site={this.props.site}>
<Modal>
<h1 className="text-xl font-bold dark:text-gray-100">{this.title()}</h1>

<div className="my-4 border-b border-gray-300 dark:border-gray-500"></div>
Expand Down
2 changes: 1 addition & 1 deletion assets/js/dashboard/stats/modals/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class ModalTable extends React.Component {

render() {
return (
<Modal site={this.props.site} show={!this.state.loading}>
<Modal show={!this.state.loading}>
{this.renderBody()}
</Modal>
)
Expand Down

0 comments on commit 2a97dc5

Please sign in to comment.