import React from 'react'; import { Link } from 'react-router-dom' import * as api from '../api' import * as url from '../util/url' import { appliedFilters } from '../query'; import { Tooltip } from '../util/tooltip'; import { SecondsSinceLastLoad } from '../util/seconds-since-last-load'; export default class CurrentVisitors extends React.Component { constructor(props) { super(props) this.state = {currentVisitors: null} this.updateCount = this.updateCount.bind(this) } componentDidMount() { this.updateCount() document.addEventListener('tick', this.updateCount) } componentWillUnmount() { document.removeEventListener('tick', this.updateCount) } updateCount() { return api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/current-visitors`) .then((res) => this.setState({currentVisitors: res})) } tooltipInfo() { return (
Last updated
Click to view realtime dashboard