basic lap/ scans ui

ref #11
This commit is contained in:
Philipp Dormann 2021-03-07 14:04:29 +01:00
parent 8205c11bd9
commit 14369480ea
2 changed files with 53 additions and 51 deletions

View File

@ -121,7 +121,10 @@
<section class="text-gray-400 dark:bg-gray-900 body-font">
<div class="container mx-auto">
<div class="lg:w-2/3 w-full mx-auto overflow-auto">
<table class="table-auto w-full text-left whitespace-no-wrap">
<table
v-if="state.scans.length > 0"
class="table-auto w-full text-left whitespace-no-wrap"
>
<thead
class="text-black bg-gray-300 dark:text-white text-sm dark:bg-gray-800"
>
@ -135,24 +138,15 @@
</tr>
</thead>
<tbody class="text-gray-900 dark:text-gray-50">
<tr class="border-t-2 border-gray-800">
<td class="px-4 py-3">400m</td>
<td class="px-4 py-3">0min 57s</td>
</tr>
<tr class="border-t-2 border-gray-800">
<td class="px-4 py-3">400m</td>
<td class="px-4 py-3">1min 15s</td>
</tr>
<tr class="border-t-2 border-gray-800">
<td class="px-4 py-3">1km</td>
<td class="px-4 py-3">2min 50s</td>
</tr>
<tr class="border-t-2 border-gray-800">
<td class="px-4 py-3">1km</td>
<td class="px-4 py-3">3min 00s</td>
<tr v-for="s in state.scans" :key="s.id">
<td class="px-4 py-3">s.distance</td>
<td class="px-4 py-3">s.time</td>
</tr>
</tbody>
</table>
<div v-else class="text-center font-bold text-black dark:text-white text-2xl">
{{ $t('no_laps_scans_were_recorded_yet') }}
</div>
</div>
</div>
</section>
@ -181,6 +175,7 @@ const state = reactive({
firstname: "",
middlename: "",
lastname: "",
scans: []
})
let activetab = ref("profile");
const toast = useToast();
@ -195,4 +190,10 @@ axios.get(`${config.baseurl}api/runners/me/${token}`)
}).catch((error) => {
toast.error("An error occured while loading your profile data");
})
axios.get(`${config.baseurl}api/runners/me/${token}/scans`)
.then(({ data }) => {
state.scans = data;
}).catch((error) => {
toast.error("An error occured while loading your profile data");
})
</script>

View File

@ -32,5 +32,6 @@
"the_system_is_not_properly_configured_please_contact_the_system_administrator_for_help": "The system is not properly configured. Please contact the system administrator for help.",
"this_is_not_a_valid_international_phone_number": "This is not a valid international phone number",
"view_my_data": "View my data",
"vorname": "Firstname"
"vorname": "Firstname",
"no_laps_scans_were_recorded_yet": "No laps/ scans were recorded yet..."
}