feat: locally store stats so users can see them (no ui yet)

This commit is contained in:
David Ralph
2021-06-30 11:27:54 +01:00
parent 1d44b2792e
commit 2dcaa5270d
28 changed files with 78 additions and 45 deletions

View File

@@ -21,7 +21,7 @@ export default class Checkbox extends React.PureComponent {
checked: (this.state.checked === true) ? false : true
});
window.analytics.postEvent('setting', `${this.props.name} ${(this.state.checked === true) ? 'enabled' : 'disabled'}`);
window.stats.postEvent('setting', `${this.props.name} ${(this.state.checked === true) ? 'enabled' : 'disabled'}`);
if (this.props.element) {
if (!document.querySelector(this.props.element)) {

View File

@@ -22,7 +22,7 @@ export default class Dropdown extends React.PureComponent {
return;
}
window.analytics.postEvent('setting', `${this.props.name} from ${this.state.value} to ${value}`);
window.stats.postEvent('setting', `${this.props.name} from ${this.state.value} to ${value}`);
this.setState({
value: value,

View File

@@ -29,7 +29,7 @@ export default class Radio extends React.PureComponent {
value: value
});
window.analytics.postEvent('setting', `${this.props.name} from ${this.state.value} to ${value}`);
window.stats.postEvent('setting', `${this.props.name} from ${this.state.value} to ${value}`);
if (this.props.element) {
if (!document.querySelector(this.props.element)) {

View File

@@ -4,7 +4,7 @@ export default function ResetModal(props) {
const language = window.language.modals.main.settings.sections.advanced.reset_modal;
const reset = () => {
window.analytics.postEvent('setting', 'Reset');
window.stats.postEvent('setting', 'Reset');
SettingsFunctions.setDefaultSettings('reset');
window.location.reload();
}

View File

@@ -21,7 +21,7 @@ export default class Switch extends React.PureComponent {
checked: (this.state.checked === true) ? false : true
});
window.analytics.postEvent('setting', `${this.props.name} ${(this.state.checked === true) ? 'enabled' : 'disabled'}`);
window.stats.postEvent('setting', `${this.props.name} ${(this.state.checked === true) ? 'enabled' : 'disabled'}`);
if (this.props.element) {
if (!document.querySelector(this.props.element)) {

View File

@@ -28,7 +28,7 @@ export default class AdvancedSettings extends React.PureComponent {
});
toast(window.language.toasts.imported);
window.analytics.postEvent('tab', 'Settings imported');
window.stats.postEvent('tab', 'Settings imported');
}
render() {

View File

@@ -10,6 +10,9 @@ export default function ExperimentalSettings() {
<h2>{experimental.title}</h2>
<p>{experimental.warning}</p>
<Checkbox name='animations' text={window.language.modals.main.settings.sections.appearance.animations} element='.other'/>
<h3>Usage Stats</h3>
<p>Allows you to see stats such as how many tabs you have opened, quotes favourited etc. It also sends this data anonymously to our<a className='modalLink' href='https://github.com/mue/umami'>umami</a> instance.</p>
<Checkbox name='stats' text='Enable Usage Stats' element='.other'/>
<h3>{experimental.developer}</h3>
<Checkbox name='debug' text='Debug hotkey (Ctrl + #)' element='.other'/>
<Slider title='Debug timeout' name='debugtimeout' min='0' max='5000' default='0' step='100' display=' miliseconds' element='.other' />

View File

@@ -83,7 +83,7 @@ export default class OrderSettings extends React.PureComponent {
componentDidUpdate() {
localStorage.setItem('order', JSON.stringify(this.state.items));
window.analytics.postEvent('setting', 'Widget order');
window.stats.postEvent('setting', 'Widget order');
EventBus.dispatch('refresh', 'widgets');
}

View File

@@ -104,7 +104,7 @@ export default class ColourSettings extends React.PureComponent {
return newState;
});
window.analytics.postEvent('setting', 'Changed backgroundtype from colour to gradient');
window.stats.postEvent('setting', 'Changed backgroundtype from colour to gradient');
}
currentGradientSettings = () => {