diff --git a/assets/js/dashboard/stats/graph/visitor-graph.js b/assets/js/dashboard/stats/graph/visitor-graph.js index 211219b91..5c66be9a6 100644 --- a/assets/js/dashboard/stats/graph/visitor-graph.js +++ b/assets/js/dashboard/stats/graph/visitor-graph.js @@ -1,5 +1,4 @@ import React from 'react'; -import { Link } from 'react-router-dom' import * as api from '../../api' import * as storage from '../../util/storage' import LazyLoader from '../../components/lazy-loader' @@ -7,10 +6,10 @@ import { LoadingState } from './graph-util' import TopStats from './top-stats'; import { IntervalPicker, getCurrentInterval } from './interval-picker' import StatsExport from './stats-export' +import WithImportedSwitch from './with-imported-switch'; import SamplingNotice from './sampling-notice'; import FadeIn from '../../fade-in'; import * as url from '../../util/url' -import { parseNaiveDate, isBefore } from '../../util/date' import { isComparisonEnabled } from '../../comparison-input' import LineGraphWithRouter from './line-graph' @@ -118,42 +117,6 @@ export default class VisitorGraph extends React.Component { storage.setItem(`topStatsHeight__${this.props.site.domain}`, document.getElementById('top-stats-container').clientHeight) } - importedNotice() { - const { topStatData } = this.state - - if (!topStatData?.imported_source) return - - const isBeforeNativeStats = (date) => { - if (!date) return false - - const nativeStatsBegin = parseNaiveDate(this.props.site.nativeStatsBegin) - const parsedDate = parseNaiveDate(date) - - return isBefore(parsedDate, nativeStatsBegin, "day") - } - - const isQueryingImportedPeriod = isBeforeNativeStats(topStatData.from) - const isComparingImportedPeriod = isBeforeNativeStats(topStatData.comparing_from) - - if (isQueryingImportedPeriod || isComparingImportedPeriod) { - const source = topStatData.imported_source - const withImported = topStatData.with_imported; - const strike = withImported ? "" : " line-through" - const target = url.setQuery('with_imported', !withImported) - const tip = withImported ? "" : "do not "; - - return ( - -