[deploy] Emit frontend bundle as ESM for browser
All checks were successful
Deploy Discord Bot / deploy (push) Successful in 38s

This commit is contained in:
Pascal Prießnitz
2025-12-04 17:06:27 +01:00
parent 18a47c0426
commit 7a296f7b4a
28 changed files with 185 additions and 273 deletions

View File

@@ -1,7 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.showModal = showModal;
exports.hideModal = hideModal;
let activeModal = null;
let backdrop = null;
function ensureBackdrop() {
@@ -13,14 +9,14 @@ function ensureBackdrop() {
document.body.appendChild(backdrop);
return backdrop;
}
function showModal(content) {
export function showModal(content) {
const bd = ensureBackdrop();
if (!content.parentElement)
bd.appendChild(content);
activeModal = content;
bd.classList.add('show');
}
function hideModal() {
export function hideModal() {
if (backdrop)
backdrop.classList.remove('show');
activeModal = null;

View File

@@ -1,8 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderSidebar = renderSidebar;
exports.initNavigation = initNavigation;
const store_js_1 = require("../state/store.js");
import { setState } from '../state/store.js';
const defaultNav = [
{ id: 'overview', label: 'Uebersicht', icon: '[*]' },
{ id: 'tickets', label: 'Ticketsystem', icon: '[*]' },
@@ -11,7 +7,7 @@ const defaultNav = [
{ id: 'events', label: 'Events', icon: '[*]' },
{ id: 'admin', label: 'Admin', icon: '[*]', requiresAdmin: true }
];
function renderSidebar(container, isAdmin) {
export function renderSidebar(container, isAdmin) {
container.innerHTML = '';
const brand = document.createElement('div');
brand.className = 'brand';
@@ -30,14 +26,14 @@ function renderSidebar(container, isAdmin) {
container.appendChild(brand);
container.appendChild(nav);
}
function initNavigation(onChange) {
export function initNavigation(onChange) {
const navLinks = Array.from(document.querySelectorAll('.nav a'));
const activate = (section) => {
navLinks.forEach((link) => link.classList.toggle('active', link.dataset.target === section));
document.querySelectorAll('.section').forEach((sec) => {
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);
};
navLinks.forEach((link) => {

View File

@@ -1,18 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toggleSwitch = toggleSwitch;
exports.getSwitch = getSwitch;
exports.setSwitch = setSwitch;
function toggleSwitch(el, force) {
export function toggleSwitch(el, force) {
if (!el)
return;
const next = force === undefined ? !el.classList.contains('on') : force;
el.classList.toggle('on', next);
}
function getSwitch(el) {
export function getSwitch(el) {
return el?.classList.contains('on') ?? false;
}
function setSwitch(el, value) {
export function setSwitch(el, value) {
if (!el)
return;
el.classList.toggle('on', value);

View File

@@ -1,9 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.showToast = showToast;
exports.hideToast = hideToast;
let currentTimeout = null;
function showToast(message, isError = false, duration = 2500) {
export function showToast(message, isError = false, duration = 2500) {
let toast = document.getElementById('toast-root');
if (!toast) {
toast = document.createElement('div');
@@ -19,7 +15,7 @@ function showToast(message, isError = false, duration = 2500) {
window.clearTimeout(currentTimeout);
currentTimeout = window.setTimeout(() => hideToast(), duration);
}
function hideToast() {
export function hideToast() {
const toast = document.getElementById('toast-root');
if (!toast)
return;