This commit is contained in:
Tomas Dvorak
2026-03-13 17:19:19 +01:00
parent 0357b506ae
commit e08858ba48
22 changed files with 96 additions and 34 deletions
+1
View File
@@ -0,0 +1 @@
{"items":[],"page":1,"page_size":10,"total":0}
+1
View File
@@ -0,0 +1 @@
{"etag":"","fetched_at":"2026-03-13T16:17:10Z","last_modified":""}
+1
View File
@@ -0,0 +1 @@
[]
+1
View File
@@ -0,0 +1 @@
{"etag":"","fetched_at":"2026-03-13T16:17:10Z","last_modified":""}
+1
View File
@@ -0,0 +1 @@
[]
+1
View File
@@ -0,0 +1 @@
{"etag":"","fetched_at":"2026-03-13T16:17:10Z","last_modified":""}
+1
View File
@@ -0,0 +1 @@
[]
+1
View File
@@ -0,0 +1 @@
[]
+1
View File
@@ -0,0 +1 @@
{"lastUpdated":"2026-03-13T16:17:10Z"}
+42
View File
@@ -0,0 +1,42 @@
{
"baseURL": "http://localhost:8080/api/v1",
"duration_ms": 94,
"endpoints": [
{
"path": "/articles?page=1\u0026page_size=10\u0026published=true",
"file": "articles.json",
"ok": true
},
{
"path": "/sponsors",
"file": "sponsors.json",
"ok": true
},
{
"path": "/events/upcoming",
"file": "events_upcoming.json",
"ok": true
},
{
"path": "/public/team-logo-overrides",
"file": "team_logo_overrides.json",
"ok": true
},
{
"path": "/competition-aliases",
"file": "competition_aliases.json",
"ok": true
},
{
"path": "/settings",
"file": "settings.json",
"ok": true
},
{
"path": "/seo",
"file": "seo.json",
"ok": true
}
],
"lastUpdated": "2026-03-13T16:17:10Z"
}
+1
View File
@@ -0,0 +1 @@
{"additional_meta":"","canonical_base_url":"","default_og_image_url":"","enable_indexing":false,"meta_keywords":"","site_description":"","site_title":"","twitter_handle":""}
+1
View File
@@ -0,0 +1 @@
{"etag":"","fetched_at":"2026-03-13T16:17:10Z","last_modified":""}
+1
View File
@@ -0,0 +1 @@
{"about_html":"","accent_color":"#e53e3e","api_base_url":"","background_color":"#ffffff","club_data_mode":"auto","club_id":"","club_logo_url":"","club_name":"","club_type":"","club_url":"","contact_address":"","contact_city":"","contact_country":"","contact_email":"","contact_phone":"","contact_zip":"","custom_nav":null,"eshop_enabled":false,"facebook_url":"","font_body":"Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif","font_heading":"Poppins, sans-serif","frontend_base_url":"","gallery_label":"","gallery_url":"","instagram_url":"","location_latitude":0,"location_longitude":0,"map_style":"","map_zoom_level":0,"merch_items":null,"merch_limit":0,"merch_module_enabled":false,"merch_source":"","merch_style":"","premium":false,"primary_color":"#1a365d","secondary_color":"#2b6cb0","show_about_in_nav":false,"show_map_on_homepage":false,"sponsors_layout":"","sponsors_theme":"","text_color":"#1a202c","videos":null,"videos_items":null,"videos_limit":6,"videos_module_enabled":false,"videos_source":"auto","videos_style":"slider","videos_title_overrides":{},"youtube_url":""}
+1
View File
@@ -0,0 +1 @@
{"etag":"","fetched_at":"2026-03-13T16:17:10Z","last_modified":""}
+1
View File
@@ -0,0 +1 @@
[]
+1
View File
@@ -0,0 +1 @@
{"etag":"","fetched_at":"2026-03-13T16:17:10Z","last_modified":""}
+1
View File
@@ -0,0 +1 @@
{"by_id":{},"by_name":{}}
+1
View File
@@ -0,0 +1 @@
{"etag":"","fetched_at":"2026-03-13T16:17:10Z","last_modified":""}
+1
View File
@@ -0,0 +1 @@
[]
+4
View File
@@ -0,0 +1,4 @@
{
"fetched_at": "2026-03-13T16:17:09Z",
"link": ""
}
+9 -4
View File
@@ -1,6 +1,12 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import { usePublicSettings } from './usePublicSettings'; import { usePublicSettings } from './usePublicSettings';
import { getFontPairing, applyFontPairing, getDefaultFontPairing } from '../config/fonts'; import {
FONT_PAIRINGS,
getFontPairing,
applyFontPairing,
getDefaultFontPairing,
type FontPairing,
} from '../config/fonts';
/** /**
* Hook to load and apply club fonts from settings * Hook to load and apply club fonts from settings
@@ -12,15 +18,14 @@ export const useFontLoader = () => {
// Determine which font pairing to use // Determine which font pairing to use
const fontId = settings?.font_heading || settings?.font_body; const fontId = settings?.font_heading || settings?.font_body;
let pairing; let pairing: FontPairing | undefined;
if (fontId) { if (fontId) {
// Try to find matching pairing by heading or body font name // Try to find matching pairing by heading or body font name
pairing = getFontPairing(fontId); pairing = getFontPairing(fontId);
// If not found by ID, try to find by font name // If not found by ID, try to find by font name
if (!pairing) { if (!pairing) {
const allPairings = require('../config/fonts').FONT_PAIRINGS; pairing = FONT_PAIRINGS.find((p) =>
pairing = allPairings.find((p: any) =>
p.heading === fontId || p.heading === fontId ||
p.body === fontId || p.body === fontId ||
p.id === fontId p.id === fontId
+23 -30
View File
@@ -20,20 +20,37 @@ export function register(config?: Config) {
} }
window.addEventListener('load', () => { window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) { if (isLocalhost) {
checkValidServiceWorker(swUrl, config); disableLocalServiceWorkers();
navigator.serviceWorker.ready.then(() => { return;
console.log('Service worker is ready in development mode');
});
} else { } else {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
registerValidSW(swUrl, config); registerValidSW(swUrl, config);
} }
}); });
} }
} }
function disableLocalServiceWorkers() {
navigator.serviceWorker
.getRegistrations()
.then(async (registrations) => {
await Promise.all(registrations.map((registration) => registration.unregister()));
if ('caches' in window) {
const cacheKeys = await caches.keys();
await Promise.all(cacheKeys.map((key) => caches.delete(key)));
}
if (registrations.length > 0) {
console.log('Localhost detected; cleared service workers and caches.');
}
})
.catch((error) => {
console.error('Error while clearing localhost service workers:', error);
});
}
function registerValidSW(swUrl: string, config?: Config) { function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker navigator.serviceWorker
.register(swUrl) .register(swUrl)
@@ -68,30 +85,6 @@ function registerValidSW(swUrl: string, config?: Config) {
}); });
} }
function checkValidServiceWorker(swUrl: string, config?: Config) {
fetch(swUrl, {
headers: { 'Service-Worker': 'script' },
})
.then((response) => {
const contentType = response.headers.get('content-type');
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
) {
navigator.serviceWorker.ready.then((registration) => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
registerValidSW(swUrl, config);
}
})
.catch(() => {
console.log('No internet connection found. App is running in offline mode.');
});
}
export function unregister() { export function unregister() {
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready navigator.serviceWorker.ready