diff --git a/app/index.html b/app/index.html index 5c50b53..506820a 100644 --- a/app/index.html +++ b/app/index.html @@ -1,16 +1,14 @@ + + + + LfK!Scan + + + - - - - LfK!Scan - - - - - - - - - \ No newline at end of file + + + + diff --git a/app/package.json b/app/package.json index 7248b19..bf9d136 100644 --- a/app/package.json +++ b/app/package.json @@ -3,7 +3,8 @@ "version": "0.0.0", "scripts": { "dev": "vite", - "build": "vite build" + "build": "vite build", + "format": "prettier --write --plugin-search-dir=. ./**/*.html ./**/*.svelte" }, "devDependencies": { "@svitejs/vite-plugin-svelte": "^0.11.0", @@ -12,6 +13,8 @@ "axios": "^0.21.1", "glob": "^7.1.6", "html-minifier": "^4.0.0", + "prettier": "^2.2.1", + "prettier-plugin-svelte": "^2.2.0", "svelte": "^3.35.0", "svelte-preprocess": "^4.6.9", "vite": "^2.0.5", diff --git a/app/src/App.svelte b/app/src/App.svelte index 21ed02a..cd24a9f 100644 --- a/app/src/App.svelte +++ b/app/src/App.svelte @@ -1,18 +1,17 @@ -{#if settings_open&&is_configured} - -{:else} - {#if is_configured} - - {:else} - - {/if} -{/if} \ No newline at end of file + import Scanner from "./Scanner.svelte"; + import Login from "./Login.svelte"; + import Settings from "./Settings.svelte"; + import { apikey, lang, page } from "./store.js"; + $: is_configured = $apikey !== "null" && $apikey !== ""; + $: settings_open = $page === "settings"; + console.log($page); + + +{#if settings_open && is_configured} + +{:else if is_configured} + +{:else} + +{/if} diff --git a/app/src/Login.svelte b/app/src/Login.svelte index 4cf91ed..40febb9 100644 --- a/app/src/Login.svelte +++ b/app/src/Login.svelte @@ -1,98 +1,166 @@ -
- - -
- -
-
LfK!Scan
-
- -
-

Configuration

-

Please provide the scan client token.
See our configuration guide.

-
- { - // TODO: validate token with backend api - console.log(token); - apikey.set(token) - }}> -
- - -
- {#if !isTokenValid} - Please provide a valid client token... - {/if} - -
-
-

- - powered by ODIT.Services.

-
-
- -
-
- -
-
- -
-
- -
- - -
- -
-
- \ No newline at end of file + } + + +
+ +
+
+
+ + LfK!Scan +
+
+ +
+

Configuration

+

+ Please provide the scan client token.
See our configuration guide. +

+
{ + // TODO: validate token with backend api + console.log(token); + apikey.set(token); + }} + > +
+ + +
+ {#if !isTokenValid} + Please provide a valid client token... + {/if} + +
+
+

+ + + powered by ODIT.Services. +

+
+
+ +
+
+ +
+
+ +
+
+
+ + +
+ +
+
diff --git a/app/src/Scanner.svelte b/app/src/Scanner.svelte index 6cfc7c2..741dc92 100644 --- a/app/src/Scanner.svelte +++ b/app/src/Scanner.svelte @@ -1,61 +1,81 @@ + +
-

Lauf Für Kaya! Scan 📷

-

{hours}:{minutes}:{seconds}

-
-
-
- { - if(card==="cnf"){ - page.set("settings"); - }else{ - console.log(card); - //TODO: hit API for scan entry - lastscan_totaldistance="400m"; - let time = new Date(); - const hours = (time.getHours()+"").padStart(2,"0"); - const minutes = (time.getMinutes()+"").padStart(2,"0"); - const seconds = (time.getSeconds()+"").padStart(2,"0"); - lastscan_time=hours+":"+minutes+":"+seconds; - lastscan_laptime="1min 30s"; - } - card=""; - }}> - {#if lastscan_totaldistance} -

last scan

-

{lastscan_time}

-

total distance

-

{lastscan_totaldistance}

-

lap time

-

{lastscan_laptime}

- {:else} -

please scan a card...

- {/if} +

+ Lauf Für Kaya! Scan 📷 +

+

+ {hours}:{minutes}:{seconds} +

+
+
+ { + if (card === "cnf") { + page.set("settings"); + } else { + console.log(card); + //TODO: hit API for scan entry + lastscan_totaldistance = "400m"; + let time = new Date(); + const hours = (time.getHours() + "").padStart(2, "0"); + const minutes = (time.getMinutes() + "").padStart(2, "0"); + const seconds = (time.getSeconds() + "").padStart(2, "0"); + lastscan_time = hours + ":" + minutes + ":" + seconds; + lastscan_laptime = "1min 30s"; + } + card = ""; + }} + > + {#if lastscan_totaldistance} +

last scan

+

{lastscan_time}

+

total distance

+

+ {lastscan_totaldistance} +

+

lap time

+

{lastscan_laptime}

+ {:else} +

please scan a card...

+ {/if} - + +
+
-
-
- - \ No newline at end of file diff --git a/app/src/Settings.svelte b/app/src/Settings.svelte index c6e8145..bed35a9 100644 --- a/app/src/Settings.svelte +++ b/app/src/Settings.svelte @@ -1,48 +1,85 @@ -
-

Lauf Für Kaya! Scan 📷

-

Settings

-

API Key

-

{$apikey}

-
-

Language

-
-
- -
-
- -
-
-
- - -
\ No newline at end of file + import { apikey, lang, page } from "./store.js"; + + +
+

+ Lauf Für Kaya! Scan 📷 +

+

Settings

+

API Key

+

{$apikey}

+
+

Language

+
+
+ +
+
+ +
+
+
+ + +