[deploy] Emit frontend bundle as ESM for browser
All checks were successful
Deploy Discord Bot / deploy (push) Successful in 38s
All checks were successful
Deploy Discord Bot / deploy (push) Successful in 38s
This commit is contained in:
@@ -1,16 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.initModulesSection = initModulesSection;
|
||||
const api_js_1 = require("../../services/api.js");
|
||||
const toast_js_1 = require("../../ui/toast.js");
|
||||
const switch_js_1 = require("../../ui/switch.js");
|
||||
const welcome_js_1 = require("./welcome.js");
|
||||
const logging_js_1 = require("./logging.js");
|
||||
const reactionRoles_js_1 = require("./reactionRoles.js");
|
||||
const dynamicVoice_js_1 = require("./dynamicVoice.js");
|
||||
const statuspage_js_1 = require("./statuspage.js");
|
||||
const serverstats_js_1 = require("./serverstats.js");
|
||||
async function initModulesSection(guildId) {
|
||||
import { api } from '../../services/api.js';
|
||||
import { showToast } from '../../ui/toast.js';
|
||||
import { setSwitch, getSwitch } from '../../ui/switch.js';
|
||||
import { renderWelcomeModule } from './welcome.js';
|
||||
import { renderLoggingModule } from './logging.js';
|
||||
import { renderReactionRolesModule } from './reactionRoles.js';
|
||||
import { renderDynamicVoiceModule } from './dynamicVoice.js';
|
||||
import { renderStatuspageModule } from './statuspage.js';
|
||||
import { renderServerStatsModule } from './serverstats.js';
|
||||
export async function initModulesSection(guildId) {
|
||||
const section = document.getElementById('section-modules');
|
||||
if (!section)
|
||||
return;
|
||||
@@ -30,12 +27,12 @@ async function initModulesSection(guildId) {
|
||||
`;
|
||||
await Promise.all([
|
||||
renderModuleToggles(guildId),
|
||||
(0, welcome_js_1.renderWelcomeModule)(guildId),
|
||||
(0, logging_js_1.renderLoggingModule)(guildId),
|
||||
(0, reactionRoles_js_1.renderReactionRolesModule)(guildId),
|
||||
(0, dynamicVoice_js_1.renderDynamicVoiceModule)(guildId),
|
||||
(0, statuspage_js_1.renderStatuspageModule)(guildId),
|
||||
(0, serverstats_js_1.renderServerStatsModule)(guildId)
|
||||
renderWelcomeModule(guildId),
|
||||
renderLoggingModule(guildId),
|
||||
renderReactionRolesModule(guildId),
|
||||
renderDynamicVoiceModule(guildId),
|
||||
renderStatuspageModule(guildId),
|
||||
renderServerStatsModule(guildId)
|
||||
]);
|
||||
}
|
||||
async function renderModuleToggles(guildId) {
|
||||
@@ -44,7 +41,7 @@ async function renderModuleToggles(guildId) {
|
||||
return;
|
||||
container.innerHTML = '<p class="muted">Lade Module...</p>';
|
||||
try {
|
||||
const data = await api_js_1.api.modules(guildId);
|
||||
const data = await api.modules(guildId);
|
||||
const modules = data?.modules || data || {};
|
||||
container.innerHTML = '';
|
||||
const entries = [
|
||||
@@ -72,7 +69,7 @@ async function renderModuleToggles(guildId) {
|
||||
`;
|
||||
const toggle = row.querySelector('.switch');
|
||||
toggle.addEventListener('click', async () => {
|
||||
(0, switch_js_1.setSwitch)(toggle, !(0, switch_js_1.getSwitch)(toggle));
|
||||
setSwitch(toggle, !getSwitch(toggle));
|
||||
await saveModules(guildId);
|
||||
});
|
||||
container.appendChild(row);
|
||||
@@ -81,7 +78,7 @@ async function renderModuleToggles(guildId) {
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
container.innerHTML = '<div class="empty-state">Module konnten nicht geladen werden.</div>';
|
||||
(0, toast_js_1.showToast)('Fehler beim Laden der Module', true);
|
||||
showToast('Fehler beim Laden der Module', true);
|
||||
}
|
||||
}
|
||||
async function saveModules(guildId) {
|
||||
@@ -94,11 +91,11 @@ async function saveModules(guildId) {
|
||||
payload[key] = t.classList.contains('on');
|
||||
});
|
||||
try {
|
||||
await api_js_1.api.saveSettings(payload);
|
||||
(0, toast_js_1.showToast)('Module gespeichert');
|
||||
await api.saveSettings(payload);
|
||||
showToast('Module gespeichert');
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
(0, toast_js_1.showToast)('Module speichern fehlgeschlagen', true);
|
||||
showToast('Module speichern fehlgeschlagen', true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user