301 lines
17 KiB
HTML
Executable File
301 lines
17 KiB
HTML
Executable File
<head>
|
|
<script>
|
|
(() => {
|
|
const theme = localStorage.getItem('theme');
|
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
|
|
if (theme === 'dark' || (!theme && prefersDark)) {
|
|
document.documentElement.classList.add('dark');
|
|
}
|
|
})();
|
|
</script>
|
|
<style>
|
|
html {
|
|
background-color: #030712;
|
|
transition: background-color 0.7s ease;
|
|
}
|
|
|
|
html:not(.dark) {
|
|
background-color: #ffffff;
|
|
}
|
|
|
|
[x-cloak] {
|
|
display: none !important;
|
|
}
|
|
</style>
|
|
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>bookmeterplus Project</title>
|
|
</head>
|
|
<body class="dark:text-gray-300 dark:bg-gray-950">
|
|
|
|
|
|
<div x-data="bookmeterList">
|
|
<!-- <div class="p-10">-->
|
|
<!-- <div class="chart-container" style="position: relative; height:30vh; width:80vw">-->
|
|
<!-- <canvas id="statsChart" height="100px"></canvas>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="chart-container" style="position: relative; height:50vh; width:80vw">-->
|
|
<!-- <canvas id="chartPoints" height="100px"></canvas>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <button @click="updatechartnew()" class="text-red-500">click me</button>-->
|
|
<div x-cloak>
|
|
<form class="flex items-center m-2" x-show="!advancedSearch">
|
|
<div class="relative w-full d-block max-w-md ">
|
|
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
|
<svg class="w-4 h-4 text-gray-500" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 21 21">
|
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
|
|
</svg>
|
|
</div>
|
|
<input type="text"
|
|
class="peer bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:outline focus:outline-sky-500 block w-full ps-10 p-2.5 pr-8 dark:bg-gray-900 dark:border-stone-700 dark:text-gray-100"
|
|
x-model="nameFilter" placeholder="wyszukiwarka"/>
|
|
<button x-show="nameFilter.length" @click="nameFilter=''" type="button"
|
|
class="absolute inset-y-0 end-0 flex items-center pe-3 invisible peer-valid:visible">
|
|
<svg class="w-4 h-4 text-gray-500 " xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
|
|
stroke-width="2" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<div class="d-block max-w-xs mr-2">
|
|
<label for="basic-year-2025" class="p-2.5 inline-block">
|
|
<input @input.debounce="updateFilter" x-model="year" type="checkbox" id="basic-year-2025"
|
|
value="2025"/> 2025
|
|
</label>
|
|
<label for="year-2024" class="p-2.5 inline-block">
|
|
<input @input.debounce="updateFilter" x-model="year" type="checkbox" id="basic-year-2024"
|
|
value="2024"/> 2024
|
|
</label>
|
|
<label for="year-2023" class="p-2.5 inline-block">
|
|
<input @input.debounce="updateFilter" x-model="year" type="checkbox" id="basic-year-2023"
|
|
value="2023"/> 2023
|
|
</label>
|
|
</div>
|
|
<div class="relative inline-block m-4 text-blue-400 inline cursor-pointer">
|
|
<div @click="advancedSearch = true">zaawansowane filtrowanie</div>
|
|
</div>
|
|
</form>
|
|
<div x-show="advancedSearch" class="flex m-4">
|
|
<div class="relative w-full d-block max-w-xs mr-2">
|
|
<input @input.debounce="updateFilter" x-model.debounce.250ms="username" placeholder="użytkownik"
|
|
type="text"
|
|
class="peer mr-2 max-w-xs bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:outline focus:outline-sky-500 block w-full p-2.5 px-4 dark:bg-gray-900 dark:border-stone-700 dark:text-gray-100"/>
|
|
<button x-show="username.length" @click="username=''" type="button"
|
|
class="absolute inset-y-0 end-0 flex items-center pe-3 invisible peer-valid:visible">
|
|
<svg class="w-4 h-4 text-gray-500 " xmlns="http://www.w3.org/2000/svg" fill="none"
|
|
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<div class="relative w-full d-block max-w-xs mr-2">
|
|
<input @input.debounce="updateFilter" x-model.debounce.250ms="title" placeholder="tytuł" type="text"
|
|
class="peer mr-2 max-w-xs bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:outline focus:outline-sky-500 block w-full p-2.5 px-4 dark:bg-gray-900 dark:border-stone-700 dark:text-gray-100"/>
|
|
<button x-show="title.length" @click="title=''" type="button"
|
|
class="absolute inset-y-0 end-0 flex items-center pe-3 invisible peer-valid:visible">
|
|
<svg class="w-4 h-4 text-gray-500 " xmlns="http://www.w3.org/2000/svg" fill="none"
|
|
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<div class="relative w-full d-block max-w-xs mr-2">
|
|
<input @input.debounce="updateFilter" x-model.debounce.250ms="author" placeholder="autor" type="text"
|
|
class="peer mr-2 max-w-xs bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:outline focus:outline-sky-500 block w-full p-2.5 px-4 dark:bg-gray-900 dark:border-stone-700 dark:text-gray-100"/>
|
|
<button x-show="author.length" @click="author=''" type="button"
|
|
class="absolute inset-y-0 end-0 flex items-center pe-3 invisible peer-valid:visible">
|
|
<svg class="w-4 h-4 text-gray-500 " xmlns="http://www.w3.org/2000/svg" fill="none"
|
|
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<div class="relative w-full d-block max-w-xs mr-2">
|
|
<input @input.debounce="updateFilter" x-model.debounce.250ms="publisher" placeholder="wydawca"
|
|
type="text"
|
|
class="peer mr-2 max-w-xs bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:outline focus:outline-sky-500 block w-full p-2.5 px-4 dark:bg-gray-900 dark:border-stone-700 dark:text-gray-100"/>
|
|
<button x-show="publisher.length" @click="publisher=''" type="button"
|
|
class="absolute inset-y-0 end-0 flex items-center pe-3 invisible peer-valid:visible">
|
|
<svg class="w-4 h-4 text-gray-500 " xmlns="http://www.w3.org/2000/svg" fill="none"
|
|
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<div class="d-block max-w-xs mr-2">
|
|
<label for="year-2025" class="p-2.5 inline-block">
|
|
<input @input.debounce="updateFilter" x-model="year" type="checkbox" id="year-2025" value="2025"/>
|
|
2025
|
|
</label>
|
|
<label for="year-2024" class="p-2.5 inline-block">
|
|
<input @input.debounce="updateFilter" x-model="year" type="checkbox" id="year-2024" value="2024"/>
|
|
2024
|
|
</label>
|
|
<label for="year-2023" class="p-2.5 inline-block">
|
|
<input @input.debounce="updateFilter" x-model="year" type="checkbox" id="year-2023" value="2023"/>
|
|
2023
|
|
</label>
|
|
</div>
|
|
|
|
<div class="inline-block m-2 text-blue-400 inline cursor-pointer">
|
|
<div @click="advancedSearch = false">proste filtrowanie</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<template x-ref="sortIcons">
|
|
<span>
|
|
<svg x-show="orderColumn[1] === -1 && orderColumn[0] === columnName" xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5"/>
|
|
</svg>
|
|
<svg x-show="orderColumn[1] === 1 && orderColumn[0] === columnName" xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 15.75 7.5-7.5 7.5 7.5"/>
|
|
</svg>
|
|
</span>
|
|
</template>
|
|
<table class="table table-fixed w-full text-sm">
|
|
<thead>
|
|
<tr>
|
|
<th class="text-right pl-1 w-[4rem]">#</th>
|
|
<th class="text-left pl-1 cursor-pointer" @click="orderBy('username')">
|
|
<div class="flex" x-data="{ columnName: 'username' }">
|
|
<span>Użytkownik</span>
|
|
<div x-html="$refs.sortIcons.innerHTML"></div>
|
|
</div>
|
|
</th>
|
|
<th class="text-left pl-1 cursor-pointer" @click="orderBy('title')">
|
|
<div class="flex" x-data="{ columnName: 'title' }">
|
|
<span>Tytuł</span>
|
|
<div x-html="$refs.sortIcons.innerHTML"></div>
|
|
</div>
|
|
</th>
|
|
<th class="text-left pl-1 cursor-pointer" @click="orderBy('author')">
|
|
<div class="flex" x-data="{ columnName: 'author' }">
|
|
<span>Autor</span>
|
|
<div x-html="$refs.sortIcons.innerHTML"></div>
|
|
</div>
|
|
</th>
|
|
<th class="text-left pl-1 cursor-pointer" @click="orderBy('publisher')">
|
|
<div class="flex" x-data="{ columnName: 'publisher' }">
|
|
<span>Wydawca</span>
|
|
<div x-html="$refs.sortIcons.innerHTML"></div>
|
|
</div>
|
|
</th>
|
|
<th class="text-right pr-4 w-[7rem] cursor-pointer" @click="orderBy('pages')">
|
|
<div class="flex" x-data="{ columnName: 'pages' }">
|
|
<span>Stron</span>
|
|
<div x-html="$refs.sortIcons.innerHTML"></div>
|
|
</div>
|
|
</th>
|
|
<th class="text-left pl-1 w-[12rem] cursor-pointer" @click="orderBy('format')">
|
|
<div class="flex" x-data="{ columnName: 'format' }">
|
|
<span>Format</span>
|
|
<div x-html="$refs.sortIcons.innerHTML"></div>
|
|
</div>
|
|
</th>
|
|
<th class="text-right w-[5rem] cursor-pointer" @click="orderBy('rating')">
|
|
<div class="flex" x-data="{ columnName: 'rating' }">
|
|
<span>Ocena</span>
|
|
<div x-html="$refs.sortIcons.innerHTML"></div>
|
|
</div>
|
|
</th>
|
|
<th class="text-right pr-4 w-[5rem] cursor-pointer" @click="orderBy('likes')">
|
|
<div class="flex" x-data="{ columnName: 'likes' }">
|
|
<span>⚡</span>
|
|
<div x-html="$refs.sortIcons.innerHTML"></div>
|
|
</div>
|
|
</th>
|
|
<th class="text-left pl-1 w-[5rem] cursor-pointer">Link</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<template x-for="(item, key) in filteredItems" :key="item.uuid">
|
|
<tr class="border-b border-slate-100 dark:border-stone-900 m-3 w-auto hover:bg-gray-100 dark:hover:bg-gray-900">
|
|
<td class="pl-1 text-right" x-text="filteredItems.length-key"></td>
|
|
<td class="pl-1 w-3 py-2">
|
|
<a @click="advancedSearch ? username=item.username : nameFilter='@'+item.username"
|
|
class="cursor-pointer" x-text="item.username"></a>
|
|
</td>
|
|
<td class="pl-1 w-12">
|
|
<a @click="advancedSearch ? title=item.book.title : nameFilter=item.book.title"
|
|
class="cursor-pointer" x-text="item.book.title"></a>
|
|
</td>
|
|
<td class="pl-1 w-8">
|
|
<a @click="advancedSearch ? author=item.book.author : nameFilter=item.book.author"
|
|
class="cursor-pointer" x-text="item.book.author"></a>
|
|
</td>
|
|
<td class="pl-1 w-8">
|
|
<a @click="advancedSearch ? publisher=item.book.publisher : nameFilter=item.book.publisher"
|
|
class="cursor-pointer" x-text="item.book.publisher"></a>
|
|
</td>
|
|
<td class="pr-4 text-right w-[5rem] w-[5rem]"><a :href="item.book.pages" x-text="item.book.pages"></a>
|
|
</td>
|
|
<td class="pl-1"><a :href="item.book.format" x-text="item.book.format"></a></td>
|
|
<td class="text-right"><a :href="item.book.rating" x-text="item.book.rating"></a></td>
|
|
<td class="pr-4 text-right" x-text="item.likes"></td>
|
|
<td class="pl-1 py-2">
|
|
<a :href="'https://www.hejto.pl/wpis/'+item.slug" target="_blank">
|
|
link
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2"
|
|
stroke="currentColor" class="w-4 h-4 text-gray-500 inline">
|
|
<path stroke-linecap="round" stroke-linejoin="round"
|
|
d="M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"/>
|
|
</svg>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
</template>
|
|
</tbody>
|
|
<tfoot>
|
|
<tr x-show="filteredItems.length">
|
|
<td colspan="4"></td>
|
|
<td class="align-top" colspan="2">
|
|
<p class="text-right pr-4" x-text="'strony: '+stats().pages_total"></p>
|
|
<p class="text-right pr-4" x-text="'strony śr: '+stats().pages_avg"></p>
|
|
</td>
|
|
<td class="align-top">
|
|
<template x-for="(item, index) in stats().formats">
|
|
<div class="flex">
|
|
<p x-text="index+':'"></p>
|
|
<p x-text="item" class="flex-1 text-right"></p>
|
|
</div>
|
|
</template>
|
|
</td>
|
|
<td class="align-top">
|
|
<p class="text-right" x-text="'ocena śr: '+stats().rating_avg"></p>
|
|
</td>
|
|
<td>
|
|
<p class="text-right" x-text="'⚡: '+stats().likes_total"></p>
|
|
<p class="text-right" x-text="'⚡ śr: '+stats().likes_avg"></p>
|
|
</td>
|
|
<td></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
<div x-data="darkmodetoggle" x-cloak="" class="flex m-5 border-t py-4 px-4 dark:bg-gray-800 dark:border-t-gray-500">
|
|
<div class="cursor-pointer text-yellow-500 px-4 dark:text-yellow-200" @click="mode('light')" title="Light mode">
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6">
|
|
<path d="M12 2.25a.75.75 0 0 1 .75.75v2.25a.75.75 0 0 1-1.5 0V3a.75.75 0 0 1 .75-.75ZM7.5 12a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM18.894 6.166a.75.75 0 0 0-1.06-1.06l-1.591 1.59a.75.75 0 1 0 1.06 1.061l1.591-1.59ZM21.75 12a.75.75 0 0 1-.75.75h-2.25a.75.75 0 0 1 0-1.5H21a.75.75 0 0 1 .75.75ZM17.834 18.894a.75.75 0 0 0 1.06-1.06l-1.59-1.591a.75.75 0 1 0-1.061 1.06l1.59 1.591ZM12 18a.75.75 0 0 1 .75.75V21a.75.75 0 0 1-1.5 0v-2.25A.75.75 0 0 1 12 18ZM7.758 17.303a.75.75 0 0 0-1.061-1.06l-1.591 1.59a.75.75 0 0 0 1.06 1.061l1.591-1.59ZM6 12a.75.75 0 0 1-.75.75H3a.75.75 0 0 1 0-1.5h2.25A.75.75 0 0 1 6 12ZM6.697 7.757a.75.75 0 0 0 1.06-1.06l-1.59-1.591a.75.75 0 0 0-1.061 1.06l1.59 1.591Z"/>
|
|
</svg>
|
|
</div>
|
|
<div class="cursor-pointer text-yellow-500 px-4 dark:text-yellow-200" @click="mode('dark')" title="Dark mode">
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6">
|
|
<path fill-rule="evenodd"
|
|
d="M9.528 1.718a.75.75 0 0 1 .162.819A8.97 8.97 0 0 0 9 6a9 9 0 0 0 9 9 8.97 8.97 0 0 0 3.463-.69.75.75 0 0 1 .981.98 10.503 10.503 0 0 1-9.694 6.46c-5.799 0-10.5-4.7-10.5-10.5 0-4.368 2.667-8.112 6.46-9.694a.75.75 0 0 1 .818.162Z"
|
|
clip-rule="evenodd"/>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
<!--<script type="module" src="/src/chart.js"></script>-->
|
|
<script type="module" src="/src/main.js"></script>
|
|
<script type="module" src="/src/darkmodetoggle.js"></script>
|
|
</body>
|
|
</html> |