diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..4e76ed2
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,20 @@
+FROM node:20
+
+# Set working directory inside container
+WORKDIR /src
+
+# Copy package files first (for better caching)
+COPY package*.json ./
+
+# Install dependencies
+RUN npm install
+
+# Copy the rest of your project
+COPY . .
+
+# Expose Vite’s default dev port
+EXPOSE 5173
+
+# Default command
+CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
+
diff --git a/bin/build b/bin/build
new file mode 100755
index 0000000..75e04d8
--- /dev/null
+++ b/bin/build
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+docker compose run --rm node npm run build
\ No newline at end of file
diff --git a/bin/dev b/bin/dev
new file mode 100755
index 0000000..0583458
--- /dev/null
+++ b/bin/dev
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+docker compose run --rm node npm run dev -- --host 0.0.0.0
\ No newline at end of file
diff --git a/bin/tailwindbuild b/bin/tailwindbuild
new file mode 100755
index 0000000..5c5bdc9
--- /dev/null
+++ b/bin/tailwindbuild
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+docker compose run --rm node npm run tailwind:build
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..4ecafc4
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,10 @@
+services:
+ node:
+ build: .
+ working_dir: /src
+ volumes:
+ - .:/src
+ - /node_modules
+ ports:
+ - "5173:5173"
+ command: npm run dev -- --host 0.0.0.0
\ No newline at end of file
diff --git a/download_posts.php b/download_posts.php
index 7f3b7e4..f41abb9 100644
--- a/download_posts.php
+++ b/download_posts.php
@@ -1,9 +1,19 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
| # |
- Uzytkownik |
- Tytuł |
- Autor |
- Wydawca |
- Stron |
- Format |
- Ocena |
- ⚡ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
Link |
-
+
|
@@ -165,6 +232,22 @@
|
+
+
+
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index e2c6498..9572a92 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,7 +10,8 @@
"license": "ISC",
"dependencies": {
"@alpinejs/persist": "^3.14.9",
- "alpinejs": "^3.14.9"
+ "alpinejs": "^3.14.9",
+ "chart.js": "^4.5.0"
},
"devDependencies": {
"autoprefixer": "^10.4.21",
@@ -511,6 +512,12 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
+ "node_modules/@kurkle/color": {
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.4.tgz",
+ "integrity": "sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==",
+ "license": "MIT"
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -1035,9 +1042,9 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001727",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001727.tgz",
- "integrity": "sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q==",
+ "version": "1.0.30001743",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001743.tgz",
+ "integrity": "sha512-e6Ojr7RV14Un7dz6ASD0aZDmQPT/A+eZU+nuTNfjqmRrmkmQlnTNWH0SKmqagx9PeW87UVqapSurtAXifmtdmw==",
"dev": true,
"funding": [
{
@@ -1052,7 +1059,20 @@
"type": "github",
"url": "https://github.com/sponsors/ai"
}
- ]
+ ],
+ "license": "CC-BY-4.0"
+ },
+ "node_modules/chart.js": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.5.0.tgz",
+ "integrity": "sha512-aYeC/jDgSEx8SHWZvANYMioYMZ2KX02W6f6uVfyteuCGcadDLcYVHdfdygsTQkQ4TKn5lghoojAsPj5pu0SnvQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@kurkle/color": "^0.3.0"
+ },
+ "engines": {
+ "pnpm": ">=8"
+ }
},
"node_modules/chokidar": {
"version": "3.6.0",
diff --git a/package.json b/package.json
index a311f19..924a274 100644
--- a/package.json
+++ b/package.json
@@ -18,12 +18,13 @@
"license": "ISC",
"dependencies": {
"@alpinejs/persist": "^3.14.9",
- "alpinejs": "^3.14.9"
+ "alpinejs": "^3.14.9",
+ "chart.js": "^4.5.0"
},
"devDependencies": {
"autoprefixer": "^10.4.21",
"postcss": "^8.5.6",
"tailwindcss": "^3.4.17",
- "vite": "^7.0.5"
+ "vite": "7.1.5"
}
}
diff --git a/src/chart.js b/src/chart.js
new file mode 100644
index 0000000..38890af
--- /dev/null
+++ b/src/chart.js
@@ -0,0 +1,34 @@
+import Chart from 'chart.js/auto'
+
+const data = [
+ {year: 2009, count: 10},
+ {year: 2010, count: NaN},
+ {year: 2011, count: 20},
+ {year: 2012, count: 15},
+ {year: 2013, count: 25},
+ {year: 2014, count: 22},
+ {year: 2015, count: 30},
+ {year: 2016, count: 28},
+];
+
+// linechart.data.labels.push(label);
+// linechart.data.datasets.forEach((dataset) => {
+// dataset.data.push(newData);
+// });
+// linechart.update();
+
+window.linechart = new Chart(
+ document.getElementById('acquisitions'),
+ {
+ type: 'bar',
+ data: {
+ labels: data.map(row => row.year),
+ datasets: [
+ {
+ label: 'Acquisitions by year',
+ data: data.map(row => row.count)
+ }
+ ]
+ }
+ }
+);
diff --git a/src/darkmodetoggle.js b/src/darkmodetoggle.js
new file mode 100644
index 0000000..9aeb3a7
--- /dev/null
+++ b/src/darkmodetoggle.js
@@ -0,0 +1,6 @@
+export default () => ({
+ mode(modeName) {
+ localStorage.theme = modeName;
+ document.documentElement.classList.toggle("dark", modeName==='dark');
+ }
+});
\ No newline at end of file
diff --git a/src/generated.css b/src/generated.css
index 84ae070..8e330f5 100644
--- a/src/generated.css
+++ b/src/generated.css
@@ -1,843 +1 @@
-*, ::before, ::after {
- --tw-border-spacing-x: 0;
- --tw-border-spacing-y: 0;
- --tw-translate-x: 0;
- --tw-translate-y: 0;
- --tw-rotate: 0;
- --tw-skew-x: 0;
- --tw-skew-y: 0;
- --tw-scale-x: 1;
- --tw-scale-y: 1;
- --tw-pan-x: ;
- --tw-pan-y: ;
- --tw-pinch-zoom: ;
- --tw-scroll-snap-strictness: proximity;
- --tw-gradient-from-position: ;
- --tw-gradient-via-position: ;
- --tw-gradient-to-position: ;
- --tw-ordinal: ;
- --tw-slashed-zero: ;
- --tw-numeric-figure: ;
- --tw-numeric-spacing: ;
- --tw-numeric-fraction: ;
- --tw-ring-inset: ;
- --tw-ring-offset-width: 0px;
- --tw-ring-offset-color: #fff;
- --tw-ring-color: rgb(59 130 246 / 0.5);
- --tw-ring-offset-shadow: 0 0 #0000;
- --tw-ring-shadow: 0 0 #0000;
- --tw-shadow: 0 0 #0000;
- --tw-shadow-colored: 0 0 #0000;
- --tw-blur: ;
- --tw-brightness: ;
- --tw-contrast: ;
- --tw-grayscale: ;
- --tw-hue-rotate: ;
- --tw-invert: ;
- --tw-saturate: ;
- --tw-sepia: ;
- --tw-drop-shadow: ;
- --tw-backdrop-blur: ;
- --tw-backdrop-brightness: ;
- --tw-backdrop-contrast: ;
- --tw-backdrop-grayscale: ;
- --tw-backdrop-hue-rotate: ;
- --tw-backdrop-invert: ;
- --tw-backdrop-opacity: ;
- --tw-backdrop-saturate: ;
- --tw-backdrop-sepia: ;
- --tw-contain-size: ;
- --tw-contain-layout: ;
- --tw-contain-paint: ;
- --tw-contain-style: ;
-}
-
-::backdrop {
- --tw-border-spacing-x: 0;
- --tw-border-spacing-y: 0;
- --tw-translate-x: 0;
- --tw-translate-y: 0;
- --tw-rotate: 0;
- --tw-skew-x: 0;
- --tw-skew-y: 0;
- --tw-scale-x: 1;
- --tw-scale-y: 1;
- --tw-pan-x: ;
- --tw-pan-y: ;
- --tw-pinch-zoom: ;
- --tw-scroll-snap-strictness: proximity;
- --tw-gradient-from-position: ;
- --tw-gradient-via-position: ;
- --tw-gradient-to-position: ;
- --tw-ordinal: ;
- --tw-slashed-zero: ;
- --tw-numeric-figure: ;
- --tw-numeric-spacing: ;
- --tw-numeric-fraction: ;
- --tw-ring-inset: ;
- --tw-ring-offset-width: 0px;
- --tw-ring-offset-color: #fff;
- --tw-ring-color: rgb(59 130 246 / 0.5);
- --tw-ring-offset-shadow: 0 0 #0000;
- --tw-ring-shadow: 0 0 #0000;
- --tw-shadow: 0 0 #0000;
- --tw-shadow-colored: 0 0 #0000;
- --tw-blur: ;
- --tw-brightness: ;
- --tw-contrast: ;
- --tw-grayscale: ;
- --tw-hue-rotate: ;
- --tw-invert: ;
- --tw-saturate: ;
- --tw-sepia: ;
- --tw-drop-shadow: ;
- --tw-backdrop-blur: ;
- --tw-backdrop-brightness: ;
- --tw-backdrop-contrast: ;
- --tw-backdrop-grayscale: ;
- --tw-backdrop-hue-rotate: ;
- --tw-backdrop-invert: ;
- --tw-backdrop-opacity: ;
- --tw-backdrop-saturate: ;
- --tw-backdrop-sepia: ;
- --tw-contain-size: ;
- --tw-contain-layout: ;
- --tw-contain-paint: ;
- --tw-contain-style: ;
-}
-
-/*
-! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com
-*/
-
-/*
-1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
-2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
-*/
-
-*,
-::before,
-::after {
- box-sizing: border-box;
- /* 1 */
- border-width: 0;
- /* 2 */
- border-style: solid;
- /* 2 */
- border-color: #e5e7eb;
- /* 2 */
-}
-
-::before,
-::after {
- --tw-content: '';
-}
-
-/*
-1. Use a consistent sensible line-height in all browsers.
-2. Prevent adjustments of font size after orientation changes in iOS.
-3. Use a more readable tab size.
-4. Use the user's configured `sans` font-family by default.
-5. Use the user's configured `sans` font-feature-settings by default.
-6. Use the user's configured `sans` font-variation-settings by default.
-7. Disable tap highlights on iOS
-*/
-
-html,
-:host {
- line-height: 1.5;
- /* 1 */
- -webkit-text-size-adjust: 100%;
- /* 2 */
- -moz-tab-size: 4;
- /* 3 */
- -o-tab-size: 4;
- tab-size: 4;
- /* 3 */
- font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
- /* 4 */
- font-feature-settings: normal;
- /* 5 */
- font-variation-settings: normal;
- /* 6 */
- -webkit-tap-highlight-color: transparent;
- /* 7 */
-}
-
-/*
-1. Remove the margin in all browsers.
-2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
-*/
-
-body {
- margin: 0;
- /* 1 */
- line-height: inherit;
- /* 2 */
-}
-
-/*
-1. Add the correct height in Firefox.
-2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
-3. Ensure horizontal rules are visible by default.
-*/
-
-hr {
- height: 0;
- /* 1 */
- color: inherit;
- /* 2 */
- border-top-width: 1px;
- /* 3 */
-}
-
-/*
-Add the correct text decoration in Chrome, Edge, and Safari.
-*/
-
-abbr:where([title]) {
- -webkit-text-decoration: underline dotted;
- text-decoration: underline dotted;
-}
-
-/*
-Remove the default font size and weight for headings.
-*/
-
-h1,
-h2,
-h3,
-h4,
-h5,
-h6 {
- font-size: inherit;
- font-weight: inherit;
-}
-
-/*
-Reset links to optimize for opt-in styling instead of opt-out.
-*/
-
-a {
- color: inherit;
- text-decoration: inherit;
-}
-
-/*
-Add the correct font weight in Edge and Safari.
-*/
-
-b,
-strong {
- font-weight: bolder;
-}
-
-/*
-1. Use the user's configured `mono` font-family by default.
-2. Use the user's configured `mono` font-feature-settings by default.
-3. Use the user's configured `mono` font-variation-settings by default.
-4. Correct the odd `em` font sizing in all browsers.
-*/
-
-code,
-kbd,
-samp,
-pre {
- font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
- /* 1 */
- font-feature-settings: normal;
- /* 2 */
- font-variation-settings: normal;
- /* 3 */
- font-size: 1em;
- /* 4 */
-}
-
-/*
-Add the correct font size in all browsers.
-*/
-
-small {
- font-size: 80%;
-}
-
-/*
-Prevent `sub` and `sup` elements from affecting the line height in all browsers.
-*/
-
-sub,
-sup {
- font-size: 75%;
- line-height: 0;
- position: relative;
- vertical-align: baseline;
-}
-
-sub {
- bottom: -0.25em;
-}
-
-sup {
- top: -0.5em;
-}
-
-/*
-1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
-2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
-3. Remove gaps between table borders by default.
-*/
-
-table {
- text-indent: 0;
- /* 1 */
- border-color: inherit;
- /* 2 */
- border-collapse: collapse;
- /* 3 */
-}
-
-/*
-1. Change the font styles in all browsers.
-2. Remove the margin in Firefox and Safari.
-3. Remove default padding in all browsers.
-*/
-
-button,
-input,
-optgroup,
-select,
-textarea {
- font-family: inherit;
- /* 1 */
- font-feature-settings: inherit;
- /* 1 */
- font-variation-settings: inherit;
- /* 1 */
- font-size: 100%;
- /* 1 */
- font-weight: inherit;
- /* 1 */
- line-height: inherit;
- /* 1 */
- letter-spacing: inherit;
- /* 1 */
- color: inherit;
- /* 1 */
- margin: 0;
- /* 2 */
- padding: 0;
- /* 3 */
-}
-
-/*
-Remove the inheritance of text transform in Edge and Firefox.
-*/
-
-button,
-select {
- text-transform: none;
-}
-
-/*
-1. Correct the inability to style clickable types in iOS and Safari.
-2. Remove default button styles.
-*/
-
-button,
-input:where([type='button']),
-input:where([type='reset']),
-input:where([type='submit']) {
- -webkit-appearance: button;
- /* 1 */
- background-color: transparent;
- /* 2 */
- background-image: none;
- /* 2 */
-}
-
-/*
-Use the modern Firefox focus style for all focusable elements.
-*/
-
-:-moz-focusring {
- outline: auto;
-}
-
-/*
-Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
-*/
-
-:-moz-ui-invalid {
- box-shadow: none;
-}
-
-/*
-Add the correct vertical alignment in Chrome and Firefox.
-*/
-
-progress {
- vertical-align: baseline;
-}
-
-/*
-Correct the cursor style of increment and decrement buttons in Safari.
-*/
-
-::-webkit-inner-spin-button,
-::-webkit-outer-spin-button {
- height: auto;
-}
-
-/*
-1. Correct the odd appearance in Chrome and Safari.
-2. Correct the outline style in Safari.
-*/
-
-[type='search'] {
- -webkit-appearance: textfield;
- /* 1 */
- outline-offset: -2px;
- /* 2 */
-}
-
-/*
-Remove the inner padding in Chrome and Safari on macOS.
-*/
-
-::-webkit-search-decoration {
- -webkit-appearance: none;
-}
-
-/*
-1. Correct the inability to style clickable types in iOS and Safari.
-2. Change font properties to `inherit` in Safari.
-*/
-
-::-webkit-file-upload-button {
- -webkit-appearance: button;
- /* 1 */
- font: inherit;
- /* 2 */
-}
-
-/*
-Add the correct display in Chrome and Safari.
-*/
-
-summary {
- display: list-item;
-}
-
-/*
-Removes the default spacing and border for appropriate elements.
-*/
-
-blockquote,
-dl,
-dd,
-h1,
-h2,
-h3,
-h4,
-h5,
-h6,
-hr,
-figure,
-p,
-pre {
- margin: 0;
-}
-
-fieldset {
- margin: 0;
- padding: 0;
-}
-
-legend {
- padding: 0;
-}
-
-ol,
-ul,
-menu {
- list-style: none;
- margin: 0;
- padding: 0;
-}
-
-/*
-Reset default styling for dialogs.
-*/
-
-dialog {
- padding: 0;
-}
-
-/*
-Prevent resizing textareas horizontally by default.
-*/
-
-textarea {
- resize: vertical;
-}
-
-/*
-1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
-2. Set the default placeholder color to the user's configured gray 400 color.
-*/
-
-input::-moz-placeholder, textarea::-moz-placeholder {
- opacity: 1;
- /* 1 */
- color: #9ca3af;
- /* 2 */
-}
-
-input::placeholder,
-textarea::placeholder {
- opacity: 1;
- /* 1 */
- color: #9ca3af;
- /* 2 */
-}
-
-/*
-Set the default cursor for buttons.
-*/
-
-button,
-[role="button"] {
- cursor: pointer;
-}
-
-/*
-Make sure disabled buttons don't get the pointer cursor.
-*/
-
-:disabled {
- cursor: default;
-}
-
-/*
-1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
-2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
- This can trigger a poorly considered lint error in some tools but is included by design.
-*/
-
-img,
-svg,
-video,
-canvas,
-audio,
-iframe,
-embed,
-object {
- display: block;
- /* 1 */
- vertical-align: middle;
- /* 2 */
-}
-
-/*
-Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
-*/
-
-img,
-video {
- max-width: 100%;
- height: auto;
-}
-
-/* Make elements with the HTML hidden attribute stay hidden by default */
-
-[hidden]:where(:not([hidden="until-found"])) {
- display: none;
-}
-
-.pointer-events-none {
- pointer-events: none;
-}
-
-.invisible {
- visibility: hidden;
-}
-
-.absolute {
- position: absolute;
-}
-
-.relative {
- position: relative;
-}
-
-.inset-y-0 {
- top: 0px;
- bottom: 0px;
-}
-
-.end-0 {
- inset-inline-end: 0px;
-}
-
-.start-0 {
- inset-inline-start: 0px;
-}
-
-.m-2 {
- margin: 0.5rem;
-}
-
-.m-3 {
- margin: 0.75rem;
-}
-
-.m-4 {
- margin: 1rem;
-}
-
-.mr-2 {
- margin-right: 0.5rem;
-}
-
-.block {
- display: block;
-}
-
-.inline-block {
- display: inline-block;
-}
-
-.inline {
- display: inline;
-}
-
-.flex {
- display: flex;
-}
-
-.table {
- display: table;
-}
-
-.h-4 {
- height: 1rem;
-}
-
-.w-12 {
- width: 3rem;
-}
-
-.w-3 {
- width: 0.75rem;
-}
-
-.w-4 {
- width: 1rem;
-}
-
-.w-8 {
- width: 2rem;
-}
-
-.w-\[12rem\] {
- width: 12rem;
-}
-
-.w-\[4rem\] {
- width: 4rem;
-}
-
-.w-\[5rem\] {
- width: 5rem;
-}
-
-.w-\[7rem\] {
- width: 7rem;
-}
-
-.w-auto {
- width: auto;
-}
-
-.w-full {
- width: 100%;
-}
-
-.max-w-md {
- max-width: 28rem;
-}
-
-.max-w-xs {
- max-width: 20rem;
-}
-
-.table-fixed {
- table-layout: fixed;
-}
-
-.cursor-pointer {
- cursor: pointer;
-}
-
-.items-center {
- align-items: center;
-}
-
-.rounded-lg {
- border-radius: 0.5rem;
-}
-
-.border {
- border-width: 1px;
-}
-
-.border-b {
- border-bottom-width: 1px;
-}
-
-.border-gray-300 {
- --tw-border-opacity: 1;
- border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
-}
-
-.border-slate-100 {
- --tw-border-opacity: 1;
- border-color: rgb(241 245 249 / var(--tw-border-opacity, 1));
-}
-
-.bg-gray-50 {
- --tw-bg-opacity: 1;
- background-color: rgb(249 250 251 / var(--tw-bg-opacity, 1));
-}
-
-.p-2\.5 {
- padding: 0.625rem;
-}
-
-.px-4 {
- padding-left: 1rem;
- padding-right: 1rem;
-}
-
-.py-2 {
- padding-top: 0.5rem;
- padding-bottom: 0.5rem;
-}
-
-.pe-3 {
- padding-inline-end: 0.75rem;
-}
-
-.pl-1 {
- padding-left: 0.25rem;
-}
-
-.pr-4 {
- padding-right: 1rem;
-}
-
-.pr-8 {
- padding-right: 2rem;
-}
-
-.ps-10 {
- padding-inline-start: 2.5rem;
-}
-
-.ps-3 {
- padding-inline-start: 0.75rem;
-}
-
-.text-left {
- text-align: left;
-}
-
-.text-right {
- text-align: right;
-}
-
-.align-top {
- vertical-align: top;
-}
-
-.text-sm {
- font-size: 0.875rem;
- line-height: 1.25rem;
-}
-
-.text-blue-400 {
- --tw-text-opacity: 1;
- color: rgb(96 165 250 / var(--tw-text-opacity, 1));
-}
-
-.text-gray-500 {
- --tw-text-opacity: 1;
- color: rgb(107 114 128 / var(--tw-text-opacity, 1));
-}
-
-.text-gray-900 {
- --tw-text-opacity: 1;
- color: rgb(17 24 39 / var(--tw-text-opacity, 1));
-}
-
-.filter {
- filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
-}
-
-[x-cloak] {
- display: none;
-}
-
-.hover\:bg-gray-100:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
-}
-
-.focus\:outline:focus {
- outline-style: solid;
-}
-
-.focus\:outline-sky-500:focus {
- outline-color: #0ea5e9;
-}
-
-.peer:valid ~ .peer-valid\:visible {
- visibility: visible;
-}
-
-@media (prefers-color-scheme: dark) {
- .dark\:border-stone-700 {
- --tw-border-opacity: 1;
- border-color: rgb(68 64 60 / var(--tw-border-opacity, 1));
- }
-
- .dark\:border-stone-900 {
- --tw-border-opacity: 1;
- border-color: rgb(28 25 23 / var(--tw-border-opacity, 1));
- }
-
- .dark\:bg-stone-900 {
- --tw-bg-opacity: 1;
- background-color: rgb(28 25 23 / var(--tw-bg-opacity, 1));
- }
-
- .dark\:bg-stone-950 {
- --tw-bg-opacity: 1;
- background-color: rgb(12 10 9 / var(--tw-bg-opacity, 1));
- }
-
- .dark\:text-gray-100 {
- --tw-text-opacity: 1;
- color: rgb(243 244 246 / var(--tw-text-opacity, 1));
- }
-
- .dark\:text-gray-300 {
- --tw-text-opacity: 1;
- color: rgb(209 213 219 / var(--tw-text-opacity, 1));
- }
-
- .dark\:hover\:bg-stone-900:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(28 25 23 / var(--tw-bg-opacity, 1));
- }
-}
\ No newline at end of file
+*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.absolute{position:absolute}.relative{position:relative}.inset-y-0{top:0;bottom:0}.end-0{inset-inline-end:0}.start-0{inset-inline-start:0}.m-2{margin:.5rem}.m-3{margin:.75rem}.m-4{margin:1rem}.m-5{margin:1.25rem}.mr-2{margin-right:.5rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.table{display:table}.size-6{width:1.5rem;height:1.5rem}.h-4{height:1rem}.w-12{width:3rem}.w-3{width:.75rem}.w-4{width:1rem}.w-8{width:2rem}.w-\[12rem\]{width:12rem}.w-\[4rem\]{width:4rem}.w-\[5rem\]{width:5rem}.w-\[7rem\]{width:7rem}.w-auto{width:auto}.w-full{width:100%}.max-w-md{max-width:28rem}.max-w-xs{max-width:20rem}.table-fixed{table-layout:fixed}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.border-slate-100{--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity,1))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.p-10{padding:2.5rem}.p-2\.5{padding:.625rem}.px-4{padding-left:1rem;padding-right:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pe-3{padding-inline-end:.75rem}.pl-1{padding-left:.25rem}.pr-4{padding-right:1rem}.pr-8{padding-right:2rem}.ps-10{padding-inline-start:2.5rem}.ps-3{padding-inline-start:.75rem}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.text-sm{font-size:.875rem;line-height:1.25rem}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));[x-cloak]{display:none}.hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\:outline:focus{outline-style:solid}.focus\:outline-sky-500:focus{outline-color:#0ea5e9}.peer:valid~.peer-valid\:visible{visibility:visible}.dark\:border-stone-700:is(.dark *){--tw-border-opacity:1;border-color:rgb(68 64 60/var(--tw-border-opacity,1))}.dark\:border-stone-900:is(.dark *){--tw-border-opacity:1;border-color:rgb(28 25 23/var(--tw-border-opacity,1))}.dark\:border-t-gray-500:is(.dark *){--tw-border-opacity:1;border-top-color:rgb(107 114 128/var(--tw-border-opacity,1))}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity:1;background-color:rgb(3 7 18/var(--tw-bg-opacity,1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity,1))}.dark\:text-gray-300:is(.dark *){--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.dark\:hover\:bg-gray-900:hover:is(.dark *){--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index 5a9054d..4526b72 100644
--- a/src/main.js
+++ b/src/main.js
@@ -2,12 +2,17 @@ import './generated.css'
import Alpine from 'alpinejs'
import persist from '@alpinejs/persist'
+import Chart from 'chart.js/auto'
+import darkmodetoggle from './darkmodetoggle';
window.Alpine = Alpine;
Alpine.plugin(persist)
-
+Alpine.data('darkmodetoggle', darkmodetoggle);
Alpine.data('bookmeterList', function () {
return {
+ chart: null,
+ chartPoints: null,
+ chartPublisher: null,
items: {},
filteredItems: [],
username: '',
@@ -17,7 +22,7 @@ Alpine.data('bookmeterList', function () {
nameFilter: '',
years: [2023, 2024, 2025],
year: this.$persist(['2025']).as('year-filter'),
- orderColumn: ['order', 1],
+ orderColumn: ['order', 0],
advancedSearch: this.$persist(0).as('advanced-search'),
async init() {
this.$watch('nameFilter', () => this.updateFilter());
@@ -38,9 +43,113 @@ Alpine.data('bookmeterList', function () {
this.items = [...data1, ...data2, ...data3]
this.updateFilter();
+ // this.initChart();
+ },
+ updatechartnew(){
+ this.chart.data.datasets[0].data[0] = Math.random()*50;
+ Alpine.raw(this.chart).update('none');
+ this.updateChart()
+ },
+ // initChart() {
+ // const ctx = document.getElementById('statsChart').getContext('2d')
+ //
+ // this.chart = Alpine.raw(new Chart(ctx, {
+ // type: 'bar',
+ // data: {
+ // labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
+ // datasets: [{
+ // label: '# of Votes',
+ // data: [12, 19, 3, 5, 2, 3],
+ // borderWidth: 1
+ // }]
+ // }
+ // }));
+ //
+ // const chartPoints = document.getElementById('chartPoints').getContext('2d')
+ //
+ // const bubbleData = this.filteredItems.map(item => ({
+ // x: item.book.pages,
+ // y: item.book.rating,
+ // r: Math.sqrt(item.likes || 1) * 2, // scale likes
+ // format: item.book.format
+ // }));
+ //
+ //
+ // this.chartPoints = Alpine.raw(new Chart(chartPoints, {
+ // type: 'bubble',
+ // data: {
+ // labels: [],
+ // datasets: [{
+ // label: 'points',
+ // // data: this.pointsChartData,
+ // data: bubbleData,
+ // // backgroundColor: 'rgb(255, 99, 132)'
+ // backgroundColor: bubbleData.map(d =>
+ // d.format === 'audiobook' ? 'rgba(255,99,132,0.5)' :
+ // d.format === 'ebook' ? 'rgba(54,162,235,0.5)' :
+ // 'rgba(75,192,192,0.5)'
+ // )
+ // }]
+ // },
+ // options: {
+ // scales: {
+ // x: { title: { display: true, text: 'Pages' } },
+ // y: { title: { display: true, text: 'Rating' }, min: 0, max: 10 }
+ // }
+ // }
+ // }));
+ //
+ // },
+ get pointsChartData(){
+ let data = [];
+ for(let i in this.filteredItems){
+ // console.info(Alpine.raw(this.filteredItems[i]));
+ if(!(this.filteredItems[i]['book']['rating'] in data)){
+ data[this.filteredItems[i]['book']['rating']] = []
+ }
+ if(!(this.filteredItems[i]['likes'] in data[this.filteredItems[i]['book']['rating']])){
+ data[this.filteredItems[i]['book']['rating']][this.filteredItems[i]['likes']] = 0;
+ }
+
+ data[this.filteredItems[i]['book']['rating']][this.filteredItems[i]['likes']]++;
+ }
+
+ let data2 = [];
+ for(let i in data){
+ for(let j in data[i]){
+ data2.push({x: j, y: i, r: data[i][j], label: 'label'});
+ }
+ }
+ return data2;
+ },
+ updateChart() {
+ if (!this.chart) {
+ return;
+ }
+
+ // console.info( Alpine.raw(this.filteredItems));
+ const topItems = this.filteredItems.slice(0, 20).map(item => ({
+ title: item.book?.title || 'Unknown',
+ likes: item.likes || 0,
+ // date: (new Date(item.created_at)).getFullYear()+'-'+((new Date(item.created_at)).getMonth()+1)
+ }));
+
+ let counts = {};
+
+ // topItems.forEach(item => counts[item.date] = 1 + ())
+
+
+ console.info(topItems);
+ this.chart.data.labels = topItems.map(i => i.title)
+ this.chart.data.datasets[0].data = topItems.map(i => i.likes)
+
+ Alpine.raw(this.chart).update('none');
},
orderBy(property) {
- let direction = (this.orderColumn[0] === property) ? this.orderColumn[1] * -1 : 1;
+ let direction = (this.orderColumn[0] === property) ? ((this.orderColumn[1] === -1) ? 0 : this.orderColumn[1] * -1) : 1;
+ if (!direction) {
+ property = 'order';
+ }
this.orderColumn = [property, direction];
this.sort();
},
@@ -70,25 +179,33 @@ Alpine.data('bookmeterList', function () {
likes: (a,b) => ((a.likes < b.likes) ? -1 : (a.likes > b.likes) ? 1 : 0) * this.orderColumn[1],
})[this.orderColumn[0]];
this.filteredItems = this.filteredItems.sort(sortFunction);
+ if (this.orderColumn[0] === 'order') {
+ this.initFilteredData();
+ }
+ },
+ initFilteredData(){
+ let filter = this.nameFilter.toLowerCase();
+
+ this.filteredItems = this.items
+ .filter(i => this.year.includes(i.created_at.substring(0,4)))
+ .filter(i => {
+ if(this.advancedSearch) {
+ return (
+ (!this.username || i.username.toLowerCase().includes(this.username.toLowerCase())) &&
+ (!this.title || i.book.title.toLowerCase().includes(this.title.toLowerCase())) &&
+ (!this.author || i.book.author.toLowerCase().includes(this.author.toLowerCase())) &&
+ (!this.publisher || i.book.publisher.toLowerCase().includes(this.publisher.toLowerCase()))
+ );
+ } else {
+ if(filter.startsWith('@') && i.username.toLowerCase().includes(filter.substring(1))) return true;
+ if (i.username.toLowerCase().includes(filter) ||
+ i.book.title.toLowerCase().includes(filter) || i.book.author.toLowerCase().includes(filter) || i.book.publisher.toLowerCase().includes(filter)) return true;
+ return false;
+ }
+ });
},
updateFilter(){
- let filter = this.nameFilter.toLowerCase();
- this.filteredItems = this.items.filter(i => this.year.includes(i.created_at.substring(0,4)))
- .filter(i => {
- if(this.advancedSearch) {
- return (
- (!this.username || i.username.toLowerCase().includes(this.username.toLowerCase())) &&
- (!this.title || i.book.title.toLowerCase().includes(this.title.toLowerCase())) &&
- (!this.author || i.book.author.toLowerCase().includes(this.author.toLowerCase())) &&
- (!this.publisher || i.book.publisher.toLowerCase().includes(this.publisher.toLowerCase()))
- );
- } else {
- if(filter.startsWith('@') && i.username.toLowerCase().includes(filter.substring(1))) return true;
- if (i.username.toLowerCase().includes(filter) ||
- i.book.title.toLowerCase().includes(filter) || i.book.author.toLowerCase().includes(filter) || i.book.publisher.toLowerCase().includes(filter)) return true;
- return false;
- }
- });
+ this.initFilteredData();
this.sort();
this.updateURL();
diff --git a/src/style.css b/src/style.css
index 3560692..dbfb8ec 100644
--- a/src/style.css
+++ b/src/style.css
@@ -1,6 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
+@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
[x-cloak] {
display: none;
diff --git a/tailwind.config.js b/tailwind.config.js
index 9f8308e..19d4799 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -8,5 +8,6 @@ module.exports = {
extend: {},
},
plugins: [],
+ darkMode: 'class'
}