From c80eb89db753e5be868ffa5e1f8c09dda7c1517c Mon Sep 17 00:00:00 2001 From: Alessio Davoli Date: Wed, 6 Mar 2024 00:14:26 +0100 Subject: [PATCH] Lint and format --- frontend/package.json | 76 +++++++------- frontend/src/app.d.ts | 90 ++++++++--------- frontend/src/app.html | 82 ++++++++-------- frontend/src/css/app.css | 49 +++++----- frontend/src/css/header.css | 22 ++--- frontend/src/error.html | 76 +++++++------- frontend/src/hooks.client.ts | 4 +- frontend/src/hooks.server.ts | 4 +- .../src/lib/components/BottomAppBar.svelte | 1 - frontend/src/lib/components/Header.svelte | 62 ++++++------ frontend/src/lib/components/HomeHeader.svelte | 2 +- frontend/src/lib/components/Path.svelte | 12 +-- frontend/src/lib/components/Route.svelte | 10 +- frontend/src/lib/components/Splash.svelte | 12 +-- frontend/src/lib/components/Tabs.svelte | 33 +++++-- .../src/lib/components/tabs/DescTab.svelte | 2 +- .../lib/components/tabs/InfoTabBike.svelte | 46 ++++----- .../components/tabs/InfoTabTrekking.svelte | 46 ++++----- .../src/lib/components/tabs/MapTab.svelte | 93 +++++++++--------- frontend/src/lib/gps.worker.ts | 10 +- frontend/src/lib/repo.ts | 79 ++++++++------- frontend/src/routes/+error.svelte | 8 +- frontend/src/routes/+layout.svelte | 8 +- frontend/src/routes/+page.svelte | 2 +- frontend/src/routes/+page.ts | 2 +- frontend/src/routes/paths/[slug]/+page.svelte | 2 +- frontend/src/routes/paths/[slug]/+page.ts | 35 ++++--- .../src/routes/routes/[slug]/+page.svelte | 4 +- frontend/src/routes/routes/[slug]/+page.ts | 22 ++--- frontend/src/routes/settings/+page.svelte | 2 +- frontend/src/sw.ts | 98 +++++++++---------- frontend/static/manifest.json | 91 +++++++++-------- frontend/svelte.config.js | 10 +- frontend/vite.config.ts | 30 +++--- 34 files changed, 560 insertions(+), 565 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 96ca847..790c2c3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,40 +1,40 @@ { - "name": "frontend", - "version": "0.6.0", - "private": true, - "scripts": { - "dev": "vite dev", - "build": "vite build && ./add-sigint.sh", - "add-sigint": "./add-sigint.sh", - "preview": "vite preview", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --plugin-search-dir . --check . && eslint .", - "format": "prettier --plugin-search-dir . --write ." - }, - "devDependencies": { - "@sveltejs/adapter-node": "^4.0.1", - "@sveltejs/kit": "^2.5.2", - "@sveltejs/vite-plugin-svelte": "^3.0.2", - "@types/leaflet": "^1.9.8", - "@typescript-eslint/eslint-plugin": "^7.1.1", - "@typescript-eslint/parser": "^7.1.1", - "eslint": "^8.57.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-svelte": "^2.35.1", - "prettier": "^3.2.5", - "prettier-plugin-svelte": "^3.2.2", - "svelte": "^4.2.12", - "svelte-check": "^3.6.6", - "tslib": "^2.6.2", - "typescript": "^5.3.3", - "vite": "^5.1.5" - }, - "type": "module", - "dependencies": { - "@sentry/sveltekit": "^7.105.0", - "leaflet": "^1.9.4", - "leaflet-gpx": "^1.7.0", - "svelte-preprocess": "^5.1.3" - } + "name": "frontend", + "version": "0.6.0", + "private": true, + "scripts": { + "dev": "vite dev", + "build": "vite build && ./add-sigint.sh", + "add-sigint": "./add-sigint.sh", + "preview": "vite preview", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "lint": "prettier --plugin-search-dir . --check . && eslint .", + "format": "prettier --plugin-search-dir . --write ." + }, + "devDependencies": { + "@sveltejs/adapter-node": "^4.0.1", + "@sveltejs/kit": "^2.5.2", + "@sveltejs/vite-plugin-svelte": "^3.0.2", + "@types/leaflet": "^1.9.8", + "@typescript-eslint/eslint-plugin": "^7.1.1", + "@typescript-eslint/parser": "^7.1.1", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-svelte": "^2.35.1", + "prettier": "^3.2.5", + "prettier-plugin-svelte": "^3.2.2", + "svelte": "^4.2.12", + "svelte-check": "^3.6.6", + "tslib": "^2.6.2", + "typescript": "^5.3.3", + "vite": "^5.1.5" + }, + "type": "module", + "dependencies": { + "@sentry/sveltekit": "^7.105.0", + "leaflet": "^1.9.4", + "leaflet-gpx": "^1.7.0", + "svelte-preprocess": "^5.1.3" + } } diff --git a/frontend/src/app.d.ts b/frontend/src/app.d.ts index 77f1626..6361f59 100644 --- a/frontend/src/app.d.ts +++ b/frontend/src/app.d.ts @@ -9,51 +9,50 @@ declare global { // interface PageData {} // interface Platform {} interface Category { - "id": 1, - "name_it": "Natura", - "name_en": "Nature", - "description_it": "Giri nella natura", - "description_en": "Countryside routes", - "icon": "", - "created_at": null, - "updated_at": null, - "deleted_at": null, - "color": string, - "cover": string, + id: 1; + name_it: 'Natura'; + name_en: 'Nature'; + description_it: 'Giri nella natura'; + description_en: 'Countryside routes'; + icon: ''; + created_at: null; + updated_at: null; + deleted_at: null; + color: string; + cover: string; } interface Sport { - "id": 1, - "name_it": "Trekking", - "name_en": "Trekking", - "description_it": "Percorso escursionistico", - "description_en": "Trekking route", - "icon": "", - "created_at": "2023-10-31T18:37:30.000000Z", - "updated_at": null, - "deleted_at": null + id: 1; + name_it: 'Trekking'; + name_en: 'Trekking'; + description_it: 'Percorso escursionistico'; + description_en: 'Trekking route'; + icon: ''; + created_at: '2023-10-31T18:37:30.000000Z'; + updated_at: null; + deleted_at: null; } interface SportDetails { - id: 1, - route_id: 1, - sport_id: 1, - short_description_it: "Percorso escursionistico intermedio. Buon allenamento richiesto. Sentieri facilmente percorribili. Adatto a ogni livello di abilit\u00e0. ", - short_description_en: "Intermediate hiking route. Good training required. Easily accessible paths. Suitable for all skill levels.", - gpx_path: "", - distance: 16800, - duration: 288, - elevation_gain: 439, - elevation_loss: null, - altitude_max: 620, - altitude_min: 180, - difficulty_it: "Facile", - difficulty_en: "Easy", - route_type_it: "Percorso ad anello", - route_type_en: "Ring route", - created_at: "2023-11-02T10:57:41.000000Z", - updated_at: null, - deleted_at: null, - sport: Sport - + id: 1; + route_id: 1; + sport_id: 1; + short_description_it: 'Percorso escursionistico intermedio. Buon allenamento richiesto. Sentieri facilmente percorribili. Adatto a ogni livello di abilit\u00e0. '; + short_description_en: 'Intermediate hiking route. Good training required. Easily accessible paths. Suitable for all skill levels.'; + gpx_path: ''; + distance: 16800; + duration: 288; + elevation_gain: 439; + elevation_loss: null; + altitude_max: 620; + altitude_min: 180; + difficulty_it: 'Facile'; + difficulty_en: 'Easy'; + route_type_it: 'Percorso ad anello'; + route_type_en: 'Ring route'; + created_at: '2023-11-02T10:57:41.000000Z'; + updated_at: null; + deleted_at: null; + sport: Sport; } interface Route { id: number; @@ -66,7 +65,7 @@ declare global { description_it: string; description_en: string; route_category_id: number; - created_at: "2023-11-02T10:50:07.000000Z"; + created_at: '2023-11-02T10:50:07.000000Z'; updated_at: null; deleted_at: null; route_sport_details: Array; @@ -74,9 +73,4 @@ declare global { } } } -export { - Route, - Category, - Sport, - SportDetails -}; +export { Route, Category, Sport, SportDetails }; diff --git a/frontend/src/app.html b/frontend/src/app.html index e4dbb90..d6d2042 100644 --- a/frontend/src/app.html +++ b/frontend/src/app.html @@ -1,50 +1,48 @@ - + + + + + + - - - - - + %sveltekit.head% + + - - -
%sveltekit.body%
- + @font-face { + font-family: 'Roboto-Regular'; + src: url('/fonts/roboto/Roboto-Regular.ttf') format('TrueType'); + } + + +
%sveltekit.body%
+ diff --git a/frontend/src/css/app.css b/frontend/src/css/app.css index 7365c98..3ed85b7 100644 --- a/frontend/src/css/app.css +++ b/frontend/src/css/app.css @@ -1,42 +1,41 @@ - :root { - --footer-height: calc(68px + 20px + 20px); - --accent-color: #213c8b; - --pianello-red: #de0e1b; - --pianello-yellow: #f6ae04; - --pianello-blue: #213c8b; - --card-background-color: #f9f4f1; + --footer-height: calc(68px + 20px + 20px); + --accent-color: #213c8b; + --pianello-red: #de0e1b; + --pianello-yellow: #f6ae04; + --pianello-blue: #213c8b; + --card-background-color: #f9f4f1; } * { - box-sizing: border-box; + box-sizing: border-box; } html { - width: 100%; - height: 100%; + width: 100%; + height: 100%; } body { - width: 100%; - height: 100%; - margin: 0px; - background-color: #fff; - font-family: 'Roboto-Regular'; - display: grid; + width: 100%; + height: 100%; + margin: 0px; + background-color: #fff; + font-family: 'Roboto-Regular'; + display: grid; } header, -main, +main, footer { - background: white; - height: 100%; - width: 100%; - display: grid; - place-items: center; + background: white; + height: 100%; + width: 100%; + display: grid; + place-items: center; } @font-face { - font-family: 'Roboto-Regular'; - src: url('/fonts/roboto/Roboto-Regular.ttf') format('TrueType'); -} \ No newline at end of file + font-family: 'Roboto-Regular'; + src: url('/fonts/roboto/Roboto-Regular.ttf') format('TrueType'); +} diff --git a/frontend/src/css/header.css b/frontend/src/css/header.css index 22357fa..26797ee 100644 --- a/frontend/src/css/header.css +++ b/frontend/src/css/header.css @@ -1,13 +1,13 @@ .header { - padding: 15px; - background-color: transparent; - color: black; - margin: 0 auto; - padding-left: 25px; - padding-right: 25px; - width: 100%; - display: flex; - justify-content: space-between; - align-items: center; - height: 70px; + padding: 15px; + background-color: transparent; + color: black; + margin: 0 auto; + padding-left: 25px; + padding-right: 25px; + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + height: 70px; } diff --git a/frontend/src/error.html b/frontend/src/error.html index 02b3e66..670b488 100644 --- a/frontend/src/error.html +++ b/frontend/src/error.html @@ -1,43 +1,41 @@ + + + - #status { - border-right: 1px solid black; - } - p { - padding: 20px; - } - - - - -
-

Code %sveltekit.status%

-

%sveltekit.error.message%

-
- - - \ No newline at end of file + +
+

Code %sveltekit.status%

+

%sveltekit.error.message%

+
+ + diff --git a/frontend/src/hooks.client.ts b/frontend/src/hooks.client.ts index a4f7db3..6f407c6 100644 --- a/frontend/src/hooks.client.ts +++ b/frontend/src/hooks.client.ts @@ -1,10 +1,10 @@ export async function handleError({ error, event, status, message }) { const errorId = crypto.randomUUID(); - console.error(error) + console.error(error); // console.error(event) // console.error(status) return { errorId, message }; -} \ No newline at end of file +} diff --git a/frontend/src/hooks.server.ts b/frontend/src/hooks.server.ts index dd7515c..b9ae6db 100644 --- a/frontend/src/hooks.server.ts +++ b/frontend/src/hooks.server.ts @@ -9,11 +9,11 @@ export async function handleFetch({ request, fetch }) { export async function handleError({ error, event, status, message }) { const errorId = crypto.randomUUID(); - console.error(error) + console.error(error); // console.error(event) // console.error(status) return { errorId, message }; -} \ No newline at end of file +} diff --git a/frontend/src/lib/components/BottomAppBar.svelte b/frontend/src/lib/components/BottomAppBar.svelte index cee78d0..2564a47 100644 --- a/frontend/src/lib/components/BottomAppBar.svelte +++ b/frontend/src/lib/components/BottomAppBar.svelte @@ -30,7 +30,6 @@ box-shadow: 0 0 50px #ccc; background-color: var(--card-background-color); margin: 0 auto; - } #container > a { diff --git a/frontend/src/lib/components/Header.svelte b/frontend/src/lib/components/Header.svelte index f931f89..3a42574 100644 --- a/frontend/src/lib/components/Header.svelte +++ b/frontend/src/lib/components/Header.svelte @@ -1,40 +1,40 @@ -
- - - - - - - - +
+ + + + + + + +
diff --git a/frontend/src/lib/components/HomeHeader.svelte b/frontend/src/lib/components/HomeHeader.svelte index 09b0ca5..c5b0440 100644 --- a/frontend/src/lib/components/HomeHeader.svelte +++ b/frontend/src/lib/components/HomeHeader.svelte @@ -8,7 +8,7 @@ }; -
+
diff --git a/frontend/src/lib/components/Path.svelte b/frontend/src/lib/components/Path.svelte index 090b4ed..efb46fa 100644 --- a/frontend/src/lib/components/Path.svelte +++ b/frontend/src/lib/components/Path.svelte @@ -1,5 +1,5 @@
-
-

{route.title_it}

+
+

{route.title_it}

-
-
Dislivello
+
+
Dislivello

{route.elevation_gain}

diff --git a/frontend/src/lib/components/Splash.svelte b/frontend/src/lib/components/Splash.svelte index 7bb91f7..b00b944 100644 --- a/frontend/src/lib/components/Splash.svelte +++ b/frontend/src/lib/components/Splash.svelte @@ -1,13 +1,13 @@ {#if visible} - splash -
- + splash +
+
{/if} diff --git a/frontend/src/lib/components/Tabs.svelte b/frontend/src/lib/components/Tabs.svelte index 05efb83..9fbc9fe 100644 --- a/frontend/src/lib/components/Tabs.svelte +++ b/frontend/src/lib/components/Tabs.svelte @@ -12,8 +12,8 @@ let component = InfoTabTrekking; onMount(() => { - console.log(route) - }) + console.log(route); + }); const dispatchClick = (c: InfoTabTrekking | InfoTabBike | DescTab | MapTab) => { component = c; dispatch('tab-click', { component }); @@ -21,14 +21,30 @@
- - - - + + + +
@@ -72,7 +88,8 @@ border-bottom: 1px solid black !important; } - #info-bike, #info-trekking { + #info-bike, + #info-trekking { display: flex; justify-content: center; align-items: center; diff --git a/frontend/src/lib/components/tabs/DescTab.svelte b/frontend/src/lib/components/tabs/DescTab.svelte index 3248e63..507ee96 100644 --- a/frontend/src/lib/components/tabs/DescTab.svelte +++ b/frontend/src/lib/components/tabs/DescTab.svelte @@ -1,4 +1,4 @@ - -
+

{$page.status}

{$page.error?.message}

@@ -22,9 +22,9 @@ display: grid; place-content: center; height: 100dvh; - width: 100dvw; - z-index: 99; - position: absolute; + width: 100dvw; + z-index: 99; + position: absolute; font-size: 24px; font-family: monospace; } diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte index 06438fb..661e7e9 100644 --- a/frontend/src/routes/+layout.svelte +++ b/frontend/src/routes/+layout.svelte @@ -8,8 +8,8 @@ let node: HTMLElement; onMount(() => { - if(dev) return; - + if (dev) return; + if ('serviceWorker' in navigator) { addEventListener('load', function () { navigator.serviceWorker.register('/service-worker.js'); @@ -32,8 +32,8 @@ } }); - onNavigate((navigation: { complete: any; }) => { - if (!(document.startViewTransition)) return; + onNavigate((navigation: { complete: any }) => { + if (!document.startViewTransition) return; return new Promise((resolve) => { document?.startViewTransition(async () => { diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index ca1df8f..1bf5326 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -9,7 +9,7 @@
Benvenuti a Pianello Val Tidone
{#each categories as category} - + {/each}
diff --git a/frontend/src/routes/+page.ts b/frontend/src/routes/+page.ts index 2bb37d4..c8f8be8 100644 --- a/frontend/src/routes/+page.ts +++ b/frontend/src/routes/+page.ts @@ -9,7 +9,7 @@ export async function load({ fetch }) { const response = await fetch(`${API_URL}/route-categories`); categories = await response.json(); } catch (ex) { - error(404, { message: 'API Not Found'}); + error(404, { message: 'API Not Found' }); } return { categories }; diff --git a/frontend/src/routes/paths/[slug]/+page.svelte b/frontend/src/routes/paths/[slug]/+page.svelte index 69f1469..e1d7d99 100644 --- a/frontend/src/routes/paths/[slug]/+page.svelte +++ b/frontend/src/routes/paths/[slug]/+page.svelte @@ -1,7 +1,7 @@ diff --git a/frontend/src/routes/paths/[slug]/+page.ts b/frontend/src/routes/paths/[slug]/+page.ts index cb7b2d3..fedf1df 100644 --- a/frontend/src/routes/paths/[slug]/+page.ts +++ b/frontend/src/routes/paths/[slug]/+page.ts @@ -1,27 +1,26 @@ -import { getRouteByCategory, getRouteCategories } from '$lib/repo.js'; import { error } from '@sveltejs/kit'; -import {PUBLIC_BACKEND_URL} from '$env/static/public'; +import { PUBLIC_BACKEND_URL } from '$env/static/public'; const API_URL = `${PUBLIC_BACKEND_URL}/api`; export async function load({ params, fetch }) { - const response = await fetch(`${API_URL}/route-categories`); - const categories: App.Category[] = await response.json(); - const categoryId = Number(params.slug); + const response = await fetch(`${API_URL}/route-categories`); + const categories: App.Category[] = await response.json(); + const categoryId = Number(params.slug); - const category: App.Category = categories.find(c => c.id === categoryId) as App.Category; + const category: App.Category = categories.find((c) => c.id === categoryId) as App.Category; - if (!category) { - error(404); - } + if (!category) { + error(404, { message: 'Path not found' }); + } - const response2 = await fetch(`${API_URL}/route-by-category/${categoryId}`); - const routes = await response2.json(); + const response2 = await fetch(`${API_URL}/route-by-category/${categoryId}`); + const routes = await response2.json(); - const toReturn = { - category: category.name_it, - routes, - } - - return toReturn; -} \ No newline at end of file + const toReturn = { + category: category.name_it, + routes + }; + + return toReturn; +} diff --git a/frontend/src/routes/routes/[slug]/+page.svelte b/frontend/src/routes/routes/[slug]/+page.svelte index 2e413fb..8189fd2 100644 --- a/frontend/src/routes/routes/[slug]/+page.svelte +++ b/frontend/src/routes/routes/[slug]/+page.svelte @@ -8,7 +8,7 @@ let divider: HTMLDivElement; let isMap: boolean = false; - const tabClick = (event) => { + const tabClick = (event) => { isMap = event.detail.component === MapTab; }; @@ -18,7 +18,7 @@
diff --git a/frontend/src/routes/routes/[slug]/+page.ts b/frontend/src/routes/routes/[slug]/+page.ts index 1d4f02d..648b17e 100644 --- a/frontend/src/routes/routes/[slug]/+page.ts +++ b/frontend/src/routes/routes/[slug]/+page.ts @@ -1,16 +1,16 @@ import { error } from '@sveltejs/kit'; -import {PUBLIC_BACKEND_URL} from '$env/static/public' +import { PUBLIC_BACKEND_URL } from '$env/static/public'; -const API_URL = `${PUBLIC_BACKEND_URL}/api` +const API_URL = `${PUBLIC_BACKEND_URL}/api`; export async function load({ params, fetch }) { - const routeId = Number(params.slug); - const response = await fetch(`${API_URL}/route/${routeId}`); - const route = await response.json(); + const routeId = Number(params.slug); + const response = await fetch(`${API_URL}/route/${routeId}`); + const route = await response.json(); - if (!route) { - error(404); - } - - return route; -} \ No newline at end of file + if (!route) { + error(404, { message: 'Route non found' }); + } + + return route; +} diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/settings/+page.svelte index 28922c1..163d304 100644 --- a/frontend/src/routes/settings/+page.svelte +++ b/frontend/src/routes/settings/+page.svelte @@ -1 +1 @@ -Settings \ No newline at end of file +Settings diff --git a/frontend/src/sw.ts b/frontend/src/sw.ts index d7bd8dc..1de7a0d 100644 --- a/frontend/src/sw.ts +++ b/frontend/src/sw.ts @@ -9,76 +9,72 @@ import { build, files, version, prerendered } from '$service-worker'; const CACHE = `sw-cache-${version}`; const ASSETS = [ - ...build, // the app itself - ...files, // everything in `static`, - ...prerendered // dynamic routes + ...build, // the app itself + ...files, // everything in `static`, + ...prerendered // dynamic routes ]; let client; -addEventListener('message', event => { - client = event.source; +addEventListener('message', (event) => { + client = event.source; }); self.addEventListener('install', (event) => { - // Create a new cache and add all files to it - async function addFilesToCache() { - const cache = await caches.open(CACHE); - await cache.addAll(ASSETS); - } + // Create a new cache and add all files to it + async function addFilesToCache() { + const cache = await caches.open(CACHE); + await cache.addAll(ASSETS); + } - event.waitUntil(addFilesToCache()); + event.waitUntil(addFilesToCache()); }); - - - self.addEventListener('activate', (event) => { - // Remove previous cached data from disk - async function deleteOldCaches() { - for (const key of await caches.keys()) { - if (key !== CACHE) await caches.delete(key); - } - } + // Remove previous cached data from disk + async function deleteOldCaches() { + for (const key of await caches.keys()) { + if (key !== CACHE) await caches.delete(key); + } + } - event.waitUntil(deleteOldCaches()); - let channel; - if(BroadcastChannel) { - channel = new BroadcastChannel('sw-messages'); - channel.postMessage({title: 'Cache Downloaded'}); - } else { - client.postMessage("Cache Downloaded") - } + event.waitUntil(deleteOldCaches()); + let channel; + if (BroadcastChannel) { + channel = new BroadcastChannel('sw-messages'); + channel.postMessage({ title: 'Cache Downloaded' }); + } else { + client.postMessage('Cache Downloaded'); + } }); self.addEventListener('fetch', (event) => { - // ignore POST requests etc - if (event.request.method !== 'GET') return; + // ignore POST requests etc + if (event.request.method !== 'GET') return; - async function respond() { - const url = new URL(event.request.url); - const cache = await caches.open(CACHE); + async function respond() { + const url = new URL(event.request.url); + const cache = await caches.open(CACHE); - // `build`/`files` can always be served from the cache - if (ASSETS.includes(url.pathname)) { - return cache.match(url.pathname); - } + // `build`/`files` can always be served from the cache + if (ASSETS.includes(url.pathname)) { + return cache.match(url.pathname); + } - // for everything else, try the network first, but - // fall back to the cache if we're offline - try { - const response = await fetch(event.request); + // for everything else, try the network first, but + // fall back to the cache if we're offline + try { + const response = await fetch(event.request); - if (response.status === 200) { - cache.put(event.request, response.clone()); - } + if (response.status === 200) { + cache.put(event.request, response.clone()); + } - return response; - } catch { - return cache.match(event.request); - } - } + return response; + } catch { + return cache.match(event.request); + } + } - event.respondWith(respond()); + event.respondWith(respond()); }); - diff --git a/frontend/static/manifest.json b/frontend/static/manifest.json index 22ea32e..95b54e8 100644 --- a/frontend/static/manifest.json +++ b/frontend/static/manifest.json @@ -1,47 +1,46 @@ { - "id": "/", - "name": "PianelloExperience", - "short_name": "PianelloExperience", - "start_url": "/", - "display": "standalone", - "background_color": "#fff", - "description": "PianelloExperience", - "icons": [ - { - "src": "images/app-icon-48x48.jpeg", - "sizes": "48x48", - "type": "image/jpeg" - }, - { - "src": "images/app-icon-72x72.jpeg", - "sizes": "72x72", - "type": "image/jpeg" - }, - { - "src": "images/app-icon-96x96.jpeg", - "sizes": "96x96", - "type": "image/jpeg" - }, - { - "src": "images/app-icon-144x144.jpeg", - "sizes": "144x144", - "type": "image/jpeg" - }, - { - "src": "images/app-icon-168x168.jpeg", - "sizes": "168x168", - "type": "image/jpeg" - }, - { - "src": "images/app-icon-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "images/app-icon-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ] - } - \ No newline at end of file + "id": "/", + "name": "PianelloExperience", + "short_name": "PianelloExperience", + "start_url": "/", + "display": "standalone", + "background_color": "#fff", + "description": "PianelloExperience", + "icons": [ + { + "src": "images/app-icon-48x48.jpeg", + "sizes": "48x48", + "type": "image/jpeg" + }, + { + "src": "images/app-icon-72x72.jpeg", + "sizes": "72x72", + "type": "image/jpeg" + }, + { + "src": "images/app-icon-96x96.jpeg", + "sizes": "96x96", + "type": "image/jpeg" + }, + { + "src": "images/app-icon-144x144.jpeg", + "sizes": "144x144", + "type": "image/jpeg" + }, + { + "src": "images/app-icon-168x168.jpeg", + "sizes": "168x168", + "type": "image/jpeg" + }, + { + "src": "images/app-icon-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "images/app-icon-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/frontend/svelte.config.js b/frontend/svelte.config.js index 1c0f35e..d139bc5 100644 --- a/frontend/svelte.config.js +++ b/frontend/svelte.config.js @@ -1,4 +1,4 @@ -import adapter from "@sveltejs/adapter-node"; +import adapter from '@sveltejs/adapter-node'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; /** @type {import('@sveltejs/kit').Config} */ @@ -6,17 +6,17 @@ const config = { preprocess: vitePreprocess(), kit: { files: { - serviceWorker: 'src/sw.ts', + serviceWorker: 'src/sw.ts' }, serviceWorker: { - register: false, + register: false }, adapter: adapter({ fallback: null, precompress: true, strict: true - }), - }, + }) + } }; export default config; diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 70f12ab..91c4a1a 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,22 +1,20 @@ import { sveltekit } from '@sveltejs/kit/vite'; -import adapter from "@sveltejs/adapter-node"; +import adapter from '@sveltejs/adapter-node'; const config = { - plugins: [ - sveltekit(), - ], - test: { - include: ["src/**/*.{test,spec}.{js,ts}"], - }, - build: { - minify: "esbuild", - target: "esnext", - }, - kit: { - adapter: adapter({ - precompress: false, - }) - }, + plugins: [sveltekit()], + test: { + include: ['src/**/*.{test,spec}.{js,ts}'] + }, + build: { + minify: 'esbuild', + target: 'esnext' + }, + kit: { + adapter: adapter({ + precompress: false + }) + } }; export default config;