activate live statistics via settings
All checks were successful
deploy / build-and-deploy (push) Successful in 16s
All checks were successful
deploy / build-and-deploy (push) Successful in 16s
This commit is contained in:
@@ -71,6 +71,17 @@
|
||||
onChange: dynamicSettings.signupSetDisabledSubtext
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Live-Statistiken',
|
||||
entries: [
|
||||
{
|
||||
name: 'Aktiviert',
|
||||
type: 'checkbox',
|
||||
value: dynamicSettings.liveStatisticsEnabled(),
|
||||
onChange: dynamicSettings.liveStatisticsSetEnabled
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ export class DynamicSettings {
|
||||
|
||||
/* signup enabled */
|
||||
signupEnabled = () => this.get(SettingKey.SignupEnabled, false);
|
||||
signupSetEnabled = (active: boolean) => this.set(SettingKey.SignupEnabled, active);
|
||||
signupSetEnabled = (enabled: boolean) => this.set(SettingKey.SignupEnabled, enabled);
|
||||
|
||||
/* signup info text */
|
||||
signupInfoText = () => this.get(SettingKey.SignupInfoMessage, '');
|
||||
@@ -45,4 +45,8 @@ export class DynamicSettings {
|
||||
/* signup disabled subtext */
|
||||
signupDisabledSubtext = () => this.get(SettingKey.SignupDisabledSubMessage, '');
|
||||
signupSetDisabledSubtext = (text: string) => this.set(SettingKey.SignupDisabledSubMessage, text);
|
||||
|
||||
/* live statistics enabled */
|
||||
liveStatisticsEnabled = () => this.get(SettingKey.LiveStatisticsEnabled, false);
|
||||
liveStatisticsSetEnabled = (enabled: boolean) => this.set(SettingKey.LiveStatisticsEnabled, enabled);
|
||||
}
|
||||
|
||||
@@ -4,12 +4,13 @@ import Countdown from '@app/website/index/Countdown.svelte';
|
||||
import LiveStats from '@app/website/index/LiveStats.svelte';
|
||||
import Craftattack from '@assets/img/craftattack.webp';
|
||||
import Background from '@assets/img/background.webp';
|
||||
import { START_DATE, STATISTICS_ENDPOINT } from 'astro:env/server';
|
||||
import { START_DATE } from 'astro:env/server';
|
||||
import { getSetting, SettingKey } from '@util/settings';
|
||||
import { db } from '@db/database.ts';
|
||||
|
||||
const signupEnabled = await getSetting(db, SettingKey.SignupEnabled, false);
|
||||
const signupInfoMessage = await getSetting(db, SettingKey.SignupInfoMessage);
|
||||
const statisticsEnabled = await getSetting(db, SettingKey.LiveStatisticsEnabled, false);
|
||||
|
||||
const information = [
|
||||
{
|
||||
@@ -98,7 +99,7 @@ const information = [
|
||||
|
||||
<div class="flex flex-col justify-center items-center py-20 bg-base-100">
|
||||
{
|
||||
STATISTICS_ENDPOINT && (
|
||||
statisticsEnabled && (
|
||||
<>
|
||||
<LiveStats />
|
||||
<div class="divider divider-horizontal mx-auto my-6 h-18" />
|
||||
|
||||
@@ -41,7 +41,8 @@ export enum SettingKey {
|
||||
SignupEnabled = 'signup.enabled',
|
||||
SignupInfoMessage = 'signup.infoMessage',
|
||||
SignupDisabledMessage = 'signup.disabledMessage',
|
||||
SignupDisabledSubMessage = 'signup.disabledSubMessage'
|
||||
SignupDisabledSubMessage = 'signup.disabledSubMessage',
|
||||
LiveStatisticsEnabled = 'liveStatistics.enabled'
|
||||
}
|
||||
|
||||
export type SettingKeyValueType<K extends SettingKey> = {
|
||||
@@ -49,4 +50,5 @@ export type SettingKeyValueType<K extends SettingKey> = {
|
||||
[SettingKey.SignupInfoMessage]: string;
|
||||
[SettingKey.SignupDisabledMessage]: string;
|
||||
[SettingKey.SignupDisabledSubMessage]: string;
|
||||
[SettingKey.LiveStatisticsEnabled]: boolean;
|
||||
}[K];
|
||||
|
||||
Reference in New Issue
Block a user