feat: rewrite stats backend

This commit is contained in:
David Ralph
2024-09-03 14:06:13 +01:00
parent 742b762ae2
commit ed6f660099
22 changed files with 48 additions and 54 deletions

View File

@@ -18,7 +18,7 @@ const Tabs = (props) => {
const onClick = (tab, name) => {
if (name !== currentName) {
variables.stats.postEvent('tab', `Opened ${name}`);
variables.stats.postEvent('tab', ${name}, 'opened');
}
setCurrentTab(tab);
setCurrentName(name);

View File

@@ -6,7 +6,7 @@ import { Tooltip, Button } from 'components/Elements';
function ResetModal({ modalClose }) {
const reset = () => {
variables.stats.postEvent('setting', 'Reset');
variables.stats.postEvent('setting', 'reset');
setDefaultSettings('reset');
window.location.reload();
};

View File

@@ -21,7 +21,7 @@ const Checkbox = (props) => {
props.onChange(value);
}
variables.stats.postEvent('setting', `${props.name} ${value ? 'enabled' : 'disabled'}`);
variables.stats.postEvent('setting', props.name, value ? 'enabled' : 'disabled');
if (props.element) {
if (!document.querySelector(props.element)) {

View File

@@ -29,7 +29,11 @@ function Radio(props) {
props.onChange(value);
}
variables.stats.postEvent('setting', `${props.name} from ${value} to ${value}`);
if (props.name !== 'language') {
variables.stats.postEvent('setting', props.name, `${value}-${value}`);
} else {
variables.stats.postEvent('language', props.name, `${value}-${value}`);
}
if (props.element) {
if (!document.querySelector(props.element)) {

View File

@@ -22,7 +22,7 @@ function Header(props) {
variables.stats.postEvent(
'setting',
`${props.name} ${setting === true ? 'enabled' : 'disabled'}`,
props.setting, setting === true ? 'enabled' : 'disabled',
);
EventBus.emit('toggle', props.setting);

View File

@@ -31,7 +31,7 @@ const Controls = (props) => {
variables.stats.postEvent(
'setting',
`${props.name} ${setting === true ? 'enabled' : 'disabled'}`,
props.name, setting === true ? 'enabled' : 'disabled',
);
EventBus.emit('toggle', props.setting);