[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,3 +1 @@
|
|||||||
"use strict";
|
import './core/app.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
require("./core/app.js");
|
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.initAdminSection = initAdminSection;
|
export async function initAdminSection(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function initAdminSection(guildId) {
|
|
||||||
const section = document.getElementById('section-admin');
|
const section = document.getElementById('section-admin');
|
||||||
if (!section)
|
if (!section)
|
||||||
return;
|
return;
|
||||||
section.innerHTML = '<p class="muted">Lade Admin-Daten...</p>';
|
section.innerHTML = '<p class="muted">Lade Admin-Daten...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.settings(guildId);
|
const data = await api.settings(guildId);
|
||||||
section.innerHTML = `
|
section.innerHTML = `
|
||||||
<h2 class="section-title">Admin</h2>
|
<h2 class="section-title">Admin</h2>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@@ -21,6 +18,6 @@ async function initAdminSection(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
section.innerHTML = '<div class="empty-state">Admin-Daten konnten nicht geladen werden.</div>';
|
section.innerHTML = '<div class="empty-state">Admin-Daten konnten nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der Admin-Daten', true);
|
showToast('Fehler beim Laden der Admin-Daten', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,22 @@
|
|||||||
"use strict";
|
import { api } from '../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { getConfig, getState, setState } from '../state/store.js';
|
||||||
exports.initDashboardView = initDashboardView;
|
import { showToast } from '../ui/toast.js';
|
||||||
const api_js_1 = require("../services/api.js");
|
import { renderOverview } from './overview.js';
|
||||||
const store_js_1 = require("../state/store.js");
|
import { initTicketsSection } from './tickets/index.js';
|
||||||
const toast_js_1 = require("../ui/toast.js");
|
import { initModulesSection } from './modules/index.js';
|
||||||
const overview_js_1 = require("./overview.js");
|
import { initEventsSection } from './events/index.js';
|
||||||
const index_js_1 = require("./tickets/index.js");
|
import { initAdminSection } from './admin/index.js';
|
||||||
const index_js_2 = require("./modules/index.js");
|
import { renderSettingsSection } from './settings.js';
|
||||||
const index_js_3 = require("./events/index.js");
|
|
||||||
const index_js_4 = require("./admin/index.js");
|
|
||||||
const settings_js_1 = require("./settings.js");
|
|
||||||
let overviewInterval = null;
|
let overviewInterval = null;
|
||||||
let ticketsInterval = null;
|
let ticketsInterval = null;
|
||||||
async function populateGuildSelect() {
|
async function populateGuildSelect() {
|
||||||
const select = document.getElementById('guildSelect');
|
const select = document.getElementById('guildSelect');
|
||||||
const cfg = (0, store_js_1.getConfig)();
|
const cfg = getConfig();
|
||||||
if (!select || !cfg)
|
if (!select || !cfg)
|
||||||
return;
|
return;
|
||||||
select.innerHTML = `<option>Loading...</option>`;
|
select.innerHTML = `<option>Loading...</option>`;
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.guilds();
|
const data = await api.guilds();
|
||||||
select.innerHTML = '';
|
select.innerHTML = '';
|
||||||
data.guilds.forEach((g) => {
|
data.guilds.forEach((g) => {
|
||||||
const opt = document.createElement('option');
|
const opt = document.createElement('option');
|
||||||
@@ -30,12 +27,12 @@ async function populateGuildSelect() {
|
|||||||
select.appendChild(opt);
|
select.appendChild(opt);
|
||||||
});
|
});
|
||||||
const current = select.value || cfg.initialGuildId || data.guilds[0]?.id;
|
const current = select.value || cfg.initialGuildId || data.guilds[0]?.id;
|
||||||
(0, store_js_1.setState)({ guildId: current || undefined });
|
setState({ guildId: current || undefined });
|
||||||
select.value = current || '';
|
select.value = current || '';
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
(0, toast_js_1.showToast)('Guilds konnten nicht geladen werden', true);
|
showToast('Guilds konnten nicht geladen werden', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function registerGuildChange() {
|
function registerGuildChange() {
|
||||||
@@ -44,43 +41,43 @@ function registerGuildChange() {
|
|||||||
return;
|
return;
|
||||||
select.addEventListener('change', () => {
|
select.addEventListener('change', () => {
|
||||||
const guildId = select.value;
|
const guildId = select.value;
|
||||||
(0, store_js_1.setState)({ guildId });
|
setState({ guildId });
|
||||||
refreshSections();
|
refreshSections();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async function refreshSections() {
|
async function refreshSections() {
|
||||||
const { guildId } = (0, store_js_1.getState)();
|
const { guildId } = getState();
|
||||||
if (!guildId)
|
if (!guildId)
|
||||||
return;
|
return;
|
||||||
await (0, overview_js_1.renderOverview)(guildId);
|
await renderOverview(guildId);
|
||||||
await (0, index_js_1.initTicketsSection)(guildId);
|
await initTicketsSection(guildId);
|
||||||
await (0, index_js_2.initModulesSection)(guildId);
|
await initModulesSection(guildId);
|
||||||
await (0, settings_js_1.renderSettingsSection)(guildId);
|
await renderSettingsSection(guildId);
|
||||||
await (0, index_js_3.initEventsSection)(guildId);
|
await initEventsSection(guildId);
|
||||||
const cfg = (0, store_js_1.getConfig)();
|
const cfg = getConfig();
|
||||||
if (cfg?.isAdmin) {
|
if (cfg?.isAdmin) {
|
||||||
await (0, index_js_4.initAdminSection)(guildId);
|
await initAdminSection(guildId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function setupPolling() {
|
function setupPolling() {
|
||||||
const { guildId } = (0, store_js_1.getState)();
|
const { guildId } = getState();
|
||||||
if (overviewInterval)
|
if (overviewInterval)
|
||||||
window.clearInterval(overviewInterval);
|
window.clearInterval(overviewInterval);
|
||||||
if (ticketsInterval)
|
if (ticketsInterval)
|
||||||
window.clearInterval(ticketsInterval);
|
window.clearInterval(ticketsInterval);
|
||||||
overviewInterval = window.setInterval(() => {
|
overviewInterval = window.setInterval(() => {
|
||||||
const current = (0, store_js_1.getState)().guildId;
|
const current = getState().guildId;
|
||||||
if (current)
|
if (current)
|
||||||
(0, overview_js_1.renderOverview)(current);
|
renderOverview(current);
|
||||||
}, 10000);
|
}, 10000);
|
||||||
ticketsInterval = window.setInterval(() => {
|
ticketsInterval = window.setInterval(() => {
|
||||||
const current = (0, store_js_1.getState)().guildId;
|
const current = getState().guildId;
|
||||||
if (current)
|
if (current)
|
||||||
(0, index_js_1.initTicketsSection)(current);
|
initTicketsSection(current);
|
||||||
}, 12000);
|
}, 12000);
|
||||||
}
|
}
|
||||||
function initDashboardView() {
|
export function initDashboardView() {
|
||||||
const cfg = (0, store_js_1.getConfig)();
|
const cfg = getConfig();
|
||||||
const logoutBtn = document.getElementById('logoutBtn');
|
const logoutBtn = document.getElementById('logoutBtn');
|
||||||
if (logoutBtn && cfg) {
|
if (logoutBtn && cfg) {
|
||||||
logoutBtn.addEventListener('click', () => (window.location.href = `${cfg.baseAuth}/logout`));
|
logoutBtn.addEventListener('click', () => (window.location.href = `${cfg.baseAuth}/logout`));
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.initEventsSection = initEventsSection;
|
export async function initEventsSection(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function initEventsSection(guildId) {
|
|
||||||
const section = document.getElementById('section-events');
|
const section = document.getElementById('section-events');
|
||||||
if (!section)
|
if (!section)
|
||||||
return;
|
return;
|
||||||
section.innerHTML = '<p class="muted">Lade Events...</p>';
|
section.innerHTML = '<p class="muted">Lade Events...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.events(guildId);
|
const data = await api.events(guildId);
|
||||||
const events = data?.events || data || [];
|
const events = data?.events || data || [];
|
||||||
section.innerHTML = '<h2 class="section-title">Events</h2>';
|
section.innerHTML = '<h2 class="section-title">Events</h2>';
|
||||||
if (!events.length) {
|
if (!events.length) {
|
||||||
@@ -38,6 +35,6 @@ async function initEventsSection(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
section.innerHTML = '<div class="empty-state">Events konnten nicht geladen werden.</div>';
|
section.innerHTML = '<div class="empty-state">Events konnten nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der Events', true);
|
showToast('Fehler beim Laden der Events', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
"use strict";
|
import { api } from '../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { getConfig } from '../state/store.js';
|
||||||
exports.initSelectionView = initSelectionView;
|
import { showToast } from '../ui/toast.js';
|
||||||
const api_js_1 = require("../services/api.js");
|
export async function initSelectionView() {
|
||||||
const store_js_1 = require("../state/store.js");
|
const cfg = getConfig();
|
||||||
const toast_js_1 = require("../ui/toast.js");
|
|
||||||
async function initSelectionView() {
|
|
||||||
const cfg = (0, store_js_1.getConfig)();
|
|
||||||
const grid = document.getElementById('guildGrid');
|
const grid = document.getElementById('guildGrid');
|
||||||
const logoutBtn = document.getElementById('logoutBtn');
|
const logoutBtn = document.getElementById('logoutBtn');
|
||||||
const userInfo = document.getElementById('userInfo');
|
const userInfo = document.getElementById('userInfo');
|
||||||
@@ -15,7 +12,7 @@ async function initSelectionView() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const me = await api_js_1.api.me();
|
const me = await api.me();
|
||||||
if (userInfo && me?.user)
|
if (userInfo && me?.user)
|
||||||
userInfo.textContent = `${me.user.username}#${me.user.discriminator}`;
|
userInfo.textContent = `${me.user.username}#${me.user.discriminator}`;
|
||||||
}
|
}
|
||||||
@@ -26,7 +23,7 @@ async function initSelectionView() {
|
|||||||
return;
|
return;
|
||||||
grid.innerHTML = '<div class="muted">Lade Guilds...</div>';
|
grid.innerHTML = '<div class="muted">Lade Guilds...</div>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.guilds();
|
const data = await api.guilds();
|
||||||
grid.innerHTML = '';
|
grid.innerHTML = '';
|
||||||
(data.guilds || []).forEach((g) => {
|
(data.guilds || []).forEach((g) => {
|
||||||
const card = document.createElement('div');
|
const card = document.createElement('div');
|
||||||
@@ -54,6 +51,6 @@ async function initSelectionView() {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
grid.innerHTML = '<div class="empty-state">Fehler beim Laden der Guilds</div>';
|
grid.innerHTML = '<div class="empty-state">Fehler beim Laden der Guilds</div>';
|
||||||
(0, toast_js_1.showToast)('Guilds konnten nicht geladen werden', true);
|
showToast('Guilds konnten nicht geladen werden', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.renderDynamicVoiceModule = renderDynamicVoiceModule;
|
export async function renderDynamicVoiceModule(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function renderDynamicVoiceModule(guildId) {
|
|
||||||
const container = document.getElementById('module-dynamicvoice');
|
const container = document.getElementById('module-dynamicvoice');
|
||||||
if (!container)
|
if (!container)
|
||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade Dynamic Voice...</p>';
|
container.innerHTML = '<p class="muted">Lade Dynamic Voice...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.dynamicVoice(guildId);
|
const data = await api.dynamicVoice(guildId);
|
||||||
const cfg = data?.config || data?.dynamicVoiceConfig || {};
|
const cfg = data?.config || data?.dynamicVoiceConfig || {};
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<h3 class="label">Dynamic Voice</h3>
|
<h3 class="label">Dynamic Voice</h3>
|
||||||
@@ -21,6 +18,6 @@ async function renderDynamicVoiceModule(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">Dynamic Voice konnte nicht geladen werden.</div>';
|
container.innerHTML = '<div class="empty-state">Dynamic Voice konnte nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden von Dynamic Voice', true);
|
showToast('Fehler beim Laden von Dynamic Voice', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.initModulesSection = initModulesSection;
|
import { setSwitch, getSwitch } from '../../ui/switch.js';
|
||||||
const api_js_1 = require("../../services/api.js");
|
import { renderWelcomeModule } from './welcome.js';
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
import { renderLoggingModule } from './logging.js';
|
||||||
const switch_js_1 = require("../../ui/switch.js");
|
import { renderReactionRolesModule } from './reactionRoles.js';
|
||||||
const welcome_js_1 = require("./welcome.js");
|
import { renderDynamicVoiceModule } from './dynamicVoice.js';
|
||||||
const logging_js_1 = require("./logging.js");
|
import { renderStatuspageModule } from './statuspage.js';
|
||||||
const reactionRoles_js_1 = require("./reactionRoles.js");
|
import { renderServerStatsModule } from './serverstats.js';
|
||||||
const dynamicVoice_js_1 = require("./dynamicVoice.js");
|
export async function initModulesSection(guildId) {
|
||||||
const statuspage_js_1 = require("./statuspage.js");
|
|
||||||
const serverstats_js_1 = require("./serverstats.js");
|
|
||||||
async function initModulesSection(guildId) {
|
|
||||||
const section = document.getElementById('section-modules');
|
const section = document.getElementById('section-modules');
|
||||||
if (!section)
|
if (!section)
|
||||||
return;
|
return;
|
||||||
@@ -30,12 +27,12 @@ async function initModulesSection(guildId) {
|
|||||||
`;
|
`;
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
renderModuleToggles(guildId),
|
renderModuleToggles(guildId),
|
||||||
(0, welcome_js_1.renderWelcomeModule)(guildId),
|
renderWelcomeModule(guildId),
|
||||||
(0, logging_js_1.renderLoggingModule)(guildId),
|
renderLoggingModule(guildId),
|
||||||
(0, reactionRoles_js_1.renderReactionRolesModule)(guildId),
|
renderReactionRolesModule(guildId),
|
||||||
(0, dynamicVoice_js_1.renderDynamicVoiceModule)(guildId),
|
renderDynamicVoiceModule(guildId),
|
||||||
(0, statuspage_js_1.renderStatuspageModule)(guildId),
|
renderStatuspageModule(guildId),
|
||||||
(0, serverstats_js_1.renderServerStatsModule)(guildId)
|
renderServerStatsModule(guildId)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
async function renderModuleToggles(guildId) {
|
async function renderModuleToggles(guildId) {
|
||||||
@@ -44,7 +41,7 @@ async function renderModuleToggles(guildId) {
|
|||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade Module...</p>';
|
container.innerHTML = '<p class="muted">Lade Module...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.modules(guildId);
|
const data = await api.modules(guildId);
|
||||||
const modules = data?.modules || data || {};
|
const modules = data?.modules || data || {};
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
const entries = [
|
const entries = [
|
||||||
@@ -72,7 +69,7 @@ async function renderModuleToggles(guildId) {
|
|||||||
`;
|
`;
|
||||||
const toggle = row.querySelector('.switch');
|
const toggle = row.querySelector('.switch');
|
||||||
toggle.addEventListener('click', async () => {
|
toggle.addEventListener('click', async () => {
|
||||||
(0, switch_js_1.setSwitch)(toggle, !(0, switch_js_1.getSwitch)(toggle));
|
setSwitch(toggle, !getSwitch(toggle));
|
||||||
await saveModules(guildId);
|
await saveModules(guildId);
|
||||||
});
|
});
|
||||||
container.appendChild(row);
|
container.appendChild(row);
|
||||||
@@ -81,7 +78,7 @@ async function renderModuleToggles(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">Module konnten nicht geladen werden.</div>';
|
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) {
|
async function saveModules(guildId) {
|
||||||
@@ -94,11 +91,11 @@ async function saveModules(guildId) {
|
|||||||
payload[key] = t.classList.contains('on');
|
payload[key] = t.classList.contains('on');
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await api_js_1.api.saveSettings(payload);
|
await api.saveSettings(payload);
|
||||||
(0, toast_js_1.showToast)('Module gespeichert');
|
showToast('Module gespeichert');
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
(0, toast_js_1.showToast)('Module speichern fehlgeschlagen', true);
|
showToast('Module speichern fehlgeschlagen', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.renderLoggingModule = renderLoggingModule;
|
export async function renderLoggingModule(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function renderLoggingModule(guildId) {
|
|
||||||
const container = document.getElementById('module-logging');
|
const container = document.getElementById('module-logging');
|
||||||
if (!container)
|
if (!container)
|
||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade Logging...</p>';
|
container.innerHTML = '<p class="muted">Lade Logging...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.settings(guildId);
|
const data = await api.settings(guildId);
|
||||||
const cfg = data?.settings?.loggingConfig || data?.loggingConfig || {};
|
const cfg = data?.settings?.loggingConfig || data?.loggingConfig || {};
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<h3 class="label">Logging</h3>
|
<h3 class="label">Logging</h3>
|
||||||
@@ -21,6 +18,6 @@ async function renderLoggingModule(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">Logging konnte nicht geladen werden.</div>';
|
container.innerHTML = '<div class="empty-state">Logging konnte nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden von Logging', true);
|
showToast('Fehler beim Laden von Logging', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.renderReactionRolesModule = renderReactionRolesModule;
|
export async function renderReactionRolesModule(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function renderReactionRolesModule(guildId) {
|
|
||||||
const container = document.getElementById('module-reactionroles');
|
const container = document.getElementById('module-reactionroles');
|
||||||
if (!container)
|
if (!container)
|
||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade Reaction Roles...</p>';
|
container.innerHTML = '<p class="muted">Lade Reaction Roles...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.reactionRoles(guildId);
|
const data = await api.reactionRoles(guildId);
|
||||||
const entries = data?.entries || data?.reactionRoles || [];
|
const entries = data?.entries || data?.reactionRoles || [];
|
||||||
container.innerHTML = '<h3 class="label">Reaction Roles</h3>';
|
container.innerHTML = '<h3 class="label">Reaction Roles</h3>';
|
||||||
if (!entries.length) {
|
if (!entries.length) {
|
||||||
@@ -32,6 +29,6 @@ async function renderReactionRolesModule(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">Reaction Roles konnten nicht geladen werden.</div>';
|
container.innerHTML = '<div class="empty-state">Reaction Roles konnten nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der Reaction Roles', true);
|
showToast('Fehler beim Laden der Reaction Roles', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.renderServerStatsModule = renderServerStatsModule;
|
export async function renderServerStatsModule(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function renderServerStatsModule(guildId) {
|
|
||||||
const container = document.getElementById('module-serverstats');
|
const container = document.getElementById('module-serverstats');
|
||||||
if (!container)
|
if (!container)
|
||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade Server Stats...</p>';
|
container.innerHTML = '<p class="muted">Lade Server Stats...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.serverStats(guildId);
|
const data = await api.serverStats(guildId);
|
||||||
const cfg = data?.config || data || {};
|
const cfg = data?.config || data || {};
|
||||||
const items = cfg.items || [];
|
const items = cfg.items || [];
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
@@ -22,6 +19,6 @@ async function renderServerStatsModule(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">Server Stats konnten nicht geladen werden.</div>';
|
container.innerHTML = '<div class="empty-state">Server Stats konnten nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der Server Stats', true);
|
showToast('Fehler beim Laden der Server Stats', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.renderStatuspageModule = renderStatuspageModule;
|
export async function renderStatuspageModule(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function renderStatuspageModule(guildId) {
|
|
||||||
const container = document.getElementById('module-statuspage');
|
const container = document.getElementById('module-statuspage');
|
||||||
if (!container)
|
if (!container)
|
||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade Statuspage...</p>';
|
container.innerHTML = '<p class="muted">Lade Statuspage...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.statuspage(guildId);
|
const data = await api.statuspage(guildId);
|
||||||
const cfg = data?.config || data || {};
|
const cfg = data?.config || data || {};
|
||||||
const services = cfg.services || [];
|
const services = cfg.services || [];
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
@@ -22,6 +19,6 @@ async function renderStatuspageModule(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">Statuspage konnte nicht geladen werden.</div>';
|
container.innerHTML = '<div class="empty-state">Statuspage konnte nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der Statuspage', true);
|
showToast('Fehler beim Laden der Statuspage', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.renderWelcomeModule = renderWelcomeModule;
|
export async function renderWelcomeModule(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function renderWelcomeModule(guildId) {
|
|
||||||
const container = document.getElementById('module-welcome');
|
const container = document.getElementById('module-welcome');
|
||||||
if (!container)
|
if (!container)
|
||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade Welcome...</p>';
|
container.innerHTML = '<p class="muted">Lade Welcome...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.settings(guildId);
|
const data = await api.settings(guildId);
|
||||||
const cfg = data?.settings?.welcomeConfig || data?.welcomeConfig || {};
|
const cfg = data?.settings?.welcomeConfig || data?.welcomeConfig || {};
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<h3 class="label">Welcome</h3>
|
<h3 class="label">Welcome</h3>
|
||||||
@@ -21,6 +18,6 @@ async function renderWelcomeModule(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">Welcome konnte nicht geladen werden.</div>';
|
container.innerHTML = '<div class="empty-state">Welcome konnte nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden von Welcome', true);
|
showToast('Fehler beim Laden von Welcome', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../ui/toast.js';
|
||||||
exports.renderOverview = renderOverview;
|
export async function renderOverview(guildId) {
|
||||||
const api_js_1 = require("../services/api.js");
|
|
||||||
const toast_js_1 = require("../ui/toast.js");
|
|
||||||
async function renderOverview(guildId) {
|
|
||||||
const section = document.getElementById('section-overview');
|
const section = document.getElementById('section-overview');
|
||||||
if (!section)
|
if (!section)
|
||||||
return;
|
return;
|
||||||
section.innerHTML = '<p class="muted">Lade Uebersicht...</p>';
|
section.innerHTML = '<p class="muted">Lade Uebersicht...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.overview(guildId);
|
const data = await api.overview(guildId);
|
||||||
const stats = data?.stats || {};
|
const stats = data?.stats || {};
|
||||||
section.innerHTML = `
|
section.innerHTML = `
|
||||||
<h2 class="section-title">Uebersicht</h2>
|
<h2 class="section-title">Uebersicht</h2>
|
||||||
@@ -32,6 +29,6 @@ async function renderOverview(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
section.innerHTML = '<div class="empty-state">Uebersicht konnte nicht geladen werden.</div>';
|
section.innerHTML = '<div class="empty-state">Uebersicht konnte nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der Uebersicht', true);
|
showToast('Fehler beim Laden der Uebersicht', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../ui/toast.js';
|
||||||
exports.renderSettingsSection = renderSettingsSection;
|
export async function renderSettingsSection(guildId) {
|
||||||
const api_js_1 = require("../services/api.js");
|
|
||||||
const toast_js_1 = require("../ui/toast.js");
|
|
||||||
async function renderSettingsSection(guildId) {
|
|
||||||
const section = document.getElementById('section-settings');
|
const section = document.getElementById('section-settings');
|
||||||
if (!section)
|
if (!section)
|
||||||
return;
|
return;
|
||||||
section.innerHTML = '<p class="muted">Lade Einstellungen...</p>';
|
section.innerHTML = '<p class="muted">Lade Einstellungen...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.settings(guildId);
|
const data = await api.settings(guildId);
|
||||||
const settings = data?.settings || {};
|
const settings = data?.settings || {};
|
||||||
section.innerHTML = `
|
section.innerHTML = `
|
||||||
<h2 class="section-title">Einstellungen</h2>
|
<h2 class="section-title">Einstellungen</h2>
|
||||||
@@ -21,6 +18,6 @@ async function renderSettingsSection(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
section.innerHTML = '<div class="empty-state">Einstellungen konnten nicht geladen werden.</div>';
|
section.innerHTML = '<div class="empty-state">Einstellungen konnten nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der Einstellungen', true);
|
showToast('Fehler beim Laden der Einstellungen', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.renderAutomations = renderAutomations;
|
export async function renderAutomations(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function renderAutomations(guildId) {
|
|
||||||
const container = document.getElementById('tickets-automations');
|
const container = document.getElementById('tickets-automations');
|
||||||
if (!container)
|
if (!container)
|
||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade Automationen...</p>';
|
container.innerHTML = '<p class="muted">Lade Automationen...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.automations(guildId);
|
const data = await api.automations(guildId);
|
||||||
const rules = data?.rules || data || [];
|
const rules = data?.rules || data || [];
|
||||||
if (!rules.length) {
|
if (!rules.length) {
|
||||||
container.innerHTML = '<div class="empty-state">Keine Regeln angelegt.</div>';
|
container.innerHTML = '<div class="empty-state">Keine Regeln angelegt.</div>';
|
||||||
@@ -37,6 +34,6 @@ async function renderAutomations(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">Automationen konnten nicht geladen werden.</div>';
|
container.innerHTML = '<div class="empty-state">Automationen konnten nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der Automationen', true);
|
showToast('Fehler beim Laden der Automationen', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
"use strict";
|
import { renderTicketList } from './list.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { renderPipeline } from './pipeline.js';
|
||||||
exports.initTicketsSection = initTicketsSection;
|
import { renderSla } from './sla.js';
|
||||||
const list_js_1 = require("./list.js");
|
import { renderAutomations } from './automations.js';
|
||||||
const pipeline_js_1 = require("./pipeline.js");
|
import { renderKb } from './kb.js';
|
||||||
const sla_js_1 = require("./sla.js");
|
export async function initTicketsSection(guildId) {
|
||||||
const automations_js_1 = require("./automations.js");
|
|
||||||
const kb_js_1 = require("./kb.js");
|
|
||||||
async function initTicketsSection(guildId) {
|
|
||||||
const section = document.getElementById('section-tickets');
|
const section = document.getElementById('section-tickets');
|
||||||
if (!section)
|
if (!section)
|
||||||
return;
|
return;
|
||||||
@@ -23,10 +20,10 @@ async function initTicketsSection(guildId) {
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
(0, list_js_1.renderTicketList)(guildId),
|
renderTicketList(guildId),
|
||||||
(0, pipeline_js_1.renderPipeline)(guildId),
|
renderPipeline(guildId),
|
||||||
(0, sla_js_1.renderSla)(guildId),
|
renderSla(guildId),
|
||||||
(0, automations_js_1.renderAutomations)(guildId),
|
renderAutomations(guildId),
|
||||||
(0, kb_js_1.renderKb)(guildId)
|
renderKb(guildId)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.renderKb = renderKb;
|
export async function renderKb(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function renderKb(guildId) {
|
|
||||||
const container = document.getElementById('tickets-kb');
|
const container = document.getElementById('tickets-kb');
|
||||||
if (!container)
|
if (!container)
|
||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade Knowledge Base...</p>';
|
container.innerHTML = '<p class="muted">Lade Knowledge Base...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.kb(guildId);
|
const data = await api.kb(guildId);
|
||||||
const entries = data?.articles || data?.kb || [];
|
const entries = data?.articles || data?.kb || [];
|
||||||
if (!entries.length) {
|
if (!entries.length) {
|
||||||
container.innerHTML = '<div class="empty-state">Keine KB-Eintraege.</div>';
|
container.innerHTML = '<div class="empty-state">Keine KB-Eintraege.</div>';
|
||||||
@@ -32,6 +29,6 @@ async function renderKb(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">KB konnte nicht geladen werden.</div>';
|
container.innerHTML = '<div class="empty-state">KB konnte nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der KB', true);
|
showToast('Fehler beim Laden der KB', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.renderTicketList = renderTicketList;
|
export async function renderTicketList(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function renderTicketList(guildId) {
|
|
||||||
const container = document.getElementById('tickets-list');
|
const container = document.getElementById('tickets-list');
|
||||||
if (!container)
|
if (!container)
|
||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade Tickets...</p>';
|
container.innerHTML = '<p class="muted">Lade Tickets...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.tickets(guildId);
|
const data = await api.tickets(guildId);
|
||||||
const tickets = data?.tickets || [];
|
const tickets = data?.tickets || [];
|
||||||
if (!tickets.length) {
|
if (!tickets.length) {
|
||||||
container.innerHTML = '<div class="empty-state">Keine Tickets</div>';
|
container.innerHTML = '<div class="empty-state">Keine Tickets</div>';
|
||||||
@@ -38,6 +35,6 @@ async function renderTicketList(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">Tickets konnten nicht geladen werden.</div>';
|
container.innerHTML = '<div class="empty-state">Tickets konnten nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der Tickets', true);
|
showToast('Fehler beim Laden der Tickets', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.renderPipeline = renderPipeline;
|
export async function renderPipeline(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function renderPipeline(guildId) {
|
|
||||||
const container = document.getElementById('tickets-pipeline');
|
const container = document.getElementById('tickets-pipeline');
|
||||||
if (!container)
|
if (!container)
|
||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade Pipeline...</p>';
|
container.innerHTML = '<p class="muted">Lade Pipeline...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.pipeline(guildId);
|
const data = await api.pipeline(guildId);
|
||||||
const lanes = data?.lanes || [];
|
const lanes = data?.lanes || [];
|
||||||
container.innerHTML = '<h3 class="label">Pipeline</h3>';
|
container.innerHTML = '<h3 class="label">Pipeline</h3>';
|
||||||
if (!lanes.length) {
|
if (!lanes.length) {
|
||||||
@@ -32,6 +29,6 @@ async function renderPipeline(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">Pipeline konnte nicht geladen werden.</div>';
|
container.innerHTML = '<div class="empty-state">Pipeline konnte nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der Pipeline', true);
|
showToast('Fehler beim Laden der Pipeline', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
"use strict";
|
import { api } from '../../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { showToast } from '../../ui/toast.js';
|
||||||
exports.renderSla = renderSla;
|
export async function renderSla(guildId) {
|
||||||
const api_js_1 = require("../../services/api.js");
|
|
||||||
const toast_js_1 = require("../../ui/toast.js");
|
|
||||||
async function renderSla(guildId) {
|
|
||||||
const container = document.getElementById('tickets-sla');
|
const container = document.getElementById('tickets-sla');
|
||||||
if (!container)
|
if (!container)
|
||||||
return;
|
return;
|
||||||
container.innerHTML = '<p class="muted">Lade SLA...</p>';
|
container.innerHTML = '<p class="muted">Lade SLA...</p>';
|
||||||
try {
|
try {
|
||||||
const data = await api_js_1.api.sla(guildId);
|
const data = await api.sla(guildId);
|
||||||
const stats = data?.stats || {};
|
const stats = data?.stats || {};
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<h3 class="label">SLA</h3>
|
<h3 class="label">SLA</h3>
|
||||||
@@ -20,6 +17,6 @@ async function renderSla(guildId) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
container.innerHTML = '<div class="empty-state">SLA konnte nicht geladen werden.</div>';
|
container.innerHTML = '<div class="empty-state">SLA konnte nicht geladen werden.</div>';
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden der SLA', true);
|
showToast('Fehler beim Laden der SLA', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
"use strict";
|
import { api } from '../services/api.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
import { initConfig, setState, getConfig } from '../state/store.js';
|
||||||
const api_js_1 = require("../services/api.js");
|
import { renderSidebar, initNavigation } from '../ui/navigation.js';
|
||||||
const store_js_1 = require("../state/store.js");
|
import { showToast } from '../ui/toast.js';
|
||||||
const navigation_js_1 = require("../ui/navigation.js");
|
import { initSelectionView } from '../components/guildSelect.js';
|
||||||
const toast_js_1 = require("../ui/toast.js");
|
import { initDashboardView } from '../components/dashboard.js';
|
||||||
const guildSelect_js_1 = require("../components/guildSelect.js");
|
|
||||||
const dashboard_js_1 = require("../components/dashboard.js");
|
|
||||||
function readConfig() {
|
function readConfig() {
|
||||||
const root = document.getElementById('app');
|
const root = document.getElementById('app');
|
||||||
if (!root)
|
if (!root)
|
||||||
@@ -20,50 +18,50 @@ function readConfig() {
|
|||||||
const userLabel = root.dataset.userName
|
const userLabel = root.dataset.userName
|
||||||
? `${root.dataset.userName}${root.dataset.userDisc ? '#' + root.dataset.userDisc : ''}`
|
? `${root.dataset.userName}${root.dataset.userDisc ? '#' + root.dataset.userDisc : ''}`
|
||||||
: undefined;
|
: undefined;
|
||||||
(0, store_js_1.initConfig)({ baseRoot, baseDashboard, baseAuth, baseApi, view, initialGuildId, isAdmin, userLabel });
|
initConfig({ baseRoot, baseDashboard, baseAuth, baseApi, view, initialGuildId, isAdmin, userLabel });
|
||||||
}
|
}
|
||||||
async function ensureAuth() {
|
async function ensureAuth() {
|
||||||
try {
|
try {
|
||||||
const me = await api_js_1.api.me();
|
const me = await api.me();
|
||||||
if (!me?.user) {
|
if (!me?.user) {
|
||||||
const cfg = (0, store_js_1.getConfig)();
|
const cfg = getConfig();
|
||||||
window.location.href = (cfg?.baseAuth || '/auth') + '/discord';
|
window.location.href = (cfg?.baseAuth || '/auth') + '/discord';
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const userInfo = document.getElementById('userInfo');
|
const userInfo = document.getElementById('userInfo');
|
||||||
if (userInfo && me.user)
|
if (userInfo && me.user)
|
||||||
userInfo.textContent = `${me.user.username}#${me.user.discriminator}`;
|
userInfo.textContent = `${me.user.username}#${me.user.discriminator}`;
|
||||||
(0, store_js_1.setState)({ isAdmin: !!me.user?.isAdmin, userLabel: me.user ? `${me.user.username}#${me.user.discriminator}` : undefined });
|
setState({ isAdmin: !!me.user?.isAdmin, userLabel: me.user ? `${me.user.username}#${me.user.discriminator}` : undefined });
|
||||||
return me;
|
return me;
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
(0, toast_js_1.showToast)('Authentifizierung fehlgeschlagen', true);
|
showToast('Authentifizierung fehlgeschlagen', true);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
readConfig();
|
readConfig();
|
||||||
const cfg = (0, store_js_1.getConfig)();
|
const cfg = getConfig();
|
||||||
if (!cfg)
|
if (!cfg)
|
||||||
return;
|
return;
|
||||||
const sidebarRoot = document.getElementById('sidebar-root');
|
const sidebarRoot = document.getElementById('sidebar-root');
|
||||||
if (sidebarRoot)
|
if (sidebarRoot)
|
||||||
(0, navigation_js_1.renderSidebar)(sidebarRoot, !!cfg.isAdmin);
|
renderSidebar(sidebarRoot, !!cfg.isAdmin);
|
||||||
if (cfg.view === 'selection') {
|
if (cfg.view === 'selection') {
|
||||||
(0, guildSelect_js_1.initSelectionView)();
|
initSelectionView();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await ensureAuth();
|
await ensureAuth();
|
||||||
(0, dashboard_js_1.initDashboardView)();
|
initDashboardView();
|
||||||
(0, navigation_js_1.initNavigation)((section) => {
|
initNavigation((section) => {
|
||||||
// Sections werden innerhalb der jeweiligen Komponenten bedient
|
// Sections werden innerhalb der jeweiligen Komponenten bedient
|
||||||
if (section === 'admin' && !cfg.isAdmin)
|
if (section === 'admin' && !cfg.isAdmin)
|
||||||
(0, toast_js_1.showToast)('Kein Admin-Recht', true);
|
showToast('Kein Admin-Recht', true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bootstrap().catch((err) => {
|
bootstrap().catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
(0, toast_js_1.showToast)('Fehler beim Laden', true);
|
showToast('Fehler beim Laden', true);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
"use strict";
|
import { getConfig } from '../state/store.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.api = void 0;
|
|
||||||
const store_js_1 = require("../state/store.js");
|
|
||||||
function buildUrl(path, query) {
|
function buildUrl(path, query) {
|
||||||
const cfg = (0, store_js_1.getConfig)();
|
const cfg = getConfig();
|
||||||
const base = cfg?.baseApi || '';
|
const base = cfg?.baseApi || '';
|
||||||
const url = new URL(path.startsWith('http') ? path : `${base}${path}`, window.location.origin);
|
const url = new URL(path.startsWith('http') ? path : `${base}${path}`, window.location.origin);
|
||||||
if (query) {
|
if (query) {
|
||||||
@@ -35,7 +32,7 @@ async function request(path, options = {}) {
|
|||||||
}
|
}
|
||||||
return (await res.text());
|
return (await res.text());
|
||||||
}
|
}
|
||||||
exports.api = {
|
export const api = {
|
||||||
me: () => request('/me'),
|
me: () => request('/me'),
|
||||||
guilds: () => request('/guilds'),
|
guilds: () => request('/guilds'),
|
||||||
overview: (guildId) => request(`/overview`, { query: { guildId } }),
|
overview: (guildId) => request(`/overview`, { query: { guildId } }),
|
||||||
|
|||||||
@@ -1,14 +1,7 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.initConfig = initConfig;
|
|
||||||
exports.getConfig = getConfig;
|
|
||||||
exports.getState = getState;
|
|
||||||
exports.setState = setState;
|
|
||||||
exports.subscribe = subscribe;
|
|
||||||
let config = null;
|
let config = null;
|
||||||
let state = {};
|
let state = {};
|
||||||
const listeners = new Set();
|
const listeners = new Set();
|
||||||
function initConfig(next) {
|
export function initConfig(next) {
|
||||||
config = next;
|
config = next;
|
||||||
state = {
|
state = {
|
||||||
guildId: next.initialGuildId,
|
guildId: next.initialGuildId,
|
||||||
@@ -16,17 +9,17 @@ function initConfig(next) {
|
|||||||
userLabel: next.userLabel
|
userLabel: next.userLabel
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function getConfig() {
|
export function getConfig() {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
function getState() {
|
export function getState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
function setState(partial) {
|
export function setState(partial) {
|
||||||
state = { ...state, ...partial };
|
state = { ...state, ...partial };
|
||||||
listeners.forEach((l) => l(state));
|
listeners.forEach((l) => l(state));
|
||||||
}
|
}
|
||||||
function subscribe(listener) {
|
export function subscribe(listener) {
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
return () => listeners.delete(listener);
|
return () => listeners.delete(listener);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.showModal = showModal;
|
|
||||||
exports.hideModal = hideModal;
|
|
||||||
let activeModal = null;
|
let activeModal = null;
|
||||||
let backdrop = null;
|
let backdrop = null;
|
||||||
function ensureBackdrop() {
|
function ensureBackdrop() {
|
||||||
@@ -13,14 +9,14 @@ function ensureBackdrop() {
|
|||||||
document.body.appendChild(backdrop);
|
document.body.appendChild(backdrop);
|
||||||
return backdrop;
|
return backdrop;
|
||||||
}
|
}
|
||||||
function showModal(content) {
|
export function showModal(content) {
|
||||||
const bd = ensureBackdrop();
|
const bd = ensureBackdrop();
|
||||||
if (!content.parentElement)
|
if (!content.parentElement)
|
||||||
bd.appendChild(content);
|
bd.appendChild(content);
|
||||||
activeModal = content;
|
activeModal = content;
|
||||||
bd.classList.add('show');
|
bd.classList.add('show');
|
||||||
}
|
}
|
||||||
function hideModal() {
|
export function hideModal() {
|
||||||
if (backdrop)
|
if (backdrop)
|
||||||
backdrop.classList.remove('show');
|
backdrop.classList.remove('show');
|
||||||
activeModal = null;
|
activeModal = null;
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
"use strict";
|
import { setState } from '../state/store.js';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.renderSidebar = renderSidebar;
|
|
||||||
exports.initNavigation = initNavigation;
|
|
||||||
const store_js_1 = require("../state/store.js");
|
|
||||||
const defaultNav = [
|
const defaultNav = [
|
||||||
{ id: 'overview', label: 'Uebersicht', icon: '[*]' },
|
{ id: 'overview', label: 'Uebersicht', icon: '[*]' },
|
||||||
{ id: 'tickets', label: 'Ticketsystem', icon: '[*]' },
|
{ id: 'tickets', label: 'Ticketsystem', icon: '[*]' },
|
||||||
@@ -11,7 +7,7 @@ const defaultNav = [
|
|||||||
{ id: 'events', label: 'Events', icon: '[*]' },
|
{ id: 'events', label: 'Events', icon: '[*]' },
|
||||||
{ id: 'admin', label: 'Admin', icon: '[*]', requiresAdmin: true }
|
{ id: 'admin', label: 'Admin', icon: '[*]', requiresAdmin: true }
|
||||||
];
|
];
|
||||||
function renderSidebar(container, isAdmin) {
|
export function renderSidebar(container, isAdmin) {
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
const brand = document.createElement('div');
|
const brand = document.createElement('div');
|
||||||
brand.className = 'brand';
|
brand.className = 'brand';
|
||||||
@@ -30,14 +26,14 @@ function renderSidebar(container, isAdmin) {
|
|||||||
container.appendChild(brand);
|
container.appendChild(brand);
|
||||||
container.appendChild(nav);
|
container.appendChild(nav);
|
||||||
}
|
}
|
||||||
function initNavigation(onChange) {
|
export function initNavigation(onChange) {
|
||||||
const navLinks = Array.from(document.querySelectorAll('.nav a'));
|
const navLinks = Array.from(document.querySelectorAll('.nav a'));
|
||||||
const activate = (section) => {
|
const activate = (section) => {
|
||||||
navLinks.forEach((link) => link.classList.toggle('active', link.dataset.target === section));
|
navLinks.forEach((link) => link.classList.toggle('active', link.dataset.target === section));
|
||||||
document.querySelectorAll('.section').forEach((sec) => {
|
document.querySelectorAll('.section').forEach((sec) => {
|
||||||
sec.classList.toggle('active', sec.id === `section-${section}`);
|
sec.classList.toggle('active', sec.id === `section-${section}`);
|
||||||
});
|
});
|
||||||
(0, store_js_1.setState)({}); // trigger listeners for potential observers
|
setState({}); // trigger listeners for potential observers
|
||||||
onChange(section);
|
onChange(section);
|
||||||
};
|
};
|
||||||
navLinks.forEach((link) => {
|
navLinks.forEach((link) => {
|
||||||
|
|||||||
@@ -1,18 +1,13 @@
|
|||||||
"use strict";
|
export function toggleSwitch(el, force) {
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.toggleSwitch = toggleSwitch;
|
|
||||||
exports.getSwitch = getSwitch;
|
|
||||||
exports.setSwitch = setSwitch;
|
|
||||||
function toggleSwitch(el, force) {
|
|
||||||
if (!el)
|
if (!el)
|
||||||
return;
|
return;
|
||||||
const next = force === undefined ? !el.classList.contains('on') : force;
|
const next = force === undefined ? !el.classList.contains('on') : force;
|
||||||
el.classList.toggle('on', next);
|
el.classList.toggle('on', next);
|
||||||
}
|
}
|
||||||
function getSwitch(el) {
|
export function getSwitch(el) {
|
||||||
return el?.classList.contains('on') ?? false;
|
return el?.classList.contains('on') ?? false;
|
||||||
}
|
}
|
||||||
function setSwitch(el, value) {
|
export function setSwitch(el, value) {
|
||||||
if (!el)
|
if (!el)
|
||||||
return;
|
return;
|
||||||
el.classList.toggle('on', value);
|
el.classList.toggle('on', value);
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.showToast = showToast;
|
|
||||||
exports.hideToast = hideToast;
|
|
||||||
let currentTimeout = null;
|
let currentTimeout = null;
|
||||||
function showToast(message, isError = false, duration = 2500) {
|
export function showToast(message, isError = false, duration = 2500) {
|
||||||
let toast = document.getElementById('toast-root');
|
let toast = document.getElementById('toast-root');
|
||||||
if (!toast) {
|
if (!toast) {
|
||||||
toast = document.createElement('div');
|
toast = document.createElement('div');
|
||||||
@@ -19,7 +15,7 @@ function showToast(message, isError = false, duration = 2500) {
|
|||||||
window.clearTimeout(currentTimeout);
|
window.clearTimeout(currentTimeout);
|
||||||
currentTimeout = window.setTimeout(() => hideToast(), duration);
|
currentTimeout = window.setTimeout(() => hideToast(), duration);
|
||||||
}
|
}
|
||||||
function hideToast() {
|
export function hideToast() {
|
||||||
const toast = document.getElementById('toast-root');
|
const toast = document.getElementById('toast-root');
|
||||||
if (!toast)
|
if (!toast)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"module": "NodeNext",
|
"module": "ES2020",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "Bundler",
|
||||||
"outDir": "public/ts-build",
|
"outDir": "public/ts-build",
|
||||||
"rootDir": "public/ts",
|
"rootDir": "public/ts",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user