[fix] map concurrency issue, [add] better logging, [add] activity template, [fix] safari redirect issue, [add] timezone framework

This commit is contained in:
2023-09-20 20:35:01 -04:00
parent 240b3a2b67
commit f2163c8fd9
13 changed files with 368 additions and 202 deletions

View File

@@ -1,4 +1,56 @@
{{template "base.html" .}} {{define "title"}}Activity{{end}} {{define
"content"}}
<h1>Activity</h1>
<div class="px-4 -mx-4 overflow-x-auto">
<div class="inline-block min-w-full overflow-hidden rounded shadow">
<table class="min-w-full leading-normal bg-white dark:bg-gray-700 text-xs">
<thead class="text-gray-800 dark:text-gray-400">
<tr>
<th
scope="col"
class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800"
>
Document
</th>
<th
scope="col"
class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800"
>
Time
</th>
<th
scope="col"
class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800"
>
Duration
</th>
<th
scope="col"
class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800"
>
Page
</th>
</tr>
</thead>
<tbody class="text-black dark:text-white">
{{range $activity := .Data }}
<tr>
<td class="p-3 border-b border-gray-200">
<p>{{ $activity.Author }} - {{ $activity.Title }}</p>
</td>
<td class="p-3 border-b border-gray-200">
<p>{{ $activity.StartTime }}</p>
</td>
<td class="p-3 border-b border-gray-200">
<p>{{ $activity.Duration }}</p>
</td>
<td class="p-3 border-b border-gray-200">
<p>{{ $activity.CurrentPage }} / {{ $activity.TotalPages }}</p>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
{{end}}

View File

@@ -11,9 +11,28 @@
class="relative h-screen overflow-hidden bg-gray-100 dark:bg-gray-800"
>
<div class="flex items-start justify-between">
<div class="relative hidden h-screen shadow-lg lg:block w-64">
<input type="checkbox" id="mobile-nav-button" class="hidden"/>
<div class="fixed -left-64 duration-500 transition-all w-56 z-50 h-screen shadow-lg lg:left-0 lg:block lg:relative">
<div class="h-full bg-white dark:bg-gray-700">
<div class="flex items-center justify-start pt-4 ml-8">
<div class="flex items-center justify-center gap-4 h-16">
<label
id="mobile-nav-close-button"
for="mobile-nav-button"
class="flex block items-center p-2 text-gray-500 bg-white rounded-full shadow text-md cursor-pointer lg:hidden"
>
<svg
width="20"
height="20"
class="text-gray-400"
fill="currentColor"
viewBox="0 0 1792 1792"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M1664 1344v128q0 26-19 45t-45 19h-1408q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1408q26 0 45 19t19 45zm0-512v128q0 26-19 45t-45 19h-1408q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1408q26 0 45 19t19 45zm0-512v128q0 26-19 45t-45 19h-1408q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1408q26 0 45 19t19 45z"
></path>
</svg>
</label>
<p class="text-xl font-bold dark:text-white">Book Manager</p>
</div>
<nav class="mt-6">
@@ -100,8 +119,9 @@
<div class="flex flex-col w-full">
<header class="z-40 flex items-center justify-between w-full h-16">
<div class="block ml-6 lg:hidden">
<button
class="flex items-center p-2 text-gray-500 bg-white rounded-full shadow text-md"
<label
for="mobile-nav-button"
class="flex items-center p-2 text-gray-500 bg-white rounded-full shadow text-md cursor-pointer"
>
<svg
width="20"
@@ -115,67 +135,71 @@
d="M1664 1344v128q0 26-19 45t-45 19h-1408q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1408q26 0 45 19t19 45zm0-512v128q0 26-19 45t-45 19h-1408q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1408q26 0 45 19t19 45zm0-512v128q0 26-19 45t-45 19h-1408q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1408q26 0 45 19t19 45z"
></path>
</svg>
</button>
</label>
</div>
<h1 class="text-xl font-bold dark:text-white px-6">{{block "title" .}}{{end}}</h1>
<div
class="relative flex items-center justify-end w-full p-4 space-x-4"
>
<a href="#" class="relative block">
<svg
width="20"
fill="currentColor"
height="20"
class="text-gray-800 dark:text-gray-200"
viewBox="0 0 1792 1792"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M1523 1339q-22-155-87.5-257.5t-184.5-118.5q-67 74-159.5 115.5t-195.5 41.5-195.5-41.5-159.5-115.5q-119 16-184.5 118.5t-87.5 257.5q106 150 271 237.5t356 87.5 356-87.5 271-237.5zm-243-699q0-159-112.5-271.5t-271.5-112.5-271.5 112.5-112.5 271.5 112.5 271.5 271.5 112.5 271.5-112.5 112.5-271.5zm512 256q0 182-71 347.5t-190.5 286-285.5 191.5-349 71q-182 0-348-71t-286-191-191-286-71-348 71-348 191-286 286-191 348-71 348 71 286 191 191 286 71 348z"
/>
</svg>
</a>
<button
class="custom-profile-button flex items-center text-gray-500 dark:text-white text-md py-4"
>
{{ .User }}
<svg
width="20"
height="20"
class="ml-2 text-gray-400"
fill="currentColor"
height="20"
class="text-gray-800 dark:text-gray-200"
viewBox="0 0 1792 1792"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M1408 704q0 26-19 45l-448 448q-19 19-45 19t-45-19l-448-448q-19-19-19-45t19-45 45-19h896q26 0 45 19t19 45z"
></path>
d="M1523 1339q-22-155-87.5-257.5t-184.5-118.5q-67 74-159.5 115.5t-195.5 41.5-195.5-41.5-159.5-115.5q-119 16-184.5 118.5t-87.5 257.5q106 150 271 237.5t356 87.5 356-87.5 271-237.5zm-243-699q0-159-112.5-271.5t-271.5-112.5-271.5 112.5-112.5 271.5 112.5 271.5 271.5 112.5 271.5-112.5 112.5-271.5zm512 256q0 182-71 347.5t-190.5 286-285.5 191.5-349 71q-182 0-348-71t-286-191-191-286-71-348 71-348 191-286 286-191 348-71 348 71 286 191 191 286 71 348z"
/>
</svg>
</button>
<div
class="custom-profile-dropdown transition duration-200 absolute right-4 top-16 pt-4"
>
</a>
<input type="checkbox" id="user-dropdown-button" class="hidden"/>
<div
id="user-dropdown"
class="transition duration-200 absolute right-4 top-16 pt-4"
>
<div
class="w-56 origin-top-right bg-white rounded-md shadow-lg dark:shadow-gray-800 dark:bg-gray-700 ring-1 ring-black ring-opacity-5"
>
<div
class="w-56 origin-top-right bg-white rounded-md shadow-lg dark:shadow-gray-800 dark:bg-gray-700 ring-1 ring-black ring-opacity-5"
class="py-1"
role="menu"
aria-orientation="vertical"
aria-labelledby="options-menu"
>
<div
class="py-1"
role="menu"
aria-orientation="vertical"
aria-labelledby="options-menu"
<a
href="/logout"
class="block block px-4 py-2 text-md text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-100 dark:hover:text-white dark:hover:bg-gray-600"
role="menuitem"
>
<a
href="/logout"
class="block block px-4 py-2 text-md text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-100 dark:hover:text-white dark:hover:bg-gray-600"
role="menuitem"
>
<span class="flex flex-col">
<span>Logout</span>
</span>
</a>
</div>
<span class="flex flex-col">
<span>Logout</span>
</span>
</a>
</div>
</div>
</div>
<label for="user-dropdown-button">
<div
class="flex items-center text-gray-500 dark:text-white text-md py-4 cursor-pointer"
>
{{ .User }}
<svg
width="20"
height="20"
class="ml-2 text-gray-400"
fill="currentColor"
viewBox="0 0 1792 1792"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M1408 704q0 26-19 45l-448 448q-19 19-45 19t-45-19l-448-448q-19-19-19-45t19-45 45-19h896q26 0 45 19t19 45z"
></path>
</svg>
</div>
</label>
</div>
</header>
<div class="h-screen px-4 pb-24 overflow-auto md:px-6">
@@ -187,16 +211,26 @@
<!-- Custom Animation CSS -->
<style>
.custom-profile-dropdown {
visibility: hidden;
opacity: 0;
/* ----------------------------- */
/* ------ Navigation Slide ----- */
/* ----------------------------- */
#mobile-nav-button:checked + div {
left: 0px;
}
.custom-profile-button:hover + .custom-profile-dropdown,
.custom-profile-dropdown:hover {
/* ----------------------------- */
/* ------- User Dropdown ------- */
/* ----------------------------- */
#user-dropdown-button:checked + #user-dropdown {
visibility: visible;
opacity: 1;
}
#user-dropdown {
visibility: hidden;
opacity: 0;
}
</style>
</body>
</html>

View File

@@ -1,12 +1,12 @@
{{template "base.html" .}} {{define "title"}}Documents{{end}} {{define
"content"}}
<div class="grid grid-cols-1 gap-4 my-4 md:grid-cols-2 lg:grid-cols-3">
<div class="grid grid-cols-1 gap-4 mb-4 md:grid-cols-2 lg:grid-cols-3">
{{range $doc := .Data }}
<div class="w-full">
<div class="flex gap-4 w-full p-4 bg-white shadow-lg dark:bg-gray-700 rounded">
<div class="min-w-fit h-48 relative">
<a href="./documents/{{$doc.ID}}/file">
<img class="rounded object-cover h-full w-full" src="./documents/{{$doc.ID}}/cover"></img>
<img class="rounded object-cover h-full" src="./documents/{{$doc.ID}}/cover"></img>
</a>
</div>
<div class="flex flex-col justify-around dark:text-white w-full text-xs">

View File

@@ -1,15 +1,22 @@
{{template "base.html" .}} {{define "title"}}Home{{end}} {{define "content"}}
<div class="w-full">
<div class="relative w-full px-4 py-4 bg-white shadow-lg dark:bg-gray-700">
<div
class="relative w-full px-4 py-4 bg-white shadow-lg dark:bg-gray-700 rounded"
>
<p
class="text-sm font-semibold text-gray-700 border-b border-gray-200 w-max dark:text-white dark:border-gray-500"
class="absolute top-3 text-sm font-semibold text-gray-700 border-b border-gray-200 w-max dark:text-white dark:border-gray-500"
>
Daily Read Totals
</p>
{{ $data := (GetSVGGraphData .Data.GraphData 800 70 )}}
<svg viewBox="0 0 {{ $data.Width }} {{ $data.Height }}">
<svg
viewBox="26 0 755 {{ $data.Height }}"
preserveAspectRatio="none"
width="100%"
height="4em"
>
<!-- Bezier Line Graph -->
<path
fill="#316BBE"
@@ -147,7 +154,9 @@
<div class="grid grid-cols-1 gap-4 my-4 md:grid-cols-2 lg:grid-cols-3">
<div class="w-full">
<div class="relative w-full px-4 py-6 bg-white shadow-lg dark:bg-gray-700">
<div
class="relative w-full px-4 py-6 bg-white shadow-lg dark:bg-gray-700 rounded"
>
<p
class="text-sm font-semibold text-gray-700 border-b border-gray-200 w-max dark:text-white dark:border-gray-500"
>
@@ -190,7 +199,9 @@
</div>
<div class="w-full">
<div class="relative w-full px-4 py-6 bg-white shadow-lg dark:bg-gray-700">
<div
class="relative w-full px-4 py-6 bg-white shadow-lg dark:bg-gray-700 rounded"
>
<p
class="text-sm font-semibold text-gray-700 border-b border-gray-200 w-max dark:text-white dark:border-gray-500"
>