mirror of
https://github.com/mue/mue.git
synced 2026-07-24 01:07:23 +02:00
refactor: clean translation system and more widget stuff
This commit is contained in:
@@ -25,8 +25,6 @@ const achievementLanguage = {
|
||||
tr_TR: translations.tr_TR,
|
||||
};
|
||||
|
||||
console.log(achievementLanguage.en_GB);
|
||||
|
||||
export default class Stats extends PureComponent {
|
||||
constructor() {
|
||||
super();
|
||||
@@ -94,22 +92,20 @@ export default class Stats extends PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
|
||||
if (localStorage.getItem('stats') === 'false') {
|
||||
return (
|
||||
<>
|
||||
<span className="mainTitle">
|
||||
{getMessage('modals.main.settings.sections.stats.title')}
|
||||
{variables.getMessage('modals.main.settings.sections.stats.title')}
|
||||
</span>
|
||||
<SettingsItem
|
||||
title={getMessage('modals.main.settings.reminder.title')}
|
||||
subtitle={getMessage('modals.main.settings.sections.stats.warning')}
|
||||
title={variables.getMessage('modals.main.settings.reminder.title')}
|
||||
subtitle={variables.getMessage('modals.main.settings.sections.stats.warning')}
|
||||
final={true}
|
||||
>
|
||||
<Switch
|
||||
name="stats"
|
||||
text={getMessage('modals.main.settings.sections.stats.usage')}
|
||||
text={variables.getMessage('modals.main.settings.sections.stats.usage')}
|
||||
category="stats"
|
||||
/>
|
||||
</SettingsItem>
|
||||
@@ -131,25 +127,27 @@ export default class Stats extends PureComponent {
|
||||
|
||||
return (
|
||||
<>
|
||||
<span className="mainTitle">{getMessage('modals.main.settings.sections.stats.title')}</span>
|
||||
<span className="mainTitle">
|
||||
{variables.getMessage('modals.main.settings.sections.stats.title')}
|
||||
</span>
|
||||
<SettingsItem
|
||||
title={getMessage('modals.main.settings.reminder.title')}
|
||||
subtitle={getMessage('modals.main.settings.sections.stats.warning')}
|
||||
title={variables.getMessage('modals.main.settings.reminder.title')}
|
||||
subtitle={variables.getMessage('modals.main.settings.sections.stats.warning')}
|
||||
>
|
||||
<Switch
|
||||
name="stats"
|
||||
text={getMessage('modals.main.settings.sections.stats.usage')}
|
||||
text={variables.getMessage('modals.main.settings.sections.stats.usage')}
|
||||
category="stats"
|
||||
/>
|
||||
</SettingsItem>
|
||||
<div className="statsGrid">
|
||||
<div className="statSection leftPanel">
|
||||
<span className="title">
|
||||
{getMessage('modals.main.settings.sections.stats.achievements')}
|
||||
{variables.getMessage('modals.main.settings.sections.stats.achievements')}
|
||||
</span>
|
||||
<br />
|
||||
<span className="subtitle">
|
||||
{variables.language.getMessage(
|
||||
{variables.getMessage(
|
||||
variables.languagecode,
|
||||
'modals.main.settings.sections.stats.unlocked',
|
||||
{
|
||||
@@ -168,41 +166,53 @@ export default class Stats extends PureComponent {
|
||||
<div className="statSection rightPanel">
|
||||
<MdShowChart />
|
||||
<span className="subtitle">
|
||||
{getMessage('modals.main.settings.sections.stats.sections.tabs_opened')}{' '}
|
||||
{variables.getMessage('modals.main.settings.sections.stats.sections.tabs_opened')}{' '}
|
||||
</span>
|
||||
<span>{this.state.stats['tabs-opened'] || 0}</span>
|
||||
<span className="subtitle">
|
||||
{getMessage('modals.main.settings.sections.stats.sections.backgrounds_favourited')}{' '}
|
||||
{variables.getMessage(
|
||||
'modals.main.settings.sections.stats.sections.backgrounds_favourited',
|
||||
)}{' '}
|
||||
</span>
|
||||
<span>
|
||||
{this.state.stats.feature ? this.state.stats.feature['background-favourite'] || 0 : 0}
|
||||
</span>
|
||||
<span className="subtitle">
|
||||
{getMessage('modals.main.settings.sections.stats.sections.backgrounds_downloaded')}{' '}
|
||||
{variables.getMessage(
|
||||
'modals.main.settings.sections.stats.sections.backgrounds_downloaded',
|
||||
)}{' '}
|
||||
</span>
|
||||
<span>
|
||||
{this.state.stats.feature ? this.state.stats.feature['background-download'] || 0 : 0}
|
||||
</span>
|
||||
<span className="subtitle">
|
||||
{getMessage('modals.main.settings.sections.stats.sections.quotes_favourited')}{' '}
|
||||
{variables.getMessage(
|
||||
'modals.main.settings.sections.stats.sections.quotes_favourited',
|
||||
)}{' '}
|
||||
</span>
|
||||
<span>
|
||||
{this.state.stats.feature ? this.state.stats.feature['quoted-favourite'] || 0 : 0}
|
||||
</span>
|
||||
<span className="subtitle">
|
||||
{getMessage('modals.main.settings.sections.stats.sections.quicklinks_added')}{' '}
|
||||
{variables.getMessage(
|
||||
'modals.main.settings.sections.stats.sections.quicklinks_added',
|
||||
)}{' '}
|
||||
</span>
|
||||
<span>
|
||||
{this.state.stats.feature ? this.state.stats.feature['quicklink-add'] || 0 : 0}
|
||||
</span>
|
||||
<span className="subtitle">
|
||||
{getMessage('modals.main.settings.sections.stats.sections.settings_changed')}{' '}
|
||||
{variables.getMessage(
|
||||
'modals.main.settings.sections.stats.sections.settings_changed',
|
||||
)}{' '}
|
||||
</span>
|
||||
<span>
|
||||
{this.state.stats.setting ? Object.keys(this.state.stats.setting).length : 0}
|
||||
</span>
|
||||
<span className="subtitle">
|
||||
{getMessage('modals.main.settings.sections.stats.sections.addons_installed')}{' '}
|
||||
{variables.getMessage(
|
||||
'modals.main.settings.sections.stats.sections.addons_installed',
|
||||
)}{' '}
|
||||
</span>
|
||||
<span>
|
||||
{this.state.stats.marketplace ? this.state.stats.marketplace['install'] : 0}
|
||||
|
||||
Reference in New Issue
Block a user