import React from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { get as getStorage } from '../util/storage'; import { isTouchDevice } from '../util/helpers'; import * as uiActions from '../services/ui/actions'; import { indexToArray } from '../util/arrays'; import localForage from 'localforage'; class DebugInfo extends React.Component { constructor(props) { super(props); this.state = { localForageLength: 0 } } componentDidMount() { localForage.length().then((localForageLength) => this.setState({ localForageLength })) } localStorageSize() { let data = ''; for (const key in window.localStorage) { if (window.localStorage.hasOwnProperty(key)) { data += window.localStorage[key]; } } let used = 0; const total = 5000; if (data !== '') { used = ((data.length * 16) / (8 * 1024)).toFixed(2); } return { used, percent: (used / total * 100).toFixed(2), }; } renderLoadQueue = () => { const { ui: { load_queue } } = this.props; if (!load_queue) return