13 Commits
0.2.0 ... 0.3.0

Author SHA1 Message Date
17068aa28c Release 0.3.0 2026-03-08 19:06:20 +01:00
aee6fbaf73 Book form: can now click "start read" even when the book is marked as read
It will do the same behavior as clicking on the "read" button again to
cancel it.
2026-03-08 19:00:40 +01:00
0d591c0fa9 Bookform: fix scrollTo on mobile view
regression of previous commit
2026-03-08 18:39:45 +01:00
898846c654 separate book form icons in a new component 2026-03-08 18:31:27 +01:00
65127c2273 Upgrade go version 2026-03-08 15:52:42 +01:00
55e80181df Add a logo 2026-03-08 15:50:13 +01:00
f01dfa01cb remove spaces in readme 2026-03-07 20:52:47 +01:00
d398de1b47 Book form mobile view: scroll to dates when opened 2026-03-07 20:45:20 +01:00
8a707610bf Book form: make buttons work on mobile view 2026-03-07 19:40:23 +01:00
2a1d8e13c8 Run prettier 2026-03-07 17:28:52 +01:00
93757126e1 Book form: change the icon background when book is read 2026-03-06 18:43:32 +01:00
e8e2df3c43 fixed "currently reading" book filter to remove read books 2026-03-06 17:17:53 +01:00
28e86e5032 Barcode scanner improvements
- Added a message when no cameras are found.
- Release the camera when the popup is closed.
2026-03-06 15:21:10 +01:00
21 changed files with 325 additions and 130 deletions

View File

@@ -71,7 +71,7 @@ INSERT INTO user_books(created_at, user_id, book_id, want_read, rating) VALUES (
INSERT INTO books(created_at, title, author_id, added_by_id, cover_id) VALUES ('NOW', 'D''un château l''autre',(SELECT id FROM authors WHERE name = 'Louis-Ferdinand Céline'), (SELECT id FROM users WHERE name = 'demo'),(SELECT id FROM static_files WHERE name = 'dunchateaulautre.jpg'));
INSERT INTO user_books(created_at, user_id, book_id, read, rating) VALUES ('NOW',(SELECT id FROM users WHERE name = 'demo'),(SELECT id FROM books WHERE title = 'D''un château l''autre'), true,10);
INSERT INTO books(created_at, title, author_id, added_by_id, cover_id) VALUES ('NOW', 'Les dieux ont soif',(SELECT id FROM authors WHERE name = 'Anatole France'), (SELECT id FROM users WHERE name = 'demo'),(SELECT id FROM static_files WHERE name = 'lesdieuxontsoif.jpg'));
INSERT INTO user_books(created_at, user_id, book_id, read, rating) VALUES ('NOW',(SELECT id FROM users WHERE name = 'demo'),(SELECT id FROM books WHERE title = 'Les dieux ont soif'), true,7);
INSERT INTO user_books(created_at, user_id, book_id, read, start_read_date, end_read_date, rating) VALUES ('NOW',(SELECT id FROM users WHERE name = 'demo'),(SELECT id FROM books WHERE title = 'Les dieux ont soif'), true,'2026-01-30 00:00:00+00:00','2026-02-13 00:00:00+00:00',7);
INSERT INTO books(created_at, title, author_id, added_by_id, cover_id) VALUES ('NOW', 'Rigodon',(SELECT id FROM authors WHERE name = 'Louis-Ferdinand Céline'), (SELECT id FROM users WHERE name = 'demo'),(SELECT id FROM static_files WHERE name = 'rigodon.jpg'));
INSERT INTO user_books(created_at, user_id, book_id, read, rating) VALUES ('NOW',(SELECT id FROM users WHERE name = 'demo2'),(SELECT id FROM books WHERE title = 'Rigodon'),true, 10);
INSERT INTO books(created_at, title, author_id, added_by_id, cover_id) VALUES ('NOW', 'Un barrage contre le Pacifique',(SELECT id FROM authors WHERE name = 'Marguerite Duras'), (SELECT id FROM users WHERE name = 'demo'),(SELECT id FROM static_files WHERE name = 'Un_barrage_contre_le_Pacifique.jpg'));

View File

@@ -2,7 +2,7 @@
<html lang="">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="/favicon.svg" />
<link rel="stylesheet" href="/css/bulma.min.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bibliomane</title>

View File

@@ -1,6 +1,6 @@
{
"name": "bibliomane",
"version": "0.2.0",
"version": "0.3.0",
"private": true,
"type": "module",
"engines": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

15
front/public/favicon.svg Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="125.95975mm" height="132.42345mm" viewBox="0 0 125.95975 132.42345" version="1.1" id="svg1008" inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" sodipodi:docname="logo_carré.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview id="namedview1010" pagecolor="#505050" bordercolor="#ffffff" borderopacity="1" inkscape:pageshadow="0" inkscape:pageopacity="0" inkscape:pagecheckerboard="1" inkscape:document-units="mm" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="0.77771465" inkscape:cx="80.363666" inkscape:cy="297.66702" inkscape:window-width="2560" inkscape:window-height="1369" inkscape:window-x="1912" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="layer1"/>
<defs id="defs1005">
<linearGradient inkscape:collect="always" xlink:href="#linearGradient29626-5" id="linearGradient41043" gradientUnits="userSpaceOnUse" x1="-274.68173" y1="86.602715" x2="-136.50122" y2="141.29916" gradientTransform="matrix(0,-0.975265,0.97958512,0,44.404193,-64.657592)"/>
<linearGradient id="linearGradient29626-5" inkscape:swatch="gradient">
<stop style="stop-color:#cd82d1;stop-opacity:1;" offset="0" id="stop29622"/>
<stop style="stop-color:#45e4be;stop-opacity:1" offset="1" id="stop29624"/>
</linearGradient>
</defs>
<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(-83.64899,-69.870748)">
<path id="rect33397" style="fill:url(#linearGradient41043);stroke-width:14.6613;stroke-linecap:round;paint-order:markers fill stroke" d="m 123.59901,69.870748 c -22.13223,0 -39.95002,17.817785 -39.95002,39.950012 v 52.52341 c 0,22.13223 17.81779,39.95003 39.95002,39.95003 h 46.05972 c 22.13224,0 39.95001,-17.8178 39.95001,-39.95003 v -52.52341 c 0,-22.132227 -17.81777,-39.950012 -39.95001,-39.950012 z m 16.04451,10.09246 c 2.89943,-0.025 5.27029,2.304907 5.2958,5.204333 l 0.093,10.535274 c 0.0259,2.899434 -2.30336,5.270995 -5.20278,5.297355 -2.89984,0.0256 -5.27133,-2.304505 -5.29684,-5.204338 l -0.093,-10.536825 c -0.025,-2.89923 2.30459,-5.270008 5.20381,-5.295799 z m 22.37162,9.874874 c 1.39244,-0.02341 2.73714,0.507288 3.73828,1.475362 2.08486,2.015053 2.14177,5.338588 0.12712,7.423838 l -8.88628,9.193748 c -2.01549,2.08523 -5.33978,2.14171 -7.42487,0.12609 -2.08423,-2.01528 -2.14067,-5.33841 -0.12609,-7.42332 l 8.8868,-9.194266 c 0.96744,-1.001274 2.29295,-1.577317 3.68504,-1.601452 z m -36.12428,8.403542 c 0.077,-0.0011 0.15435,-0.0011 0.23151,5.3e-4 0.30864,0.006 0.61792,0.03233 0.92604,0.08113 2.46499,0.38998 4.30183,1.812396 5.71283,3.422536 l 0.03,0.0341 9.57203,11.31249 h 19.29081 c 5.4245,0 10.14805,2.49331 13.13356,6.02857 2.98552,3.53526 4.46133,7.94487 4.60799,12.361 0.13508,4.06728 -0.94484,8.23683 -3.47576,11.72228 1.71448,1.01562 3.30442,2.15465 4.61729,3.52227 4.26817,4.44617 6.19882,10.33751 6.02082,16.07241 -0.35602,11.46979 -9.7863,22.94071 -24.73595,22.94071 h -24.1298 l -18.22317,-18.95904 0.063,0.063 c -11.56249,-11.62674 -15.08369,-24.70477 -13.06949,-34.38395 1.0071,-4.83959 3.55434,-9.28947 8.20829,-11.16469 0.37422,-0.15075 0.77822,-0.13389 1.1622,-0.23771 -0.63978,-3.80679 -0.50295,-7.69555 0.10542,-11.12801 0.64248,-3.62486 1.54593,-6.92763 4.57957,-9.60974 1.13761,-1.005806 2.85512,-1.845387 4.68291,-2.037607 v 5.29e-4 c 0.22848,-0.02416 0.45874,-0.03788 0.68989,-0.04082 z m -0.38396,11.934156 c -0.60269,0.009 -1.13008,0.50778 -1.28416,1.3069 -1.14194,5.72294 -0.28389,9.83155 3.99252,14.50919 0,0 5.3e-4,7.9e-4 0.001,10e-4 l 0.077,0.0739 0.0119,0.0124 6.21357,6.22855 -0.01,-12.24059 -7.90029,-9.33742 c -0.35161,-0.388 -0.74031,-0.55941 -1.10174,-0.55397 z m 19.50372,13.41779 v 15.93959 h 16.68012 0.0574 c 3.0387,0.0385 4.41726,-0.84879 5.48907,-2.13579 1.07456,-1.29032 1.73633,-3.34125 1.66243,-5.56658 -0.0739,-2.22533 -0.90166,-4.47159 -2.13579,-5.93297 -1.23413,-1.46138 -2.64641,-2.30425 -5.10976,-2.30425 z m -25.58914,8.07651 c -0.20944,2.6e-4 -0.43094,0.0238 -0.66714,0.0734 -1.64588,0.45199 -2.71995,2.05325 -3.14503,4.38784 -1.47473,6.99382 0.018,11.95115 11.36778,23.30814 l 0.0315,0.0315 7.50031,7.80211 v -20.75429 l -12.90825,-13.80742 c -0.54958,-0.56585 -1.16751,-0.97593 -1.97352,-1.03405 -0.0672,-0.005 -0.13586,-0.007 -0.20568,-0.007 z m 25.58914,18.36425 v 25.20363 H 161.822 c 9.92523,0 14.04184,-6.38226 14.23995,-12.7646 0.0991,-3.19116 -0.94119,-6.225 -3.09955,-8.47338 -2.15835,-2.24838 -5.52091,-3.96565 -11.1404,-3.96565 h -0.2434 z" sodipodi:nodetypes="sssssssssccccccccccsccccssccccssscssscccsscssccssccccccccsccccsssscscssccccssccssssccscs"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="80.642197mm" height="104.19308mm" viewBox="0 0 80.642197 104.19308" version="1.1" id="svg863" sodipodi:docname="logo_trait.svg" inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview id="namedview865" pagecolor="#505050" bordercolor="#ffffff" borderopacity="1" inkscape:pageshadow="0" inkscape:pageopacity="0" inkscape:pagecheckerboard="1" inkscape:document-units="mm" showgrid="false" inkscape:zoom="1.0998546" inkscape:cx="111.37836" inkscape:cy="219.57448" inkscape:window-width="2560" inkscape:window-height="1369" inkscape:window-x="1912" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="layer1" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0"/>
<defs id="defs860">
<linearGradient inkscape:collect="always" xlink:href="#linearGradient29626-5" id="linearGradient29653" gradientUnits="userSpaceOnUse" x1="180.15134" y1="639.77362" x2="387.26251" y2="162.77214" gradientTransform="matrix(0.18523379,0,0,0.18523379,50.465238,49.46306)"/>
<linearGradient id="linearGradient29626-5" inkscape:swatch="gradient">
<stop style="stop-color:#cd82d1;stop-opacity:1;" offset="0" id="stop29622"/>
<stop style="stop-color:#45e4be;stop-opacity:1" offset="1" id="stop29624"/>
</linearGradient>
</defs>
<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(-76.709803,-68.336456)">
<path id="path11547" style="color:#000000;fill:url(#linearGradient29653);fill-opacity:1;fill-rule:nonzero;stroke-width:0.700097;-inkscape-stroke:none" d="m 96.905008,85.032291 c -0.30864,-0.0061 -0.61647,0.0081 -0.9211,0.04016 v -3.61e-4 c -1.82779,0.192211 -3.54569,1.031778 -4.6833,2.037572 -3.03364,2.682116 -3.937,5.984852 -4.57947,9.609724 -0.60837,3.432464 -0.74506,7.320994 -0.10528,11.127784 -0.38397,0.10382 -0.78784,0.0873 -1.16206,0.23805 -4.65395,1.87521 -7.20143,6.32509 -8.20853,11.16468 -2.01421,9.67918 1.50698,22.75728 13.06947,34.38402 l -0.063,-0.063 18.223102,18.95861 h 24.12996 c 14.94966,0 24.37993,-11.47061 24.73595,-22.94041 0.178,-5.7349 -1.75266,-11.62612 -6.02083,-16.07229 -1.31287,-1.36763 -2.90298,-2.50673 -4.61746,-3.52233 2.53092,-3.48546 3.61075,-7.65527 3.47567,-11.72255 -0.14666,-4.41613 -1.62253,-8.82548 -4.60805,-12.36074 -2.98551,-3.53526 -7.70901,-6.028784 -13.13351,-6.028784 h -19.29073 l -9.57173,-11.312289 -0.03,-0.03437 c -1.411,-1.610146 -3.24796,-3.032503 -5.712952,-3.422483 -0.30812,-0.04875 -0.61753,-0.07496 -0.92617,-0.08104 z m 0.48588,12.487005 7.900662,9.338024 0.01,12.24061 -6.213462,-6.22873 -0.0123,-0.0123 -0.0767,-0.0738 c -3.7e-4,-3.6e-4 -0.001,-0.001 -0.001,-0.001 -4.27641,-4.67764 -5.13453,-8.78607 -3.9926,-14.509014 0.24652,-1.27859 1.44807,-1.7891 2.38607,-0.75336 z m 18.402182,12.864344 h 16.64355 c 2.46335,0 3.87571,0.84282 5.10984,2.3042 1.23413,1.46139 2.06207,3.70758 2.13598,5.93291 0.0739,2.22533 -0.5882,4.27646 -1.66276,5.56678 -1.07181,1.28701 -2.44994,2.17408 -5.48864,2.13562 h -0.0575 -16.68045 z m -26.256232,8.15022 c 1.25974,-0.2642 2.11382,0.21302 2.84659,0.96748 l 12.908122,13.80751 v 20.75451 l -7.500162,-7.80225 -0.0315,-0.0315 c -11.34978,-11.35699 -12.84262,-16.31443 -11.3679,-23.30824 0.42508,-2.33459 1.49895,-3.93552 3.14483,-4.38751 z m 26.256232,18.29082 h 16.5683 0.24348 c 5.61949,0 8.98172,1.71714 11.14007,3.96552 2.15836,2.24838 3.19883,5.2822 3.09978,8.47336 -0.19811,6.38234 -4.31462,12.76449 -14.23985,12.76449 h -16.81178 z" sodipodi:nodetypes="cccssccscccssscssscccsccccccccccccssssccccscccccscccssssccc"/>
<path style="color:#000000;fill:#60d1c2;fill-opacity:1;stroke-width:0.653215;stroke-linecap:round;-inkscape-stroke:none" d="m 111.75634,68.336639 a 4.8991144,4.8991144 0 0 0 -4.85575,4.941216 l 0.0868,9.831401 a 4.8991144,4.8991144 0 0 0 4.9425,4.855737 4.8991144,4.8991144 0 0 0 4.85445,-4.942493 l -0.0868,-9.830124 a 4.8991144,4.8991144 0 0 0 -4.94122,-4.855737 z" id="path23529"/>
<path style="color:#000000;fill:#60d1c2;fill-opacity:1;stroke-width:0.606037;stroke-linecap:round;-inkscape-stroke:none" d="m 132.27231,78.931592 a 4.442115,4.6508356 0 0 0 -3.16127,1.307975 l -7.77474,7.875191 a 4.442115,4.6508356 0 0 0 -0.10429,6.5754 4.442115,4.6508356 0 0 0 6.28146,0.109238 l 7.77474,-7.87519 a 4.442115,4.6508356 0 0 0 0.10314,-6.57544 4.442115,4.6508356 0 0 0 -3.11904,-1.417174 z" id="path23531"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -13,7 +13,7 @@ const router = useRouter()
const isMenuActive = ref(false)
const isSearchBarShown = ref(false)
const appVersion = import.meta.env.VITE_APP_VERSION;
const appVersion = import.meta.env.VITE_APP_VERSION
function logout() {
authStore.logout()
@@ -47,7 +47,14 @@ onMounted(() => {
<template>
<nav class="navbar">
<div class="navbar-brand">
<RouterLink to="/" class="navbar-item" :title="'bibliomane v' + appVersion" activeClass="is-active"> B </RouterLink>
<RouterLink
to="/"
class="navbar-item"
:title="'bibliomane v' + appVersion"
activeClass="is-active"
>
<img src="/image/logo.svg" />
</RouterLink>
<div class="navbar-item is-hidden-desktop">
<a
@click="isSearchBarShown = !isSearchBarShown"

View File

@@ -5,16 +5,13 @@ const props = defineProps({
icon: String,
legend: String,
isSet: Boolean,
isReadonly: Boolean,
})
const hovered = ref(false)
const isOnMobile = ref(computeIsOnMobile())
const computedIcon = computed(
() =>
props.icon +
(!props.isReadonly && ((hovered.value && !isOnMobile.value) || props.isSet) ? 'Fill' : ''),
() => props.icon + ((hovered.value && !isOnMobile.value) || props.isSet ? 'Fill' : ''),
)
function computeIsOnMobile() {
@@ -34,8 +31,7 @@ onUnmounted(() => {
<template>
<div
class="bigiconandlegend"
:class="props.isReadonly ? '' : 'showcanclick'"
class="bigiconandlegend showcanclick"
@mouseover="hovered = true"
@mouseout="hovered = false"
>
@@ -91,7 +87,7 @@ onUnmounted(() => {
flex: 1;
font-size: 16px;
width: 100%;
padding-bottom: 0px;
padding-bottom: 5px;
}
.bigiconandlegend {

View File

@@ -1,6 +1,7 @@
<script setup>
import { ref } from 'vue'
import BigIcon from './BigIcon.vue'
import DateWidget from './DateWidget.vue'
const props = defineProps({
icon: String,
@@ -8,7 +9,6 @@ const props = defineProps({
startReadDate: String,
endReadDate: String,
isExpanded: Boolean,
isReadonly: Boolean,
useEndDate: Boolean,
lastWidget: Boolean,
})
@@ -26,9 +26,6 @@ function computeParentClasses() {
} else {
classNames += ' border-radius-right'
}
if (props.isReadonly) {
classNames += ' widget-readonly'
}
return classNames
}
</script>
@@ -37,35 +34,24 @@ function computeParentClasses() {
<div :class="computeParentClasses()">
<BigIcon
:icon="props.icon"
:is-readonly="props.isReadonly"
:legend="props.legend"
:isSet="props.isExpanded"
@click="props.isReadonly ? null : $emit('onIconClick')"
@click="$emit('onIconClick')"
/>
<div v-if="props.isExpanded" class="inputdate">
<div class="ontopofinput">
<label class="datelabel" for="startread">
{{ $t('bookdatewidget.started') }}
</label>
<input
class="datepicker has-background-dark has-text-light"
id="startread"
type="date"
@change="(e) => $emit('onStartDateChange', e.target.value)"
:value="props.startReadDate"
:max="today"
<DateWidget
dateinputid="startread"
dateinputlabel="bookdatewidget.started"
:initdate="props.startReadDate"
@onDateChange="(d) => $emit('onStartDateChange', d)"
/>
<div v-if="props.useEndDate">
<label class="datelabel" for="endread">
{{ $t('bookdatewidget.finished') }}
</label>
<input
class="datepicker has-background-dark has-text-light"
id="endread"
type="date"
@change="(e) => $emit('onEndDateChange', e.target.value)"
:value="props.endReadDate"
:max="today"
<DateWidget
dateinputid="endread"
dateinputlabel="bookdatewidget.finished"
:initdate="props.endReadDate"
@onDateChange="(d) => $emit('onEndDateChange', d)"
/>
</div>
</div>
@@ -93,24 +79,6 @@ function computeParentClasses() {
display: block;
}
.datelabel {
display: flex;
justify-content: center;
align-items: center;
font-size: 26px;
border: none;
padding-bottom: 15px;
}
.datepicker {
font-size: 26px;
border-radius: 5px;
}
.widget-readonly {
opacity: 50%;
}
@media (max-width: 1024px) {
.bookdatewidget {
flex: 1;

View File

@@ -14,8 +14,7 @@ import {
} from './api.js'
import { useRouter, onBeforeRouteUpdate } from 'vue-router'
import { VRating } from 'vuetify/components/VRating'
import BigIcon from './BigIcon.vue'
import BookDateWidget from './BookDateWidget.vue'
import BookFormIcons from './BookFormIcons.vue'
const router = useRouter()
const props = defineProps({
@@ -41,7 +40,7 @@ function onRatingUpdate(rating) {
putRateBook(props.id, { rating: data.value.rating })
}
function onReadIconClick() {
async function onReadIconClick() {
data.value.read = !data.value.read
if (data.value.read) {
data.value.wantread = false
@@ -57,14 +56,18 @@ function onWantReadIconClick() {
putWantReadBook(props.id, { wantread: data.value.wantread })
}
function onStartReadIconClick() {
async function onStartReadIconClick() {
if (!data.value.startReadDate) {
data.value.startReadDate = today
putStartReadDate(props.id, data.value.startReadDate)
} else {
} else if (!data.value.read) {
data.value.startReadDate = null
putStartReadDateUnset(props.id)
}
if (data.value.read) {
data.value.read = false
putUnreadBook(props.id)
}
}
function onStartReadDateChange(d) {
@@ -85,12 +88,6 @@ function onEndReadDateChange(d) {
}
}
function isStartReadExpanded() {
let isStartReadDateSet = data.value.startReadDate ? true : false
let isReadUnset = !data.value.read ? true : false
return isStartReadDateSet && isReadUnset
}
function goToAuthor() {
router.push('/author/' + data.value.authorId)
}
@@ -124,38 +121,15 @@ function goToAuthor() {
<div class="my-5" v-if="data.openlibraryid">OLID: {{ data.openlibraryid }}</div>
</div>
<div class="column">
<div class="iconscontainer" :class="data.read ? 'remove-border-bottom' : ''">
<div class="bigiconcontainer">
<BigIcon
icon="BIconEye"
:legend="$t('bookform.wantread')"
:isSet="data.wantread"
@click="onWantReadIconClick"
<BookFormIcons
v-bind="data"
@on-want-read-icon-click="onWantReadIconClick"
@on-start-read-icon-click="onStartReadIconClick"
@on-read-icon-click="onReadIconClick"
@on-start-read-date-change="onStartReadDateChange"
@on-end-read-date-change="onEndReadDateChange"
/>
</div>
<BookDateWidget
icon="BIconBook"
:legend="$t('bookform.startread')"
:start-read-date="data.startReadDate"
:is-expanded="isStartReadExpanded()"
:is-readonly="data.read"
@onStartDateChange="onStartReadDateChange"
@onIconClick="onStartReadIconClick"
/>
<BookDateWidget
icon="BIconCheckCircle"
:legend="$t('bookform.read')"
:start-read-date="data.startReadDate"
use-end-date
last-widget
:endReadDate="data.endReadDate"
:isExpanded="data.read"
@onStartDateChange="onStartReadDateChange"
@onEndDateChange="onEndReadDateChange"
@onIconClick="onReadIconClick"
/>
</div>
</div>
</div>
</template>
@@ -173,16 +147,6 @@ img {
align-items: center;
}
.iconscontainer {
border: solid;
border-radius: 50px;
width: 250px;
}
.remove-border-bottom {
border-bottom: none;
}
@media (min-width: 1024px) {
.left-panel {
margin-left: 3rem;
@@ -193,10 +157,7 @@ img {
img {
max-height: 250px;
max-width: 250px;
}
.bigiconcontainer {
flex: 1;
padding: 20px;
}
.image {
@@ -204,10 +165,5 @@ img {
justify-content: center;
align-items: center;
}
.iconscontainer {
display: flex;
width: 100%;
}
}
</style>

174
front/src/BookFormIcons.vue Normal file
View File

@@ -0,0 +1,174 @@
<script setup>
import { useTemplateRef, nextTick } from 'vue'
import BigIcon from './BigIcon.vue'
import BookDateWidget from './BookDateWidget.vue'
import DateWidget from './DateWidget.vue'
const props = defineProps({
wantread: Boolean,
startReadDate: String,
endReadDate: String,
read: Boolean,
})
const mobiledatesel = useTemplateRef('mobiledates')
const emit = defineEmits([
'onWantReadIconClick',
'onStartReadIconClick',
'onReadIconClick',
'onStartReadDateChange',
'onEndReadDateChange',
])
function isStartReadExpanded() {
let isStartReadDateSet = props.startReadDate ? true : false
let isReadUnset = !props.read ? true : false
return isStartReadDateSet && isReadUnset
}
async function onReadIconClick() {
emit('onReadIconClick')
await nextTick()
mobiledatesel.value.scrollIntoView()
}
async function onStartReadIconClick() {
emit('onStartReadIconClick')
await nextTick()
mobiledatesel.value.scrollIntoView()
}
</script>
<template>
<div class="iconscontainer" :class="props.read ? 'remove-border-bottom' : ''">
<div
class="bigiconcontainer"
:class="props.wantread ? 'has-text-dark has-background-text border-radius-wantread-fill' : ''"
>
<BigIcon
icon="BIconEye"
:legend="$t('bookform.wantread')"
:isSet="props.wantread"
@click="$emit('onWantReadIconClick')"
/>
</div>
<div
class="bigiconcontainer is-hidden-desktop"
:class="isStartReadExpanded() ? 'has-text-dark has-background-text' : ''"
>
<BigIcon
icon="BIconBook"
:legend="$t('bookform.wantread')"
:is-set="isStartReadExpanded()"
@click="onStartReadIconClick"
/>
</div>
<div
class="bigiconcontainer is-hidden-desktop"
:class="props.read ? 'has-text-dark has-background-text border-radius-right-fill' : ''"
>
<BigIcon
icon="BIconCheckCircle"
:legend="$t('bookform.read')"
:isSet="props.read"
@click="onReadIconClick"
/>
</div>
<BookDateWidget
class="is-hidden-mobile"
icon="BIconBook"
:legend="$t('bookform.startread')"
:start-read-date="props.startReadDate"
:is-expanded="isStartReadExpanded()"
@onStartDateChange="(d) => $emit('onStartReadDateChange', d)"
@onIconClick="onStartReadIconClick"
/>
<BookDateWidget
class="is-hidden-mobile"
icon="BIconCheckCircle"
:legend="$t('bookform.read')"
:start-read-date="props.startReadDate"
use-end-date
last-widget
:endReadDate="props.endReadDate"
:isExpanded="props.read"
@onStartDateChange="(d) => $emit('onStartReadDateChange', d)"
@onEndDateChange="(d) => $emit('onEndReadDateChange', d)"
@onIconClick="onReadIconClick"
/>
</div>
<div ref="mobiledates" class="mobile-dates pt-3 is-hidden-desktop">
<div class="mobiledate">
<DateWidget
v-if="isStartReadExpanded() || props.read"
dateinputid="startread"
dateinputlabel="bookdatewidget.started"
:initdate="props.startReadDate"
is-horizontal
@onDateChange="(d) => $emit('onStartReadDateChange', d)"
/>
</div>
<div class="mobiledate pt-2">
<DateWidget
v-if="props.read"
dateinputid="endread"
dateinputlabel="bookdatewidget.finished"
:initdate="props.endReadDate"
is-horizontal
@onDateChange="(d) => $emit('onEndReadDateChange', d)"
/>
</div>
</div>
</template>
<style scoped>
.iconscontainer {
border: solid;
border-radius: 50px;
width: 250px;
}
.mobile-dates {
display: block;
}
.mobiledate {
display: flex;
justify-content: center;
align-items: center;
}
@media (min-width: 1024px) {
.border-radius-wantread-fill {
border-radius: 45px 45px 0px 0px;
}
.remove-border-bottom {
border-bottom: none;
}
.bigiconcontainer {
display: flex;
}
}
@media (max-width: 1024px) {
.border-radius-wantread-fill {
border-radius: 38px 0px 0px 38px;
}
.bigiconcontainer {
flex: 1;
}
.iconscontainer {
display: flex;
width: 100%;
}
.border-radius-right-fill {
border-radius: 0px 38px 38px 0px;
}
}
</style>

42
front/src/DateWidget.vue Normal file
View File

@@ -0,0 +1,42 @@
<script setup>
import { ref } from 'vue'
const props = defineProps({
dateinputid: String,
dateinputlabel: String,
initdate: String,
isHorizontal: Boolean,
})
defineEmits(['onDateChange'])
const today = new Date().toISOString().slice(0, 10)
</script>
<template>
<label class="datelabel" :class="props.isHorizontal ? 'pr-2' : 'pb-1'" :for="props.dateinputid">
{{ $t(props.dateinputlabel) }}
</label>
<input
class="datepicker has-background-dark has-text-light"
:id="props.dateinputid"
type="date"
@change="(e) => $emit('onDateChange', e.target.value)"
:value="props.initdate"
:max="today"
/>
</template>
<style scoped>
.datelabel {
display: flex;
justify-content: center;
align-items: center;
font-size: 26px;
border: none;
}
.datepicker {
font-size: 26px;
border-radius: 5px;
}
</style>

View File

@@ -1,21 +1,38 @@
<script setup>
import { useTemplateRef, onMounted, ref } from 'vue'
import { useTemplateRef, onMounted, onUnmounted, ref } from 'vue'
import { BrowserMultiFormatReader } from '@zxing/library'
import { i18n } from '@/main'
const emit = defineEmits('readBarcode')
const { t } = i18n.global
const scanResult = ref(null)
const scanErr = ref(null)
const codeReader = new BrowserMultiFormatReader()
const scannerElement = useTemplateRef('scanner')
onMounted(() => {
if (!codeReader.isMediaDevicesSuported || !codeReader.canEnumerateDevices) {
scanErr.value = 'This browser does not support this feature.'
return
}
codeReader.listVideoInputDevices().then((mediaDevicesInfoArray) => {
if (mediaDevicesInfoArray.length > 0) {
codeReader.decodeFromVideoDevice(undefined, scannerElement.value, (result, err) => {
if (result) {
emit('readBarcode', result.text)
}
})
} else {
scanErr.value = t('barcode.nocamera')
}
})
})
onUnmounted(() => {
codeReader.reset()
})
function onResult(result) {
scanResult.value = result
}
@@ -23,6 +40,7 @@ function onResult(result) {
<template>
<h1 class="subtitle">{{ $t('barcode.title') }}</h1>
<div v-if="scanErr">{{ scanErr }}</div>
<div v-if="scanResult">{{ scanResult }}</div>
<video poster="data:image/gif,AAAA" ref="scanner"></video>
</template>

View File

@@ -13,7 +13,8 @@
},
"barcode": {
"title": "Scan barcode",
"barcode": "Scan barcode"
"barcode": "Scan barcode",
"nocamera": "No camera found."
},
"addbook": {
"title": "Title",

View File

@@ -13,7 +13,8 @@
},
"barcode": {
"title": "Scanner le code-barres",
"barcode": "Scanner le code-barres"
"barcode": "Scanner le code-barres",
"nocamera": "Impossible de détecter la caméra."
},
"addbook": {
"title": "Titre",

View File

@@ -14,7 +14,7 @@ import fr from './locales/fr.json'
import en from './locales/en.json'
// configure i18n
const i18n = createI18n({
export const i18n = createI18n({
locale: navigator.language,
fallbackLocale: 'en',
messages: { fr, en },

2
go.mod
View File

@@ -1,6 +1,6 @@
module git.artlef.fr/bibliomane
go 1.25.1
go 1.26
require (
github.com/alecthomas/kong v1.14.0

View File

@@ -63,7 +63,7 @@ func fetchReadUserBookQuery(db *gorm.DB, userId uint) *gorm.DB {
}
func fetchReadingUserBookQuery(db *gorm.DB, userId uint) *gorm.DB {
query := fetchUserBookGet(db, userId)
query = query.Where("user_books.start_read_date IS NOT NULL")
query = query.Where("user_books.start_read_date IS NOT NULL AND (user_books.read IS NULL OR user_books.read IS FALSE)")
return query
}

View File

@@ -104,7 +104,7 @@ func Setup(config *config.Config) *gin.Engine {
r.StaticFS("/"+folder, http.FS(subFs))
}
r.StaticFileFS("/favicon.ico", "favicon.ico", http.FS(front.Frontend))
r.StaticFileFS("/favicon.svg", "favicon.svg", http.FS(front.Frontend))
r.GET("/", serveIndexHtml)
r.NoRoute(serveIndexHtml)

View File

@@ -6,7 +6,7 @@ import (
)
func main() {
applicationVersion := "0.2.0"
applicationVersion := "0.3.0"
c := config.LoadConfig(applicationVersion)
r := setup.Setup(&c)
r.Run(":" + c.Port)