add: achievement toggle

Closes #16
This commit is contained in:
Mar0xy 2023-09-29 00:57:38 +02:00
parent 0c7011bd02
commit fc00f08d5b
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
9 changed files with 45 additions and 1 deletions

View file

@ -12,6 +12,7 @@ import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
import { ui } from '@/config.js';
import { unisonReload } from '@/scripts/unison-reload.js';
import { instance } from './instance.js';
export const navbarItemDef = reactive({
notifications: {
@ -104,7 +105,7 @@ export const navbarItemDef = reactive({
achievements: {
title: i18n.ts.achievements,
icon: 'ti ti-medal',
show: computed(() => $i != null),
show: computed(() => $i != null && instance.enableAchievements),
to: '/my/achievements',
},
ui: {

View file

@ -16,6 +16,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkSwitch>
</div>
<div class="_panel" style="padding: 16px;">
<MkSwitch v-model="enableAchievements">
<template #label>Enable Achievements</template>
<template #caption>Turning this off will disable the achievement system</template>
</MkSwitch>
</div>
<div class="_panel" style="padding: 16px;">
<MkSwitch v-model="enableIdenticonGeneration">
<template #label>{{ i18n.ts.enableIdenticonGeneration }}</template>
@ -53,6 +60,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkSwitch from '@/components/MkSwitch.vue';
let enableServerMachineStats: boolean = $ref(false);
let enableAchievements: boolean = $ref(false);
let enableIdenticonGeneration: boolean = $ref(false);
let enableChartsForRemoteUser: boolean = $ref(false);
let enableChartsForFederatedInstances: boolean = $ref(false);
@ -60,6 +68,7 @@ let enableChartsForFederatedInstances: boolean = $ref(false);
async function init() {
const meta = await os.api('admin/meta');
enableServerMachineStats = meta.enableServerMachineStats;
enableAchievements = meta.enableAchievements;
enableIdenticonGeneration = meta.enableIdenticonGeneration;
enableChartsForRemoteUser = meta.enableChartsForRemoteUser;
enableChartsForFederatedInstances = meta.enableChartsForFederatedInstances;
@ -68,6 +77,7 @@ async function init() {
function save() {
os.apiWithDialog('admin/update-meta', {
enableServerMachineStats,
enableAchievements,
enableIdenticonGeneration,
enableChartsForRemoteUser,
enableChartsForFederatedInstances,