Compare commits

..

No commits in common. "48ddc621921f796a02c0bf74d5721a7851cd1523" and "b1114634e804b0f41b80c87afa6903ffc17f575c" have entirely different histories.

5 changed files with 39 additions and 55 deletions

View File

@ -1,42 +1,16 @@
<script>
import { _ } from "svelte-i18n";
import { onMount } from "svelte";
let trackname_input;
let trackname_input_value;
let tracklength;
import { TrackService } from "@odit/lfk-client-js";
export let modal_open;
let processed_last_submit = true;
import Toastify from "toastify-js";
import "toastify-js/src/toastify.css";
onMount(() => {
// trackname_input.focus();
});
function submit() {
if (processed_last_submit === true) {
processed_last_submit = false;
const toast = Toastify({
text: $_("track-is-being-added"),
duration: -1,
}).showToast();
TrackService.trackControllerPost({
distance: parseInt(tracklength),
name: trackname_input_value,
})
.then((result) => {
console.log(result);
Toastify({
text: $_("track-added"),
duration: 500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast();
modal_open = false;
})
.catch((err) => {
//
})
.finally(() => {
processed_last_submit = true;
//
toast.hideToast();
});
}
console.log(trackname_input_value);
console.log(tracklength);
}
</script>
@ -44,12 +18,34 @@
<div class="fixed z-10 inset-0 overflow-y-auto">
<div
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<!--
Background overlay, show/hide based on modal state.
Entering: "ease-out duration-300"
From: "opacity-0"
To: "opacity-100"
Leaving: "ease-in duration-200"
From: "opacity-100"
To: "opacity-0"
-->
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
<div class="absolute inset-0 bg-gray-500 opacity-75" />
</div>
<!-- This element is to trick the browser into centering the modal contents. -->
<span
class="hidden sm:inline-block sm:align-middle sm:h-screen"
aria-hidden="true">&#8203;</span>
<!--
Modal panel, show/hide based on modal state.
Entering: "ease-out duration-300"
From: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
To: "opacity-100 translate-y-0 sm:scale-100"
Leaving: "ease-in duration-200"
From: "opacity-100 translate-y-0 sm:scale-100"
To: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
-->
<div
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
role="dialog"
@ -59,6 +55,7 @@
<div class="sm:flex sm:items-start">
<div
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
<!-- Heroicon name: exclamation -->
<svg
class="h-6 w-6 text-blue-600"
xmlns="http://www.w3.org/2000/svg"

View File

@ -4,21 +4,14 @@
import { TrackService } from "@odit/lfk-client-js";
const tracks_promise = TrackService.trackControllerGetAll();
import { getlang } from "./datatable_i18n";
import { Grid, html } from "gridjs";
import { Grid } from "gridjs";
import "gridjs/dist/theme/mermaid.css";
//
let table;
tracks_promise.then((data) => {
let tabledata = [];
data.forEach((track) => {
tabledata.push([
track.name,
track.distance,
html(`
<button class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-400 text-base font-medium text-white sm:w-auto sm:text-sm">Edit</button>
<button class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-500 text-base font-medium text-white sm:w-auto sm:text-sm">Delete</button>
`),
]);
tabledata.push([track.name, track.distance, "TODO: edit,delete"]);
});
const datatable = new Grid({
columns: [$_("track-name"), $_("track-length-in-m"), "Action"],

View File

@ -1,7 +1,14 @@
<script>
import { _ } from "svelte-i18n";
import store from "../store.js";
import { TrackService } from "@odit/lfk-client-js";
import AddTrackModal from "./AddTrackModal.svelte";
let tracks_promise = TrackService.trackControllerGetAll();
let modal_open = false;
function getNewID() {
console.log("got new id");
return Date.now();
}
</script>
<div class="text-center items-center justify-center">

View File

@ -1,25 +1,14 @@
<script>
import { _ } from "svelte-i18n";
import AddTrackModal from "./AddTrackModal.svelte";
let modal_open = false;
import Tracks from "./Tracks.svelte";
</script>
<section class="container py-10 mx-auto sm:px-2">
<span class="mb-1 text-3xl font-extrabold leading-tight text-gray-900">
Tracks
<button
on:click={() => {
modal_open = true;
}}
type="button"
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
Create Track
</button>
</span>
<p class="mb-16 text-lg text-gray-500">
configure the tracks/ min-max lap times
</p>
<Tracks />
</section>
<AddTrackModal bind:modal_open />

View File

@ -59,7 +59,5 @@
"please-provide-the-required-information-to-add-a-new-track": "Please provide the required information to add a new track.",
"create-a-new-track": "Create a new Track",
"dashboard-greeting": "hello there",
"dashboard-title": "Dashboard",
"track-added": "Track added",
"track-is-being-added": "Track is being added..."
"dashboard-title": "Dashboard"
}