WIP: Add a review button on book form

This commit is contained in:
2026-03-13 01:35:06 +01:00
parent d07f18d380
commit 524e517066
7 changed files with 76 additions and 8 deletions

View File

@@ -3,7 +3,6 @@ import { ref, computed } from 'vue'
import {
getBook,
getImagePathOrDefault,
putReadBook,
putWantReadBook,
putRateBook,
putStartReadDate,
@@ -15,6 +14,7 @@ import {
import { useRouter, onBeforeRouteUpdate } from 'vue-router'
import { VRating } from 'vuetify/components/VRating'
import BookFormIcons from './BookFormIcons.vue'
import ReviewModal from './ReviewModal.vue'
const router = useRouter()
const props = defineProps({
@@ -109,8 +109,9 @@ function goToAuthor() {
:model-value="data.rating / 2"
@update:modelValue="onRatingUpdate"
active-color="bulma-body-color"
class="centered"
class="centered mt-2"
/>
<ReviewModal button-parent-class="centered mt-3" />
</div>
<div class="column">
<h3 class="title">{{ data.title }}</h3>
@@ -141,12 +142,6 @@ img {
width: auto;
}
.centered {
display: flex;
justify-content: center;
align-items: center;
}
@media (min-width: 1024px) {
.left-panel {
margin-left: 3rem;

61
front/src/ReviewModal.vue Normal file
View File

@@ -0,0 +1,61 @@
<script setup>
import { ref } from 'vue'
const props = defineProps({
buttonParentClass: String,
})
const open = ref(false)
</script>
<template>
<div :class="buttonParentClass">
<button @click="open = true" class="button is-large is-responsive">
<span class="icon">
<b-icon-pen/>
</span>
<span>{{$t('bookform.reviewbtn')}}</span>
</button>
</div>
<Teleport to="body">
<div v-if="open">
<div @click="open = false" class="modal-backdrop"></div>
<div class="modal has-background-dark">
<h2 class="subtitle">{{$t('bookform.reviewbtn')}}</h2>
<textarea class="textarea" :placeholder="$t('bookform.reviewbtn')"></textarea>
</div>
</div>
</Teleport>
</template>
<style scoped>
.modal-backdrop {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
}
.modal {
height: 80%;
width: 80%;
top: 10%;
left: 10%;
box-shadow: 2px 2px 20px 1px;
overflow-x: auto;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 15px;
z-index: 1000;
}
</style>

View File

@@ -59,6 +59,7 @@
},
"bookform": {
"error": "Error when loading book: {error}",
"reviewbtn": "My review",
"read": "Read",
"startread": "Started",
"wantread": "Interested"

View File

@@ -59,6 +59,7 @@
},
"bookform": {
"error": "Erreur pendant le chargement du livre: {error}",
"reviewbtn": "Ma critique",
"read": "Lu",
"startread": "Commencé",
"wantread": "À lire"

View File

@@ -1,3 +1,9 @@
.clickable {
cursor: pointer;
}
.centered {
display: flex;
justify-content: center;
align-items: center;
}