Added visits table to details

This commit is contained in:
Nicolai Ort 2021-08-16 18:22:41 +02:00
parent 10bccefe77
commit 0d72aba8da
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
1 changed files with 35 additions and 2 deletions

View File

@ -9,7 +9,7 @@
Apiclient.getUrlDetails(shortcode).then((res)=>{ Apiclient.getUrlDetails(shortcode).then((res)=>{
urlDetails=res; urlDetails=res;
}); });
Apiclient.getUrlVisits(shortcode).then((res)=>{ let visitQuery = Apiclient.getUrlVisits(shortcode).then((res)=>{
urlVisists=res; urlVisists=res;
}); });
</script> </script>
@ -25,4 +25,37 @@
{urlDetails.target} {urlDetails.target}
<h2>Visits:</h2> <h2>Visits:</h2>
{urlDetails.visits} {urlDetails.visits}
</div> </div>
<div class="rounded-xl">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50 dark:bg-gray-900 text-gray-800 dark:text-gray-100">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">
Timestamp
</th>
</tr>
</thead>
<tbody class="bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:text-gray-100" x-max="1">
{#await visitQuery}
<tr>
<td
class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-200"
>
Loading data...
</td>
</tr>
{:then}
{#each urlVisists as visit}
<tr>
<td
class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-200"
>
{visit.timestamp}
</td>
</tr>
{/each}
{/await}
</tbody>
</table>
</div>