Compare commits

...

2 Commits

Author SHA1 Message Date
4633a9b3ae i18n fix + more pages 2020-12-19 16:09:22 +01:00
8ff1c55ba4 tmp 2020-12-19 15:38:43 +01:00
10 changed files with 117 additions and 57 deletions

View File

@ -11,7 +11,9 @@
// //
import Login from "./components/Login.svelte"; import Login from "./components/Login.svelte";
import Dashboard from "./components/Dashboard.svelte"; import Dashboard from "./components/Dashboard.svelte";
import Profile from "./components/Profile.svelte"; import Footer from "./components/Footer.svelte";
import Tracks from "./components/Tracks.svelte";
// import Profile from "./components/Profile.svelte";
import store from "./store.js"; import store from "./store.js";
store.init(); store.init();
$: logged_in = $store.isLoggedIn; $: logged_in = $store.isLoggedIn;
@ -19,6 +21,7 @@
{#if logged_in === true} {#if logged_in === true}
<Dashboard /> <Dashboard />
<Footer />
<!-- <Profile /> --> <!-- <Profile /> -->
{:else} {:else}
<Login /> <Login />

View File

@ -1,12 +1,15 @@
<script> <script>
import { _ } from "svelte-i18n";
import StatCards from "./StatCards.svelte"; import StatCards from "./StatCards.svelte";
import Table from "./Table.svelte"; import Table from "./Table.svelte";
import Pagination from "./Pagination.svelte"; import Pagination from "./Pagination.svelte";
import FormLayout from "./FormLayout.svelte"; import FormLayout from "./FormLayout.svelte";
import Tracks from "./Tracks.svelte"; import Tracks from "./Tracks.svelte";
import BreadcrumbNav from "./BreadcrumbNav.svelte"; import BreadcrumbNav from "./BreadcrumbNav.svelte";
import NotFound from "./NotFound.svelte";
// //
let isProfileActionsVisible = false; let isProfileActionsVisible = false;
let mobile_menu_opened = false;
</script> </script>
<div> <div>
@ -131,17 +134,17 @@
<a <a
href="/profile" href="/profile"
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"
role="menuitem">$_('your_profile')</a> role="menuitem">{$_('your_profile')}</a>
<a <a
href="/profile/settings" href="/profile/settings"
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"
role="menuitem">$_('settings')</a> role="menuitem">{$_('settings')}</a>
<a <a
href="/logout" href="/logout"
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"
role="menuitem">$_('sign-out')</a> role="menuitem">{$_('signout')}</a>
</div> </div>
{/if} {/if}
</div> </div>
@ -150,6 +153,9 @@
<div class="-mr-2 flex md:hidden"> <div class="-mr-2 flex md:hidden">
<!-- Mobile menu button --> <!-- Mobile menu button -->
<button <button
on:click={() => {
mobile_menu_opened = !mobile_menu_opened;
}}
class="bg-gray-800 inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-800 focus:ring-white"> class="bg-gray-800 inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-800 focus:ring-white">
<span class="sr-only">Open main menu</span> <span class="sr-only">Open main menu</span>
<!-- <!--
@ -198,11 +204,13 @@
Open: "block", closed: "hidden" Open: "block", closed: "hidden"
--> -->
<div class="hidden md:hidden"> <div
class="md:hidden"
class:block={mobile_menu_opened === true}
class:hidden={mobile_menu_opened === false}>
<div class="px-2 pt-2 pb-3 space-y-1 sm:px-3"> <div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
<!-- Current: "bg-gray-900 text-white", Default: "text-gray-300 hover:bg-gray-700 hover:text-white" -->
<a <a
href="#" href="/"
class="bg-gray-900 text-white block px-3 py-2 rounded-md text-base font-medium">Dashboard</a> class="bg-gray-900 text-white block px-3 py-2 rounded-md text-base font-medium">Dashboard</a>
<a <a
@ -268,27 +276,24 @@
<a <a
href="#" href="#"
class="block px-3 py-2 rounded-md text-base font-medium text-gray-400 hover:text-white hover:bg-gray-700">Sign class="block px-3 py-2 rounded-md text-base font-medium text-gray-400 hover:text-white hover:bg-gray-700">$_('signout')</a>
out</a>
</div> </div>
</div> </div>
</div> </div>
</nav> </nav>
<!-- <header class="bg-white shadow">
<header class="bg-white shadow">
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8"> <div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
<h1 class="text-3xl leading-tight"> <h1 class="text-3xl leading-tight">
<span class="font-bold">Dashboard</span><span> - hello there 👋</span> <span class="font-bold">Dashboard</span><span> - hello there 👋</span>
</h1> </h1>
</div> </div>
</header> </header> -->
<div class="shadow px-6 pt-4 pb-1">
<BreadcrumbNav />
</div>
<main> <main>
<div class="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8"> <div class="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
<BreadcrumbNav/>
<!-- -->
<StatCards /> <StatCards />
<!-- -->
<div class="mb-8"> <div class="mb-8">
<Tracks /> <Tracks />
</div> </div>
@ -296,9 +301,53 @@
<div class="mb-8"> <div class="mb-8">
<Table /> <Table />
</div> </div>
<!-- -->
<div
class="widget w-full p-4 mb-4 rounded-lg bg-white border border-grey-100 dark:bg-grey-895 dark:border-grey-890">
<div class="flex flex-row items-center justify-between mb-6">
<div class="flex flex-col">
<div class="text-sm font-light text-grey-500">Regular</div>
<div class="text-sm font-bold"><span>Text inputs</span></div>
</div>
</div>
<div class="flex flex-col lg:flex-row lg:flex-wrap w-full lg:space-x-4">
<div class="w-full lg:w-1/4">
<div class="form-element ">
<div class="form-label">Label</div><input
name="name"
type="text"
class="form-input"
placeholder="Enter something..." />
<div class="form-hint">This is a hint</div>
</div>
</div>
<div class="w-full lg:w-1/4">
<div class="form-element ">
<div class="form-label">First name</div><input
name="name"
type="text"
class="form-input form-input-invalid"
placeholder="john@example.com" />
<div class="form-error">First name is required</div>
</div>
</div>
<div class="w-full lg:w-1/4">
<div class="form-element ">
<div class="form-label">First name</div><input
name="name"
type="text"
class="form-input form-input-valid"
placeholder="john@example.com" />
<div class="form-success">First name is valid</div>
</div>
</div>
</div>
</div>
<!-- -->
<div class="mb-8"> <div class="mb-8">
<FormLayout /> <FormLayout />
</div> </div>
<NotFound />
</div> </div>
</main> </main>
</div> </div>

View File

@ -0,0 +1,13 @@
<script>
import { _ } from "svelte-i18n";
</script>
<footer class="text-gray-700 body-font">
<div
class="container px-5 py-8 mx-auto flex items-center sm:flex-row flex-col">
<p
class="text-sm text-gray-500 sm:ml-4 sm:pl-4 sm:py-2 sm:mt-0 mt-4">
proudly powered by <a class="underline" href="https://odit.services" rel="noopener,noreferrer" target="_blank">ODIT.Services</a>
</p>
</div>
</footer>

View File

@ -1,11 +1,11 @@
<script> <script>
import { _ } from "svelte-i18n"; import { _ } from "svelte-i18n";
import store from "../store.js"; import store from "../store.js";
store.init();
// //
import { OpenAPI, AuthService, TrackService } from "@odit/lfk-client-js"; import { OpenAPI, AuthService } from "@odit/lfk-client-js";
OpenAPI.BASE = "http://localhost:4010"; OpenAPI.BASE = "http://localhost:4010";
// //
store.init();
// //
import Toastify from "toastify-js"; import Toastify from "toastify-js";
import "toastify-js/src/toastify.css"; import "toastify-js/src/toastify.css";
@ -19,7 +19,7 @@
last_loginclick_processed = false; last_loginclick_processed = false;
Toastify({ Toastify({
text: $_("login_is_checked"), text: $_("login_is_checked"),
duration: 1500, duration: 500,
}).showToast(); }).showToast();
console.log(usersUsername); console.log(usersUsername);
console.log(usersPassword); console.log(usersPassword);
@ -34,14 +34,14 @@
store.login(result.access_token); store.login(result.access_token);
Toastify({ Toastify({
text: $_("welcome_wavinghand"), text: $_("welcome_wavinghand"),
duration: 1500, duration: 500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
}) })
.catch((err) => { .catch((err) => {
Toastify({ Toastify({
text: $_("error_on_login"), text: $_("error_on_login"),
duration: 1500, duration: 500,
backgroundColor: backgroundColor:
"linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)", "linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)",
}).showToast(); }).showToast();
@ -64,11 +64,12 @@
<div class="min-h-screen flex items-center justify-center bg-gray-100"> <div class="min-h-screen flex items-center justify-center bg-gray-100">
<div class="max-w-md w-full py-12 px-6"> <div class="max-w-md w-full py-12 px-6">
<img <img
class="mx-auto h-20 w-auto" style="height:10rem;"
class="mx-auto"
src="https://lauf-fuer-kaya.de/Bilder/kaya-logo-quadrat.png" src="https://lauf-fuer-kaya.de/Bilder/kaya-logo-quadrat.png"
alt="" /> alt="" />
<p class="mt-6 text-lg text-center font-bold text-gray-900"> <p class="mt-6 text-lg text-center font-bold text-gray-900">
{$_('log_in_to_your_account')} {$_('application_name')}
</p> </p>
<p class="mt-6 text-sm text-center text-gray-900"> <p class="mt-6 text-sm text-center text-gray-900">
{$_('log_in_to_your_account')} {$_('log_in_to_your_account')}

View File

@ -1,16 +1,21 @@
<script>
import { _ } from "svelte-i18n";
</script>
<body class="antialiased font-sans"> <body class="antialiased font-sans">
<div class="md:flex min-h-screen"> <div class="md:flex min-h-screen">
<div class="w-full md:w-1/2 bg-white flex items-center justify-center "> <div class="w-full md:w-1/2 bg-white flex items-center justify-center ">
<div class="max-w-sm m-8"> <div class="max-w-sm m-8">
<div class="text-black text-5xl md:text-15xl font-black">404</div> <div class="text-black text-5xl md:text-15xl font-black">
{$_('404title')}
</div>
<div class="w-16 h-1 bg-purple-light my-3 md:my-6" /> <div class="w-16 h-1 bg-purple-light my-3 md:my-6" />
<p <p
class="text-grey-darker text-2xl md:text-3xl font-light mb-8 leading-normal"> class="text-grey-darker text-2xl md:text-3xl font-light mb-8 leading-normal">
Sorry, the page you are looking for could not be found. {$_('404message')}
</p> </p>
<button <button
class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">Go class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">{$_('goback')}</button>
Home</button>
</div> </div>
</div> </div>
<div <div

View File

@ -0,0 +1,5 @@
<script>
import { _, locale } from "svelte-i18n";
</script>
<div>$locale $_('hallo')</div>

View File

@ -1,22 +0,0 @@
<script>
import { OpenAPI, TrackService } from "@odit/lfk-client-js";
OpenAPI.BASE = "http://localhost:4010";
let tracks_promise = TrackService.trackControllerGetAll();
</script>
<h1>Tracks</h1>
{#await tracks_promise then tracks}
<h4>{tracks.length}</h4>
<hr />
{#if tracks.length % 2 == 0}
<ul>
{#each tracks as item}
<li>{item.distance}</li>
{/each}
</ul>
{:else}
{#each tracks as item}<span>{item.distance}</span><br />{/each}
{/if}
{:catch error}
ERORRRRR
{/await}

View File

@ -1,10 +1,11 @@
<script> <script>
import { OpenAPI, TrackService } from "@odit/lfk-client-js"; import { _ } from "svelte-i18n";
OpenAPI.BASE = "http://localhost:4010"; import store from "../store.js";
import { TrackService } from "@odit/lfk-client-js";
let tracks_promise = TrackService.trackControllerGetAll(); let tracks_promise = TrackService.trackControllerGetAll();
</script> </script>
<h1>Tracks</h1> <h1>{$_('tracks')}</h1>
{#await tracks_promise} {#await tracks_promise}
<div <div
class="bg-teal-lightest border-t-4 border-teal rounded-b text-teal-darkest px-4 py-3 shadow-md my-2" class="bg-teal-lightest border-t-4 border-teal rounded-b text-teal-darkest px-4 py-3 shadow-md my-2"
@ -14,7 +15,6 @@
</div> </div>
{:then tracks} {:then tracks}
{#if tracks.length > 0} {#if tracks.length > 0}
<!-- content here -->
<h4>{tracks.length}</h4> <h4>{tracks.length}</h4>
<hr /> <hr />
<ul> <ul>

View File

@ -6,8 +6,8 @@
"welcome_wavinghand": "Willkommen 👋", "welcome_wavinghand": "Willkommen 👋",
"error_on_login": "😢Fehler beim Login", "error_on_login": "😢Fehler beim Login",
"settings": "Einstellungen", "settings": "Einstellungen",
"sign-out": "Abmelden",
"your_profile": "Dein Profil", "your_profile": "Dein Profil",
"password": "Passwort", "password": "Passwort",
"email_address_or_username": "E-Mail-Addresse/ Benutzername" "email_address_or_username": "E-Mail-Addresse/ Benutzername",
"signout": "Abmelden"
} }

View File

@ -8,7 +8,13 @@
"login_is_checked": "Login is being checked...", "login_is_checked": "Login is being checked...",
"error_on_login": "Error on login", "error_on_login": "Error on login",
"settings": "Settings", "settings": "Settings",
"sign-out": "Sign out",
"your_profile": "Your Profile", "your_profile": "Your Profile",
"email_address_or_username": "Email / username" "email_address_or_username": "Email / username",
"tracks": "Tracks",
"signout": "Sign out",
"hallo": "hallo",
"404message": "Sorry, the page you are looking for could not be found.",
"404title": "Error 404",
"goback": "Go Home",
"application_name": "Lauf für Kaya! - Admin"
} }