diff --git a/package.json b/package.json index f2bd1b0..f8893ae 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,6 @@ "scripts": { "dev": "vite dev", "build": "vite build", - "build:test": "vite build --config vite.config.test.ts", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", diff --git a/playwright.config.ts b/playwright.config.ts index 461f3c2..bf148ce 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -6,7 +6,7 @@ const config: PlaywrightTestConfig = { timezoneId: 'Europe/Amsterdam' }, webServer: { - command: 'npm run build:test && npm run preview', + command: 'npm run build && npm run preview', port: 4173 }, reporter: process.env.CI ? 'github' : 'list', diff --git a/src/lib/components/settings/DisplaySettings.svelte b/src/lib/components/settings/DisplaySettings.svelte index 7653298..e391a8c 100644 --- a/src/lib/components/settings/DisplaySettings.svelte +++ b/src/lib/components/settings/DisplaySettings.svelte @@ -20,19 +20,14 @@ const setTextColor = () => { $settings.invertedColor = !$settings.invertedColor; + $settings.fgColor = $settings.invertedColor ? 65535 : 0; + $settings.bgColor = $settings.invertedColor ? 0 : 65535; }; const textColorOptions: [string, boolean][] = [ [$_('colors.black') + ' on ' + $_('colors.white'), false], [$_('colors.white') + ' on ' + $_('colors.black'), true] ]; - - const fontPreferenceOptions: [string, string][] = $settings.availableFonts?.map((font) => [ - $_(`fonts.${font}`) !== `fonts.${font}` - ? $_(`fonts.${font}`) - : font.charAt(0).toUpperCase() + font.slice(1), - font - ]); @@ -50,14 +45,6 @@ on:change={setTextColor} /> - - { + console.log('Connecting to EventSource'); const evtSource = new EventSource(`${PUBLIC_BASE_URL}/events`); evtSource.addEventListener('status', (e) => { diff --git a/src/routes/Settings.svelte b/src/routes/Settings.svelte index 6d9b932..17a5df1 100644 --- a/src/routes/Settings.svelte +++ b/src/routes/Settings.svelte @@ -114,13 +114,9 @@
- + | - +
{$_('section.settings.title')} diff --git a/src/routes/Status.svelte b/src/routes/Status.svelte index e889a0b..c2ce212 100644 --- a/src/routes/Status.svelte +++ b/src/routes/Status.svelte @@ -158,7 +158,7 @@
{#if $status.data}
- {#if $status.isUpdating === false && ($status.isFake ?? false) === false} + {#if $status.isUpdating === false && $status.isFake === false}
diff --git a/tests/shared.ts b/tests/shared.ts index 821f202..9239f2e 100644 --- a/tests/shared.ts +++ b/tests/shared.ts @@ -108,10 +108,8 @@ export const settingsJson = { 'ckpool', 'eu_ckpool' ], - availableFonts: ['antonio', 'oswald'], invertedColor: false, - isLoaded: true, - isFake: true + isLoaded: true }; export const latestReleaseFake = { @@ -169,31 +167,16 @@ export const initMock = async ({ page }) => { await route.fulfill({ json: settingsJson }); }); - await page.route('**/events', async (route) => { + await page.route('**/events', (route) => { const newStatus = statusJson; newStatus.data = ['BLOCK/HEIGHT', '8', '0', '0', '8', '1', '5']; newStatus.isUpdating = true; - // Format the SSE message correctly - const sseMessage = `data: ${JSON.stringify(newStatus)}\n\n`; - - // Create a readable stream for SSE - const stream = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode(sseMessage)); - // Keep the connection open - // controller.close(); // Don't close if you want to send more events - } - }); - - await route.fulfill({ + // Respond with a custom SSE message + route.fulfill({ status: 200, - headers: { - 'Content-Type': 'text/event-stream', - 'Cache-Control': 'no-cache', - Connection: 'keep-alive' - }, - body: stream + contentType: 'text/event-stream', + json: `${JSON.stringify(newStatus)}\n\n` }); }); diff --git a/vite.config.test.ts b/vite.config.test.ts deleted file mode 100644 index 3e03c63..0000000 --- a/vite.config.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { sveltekit } from '@sveltejs/kit/vite'; -import { defineConfig } from 'vite'; - -export default defineConfig({ - plugins: [sveltekit()], - build: { - sourcemap: true, - minify: false, - rollupOptions: { - output: { - manualChunks: undefined // Disable code splitting - } - } - }, - test: { - include: ['tests/**/*.{test,spec}.{js,ts}'] - } -});