separate book form icons in a new component

This commit is contained in:
2026-03-08 18:31:27 +01:00
parent 65127c2273
commit 898846c654
2 changed files with 170 additions and 137 deletions

View File

@@ -15,9 +15,7 @@ import {
import { useTemplateRef, nextTick } from 'vue'
import { useRouter, onBeforeRouteUpdate } from 'vue-router'
import { VRating } from 'vuetify/components/VRating'
import BigIcon from './BigIcon.vue'
import BookDateWidget from './BookDateWidget.vue'
import DateWidget from './DateWidget.vue'
import BookFormIcons from './BookFormIcons.vue'
const router = useRouter()
const props = defineProps({
@@ -92,12 +90,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)
}
@@ -131,89 +123,14 @@ 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"
:class="
data.wantread ? 'has-text-dark has-background-text border-radius-wantread-fill' : ''
"
>
<BigIcon
icon="BIconEye"
:legend="$t('bookform.wantread')"
:isSet="data.wantread"
@click="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()"
:is-readonly="data.read"
@click="data.read ? null : onStartReadIconClick()"
/>
</div>
<div
class="bigiconcontainer is-hidden-desktop"
:class="data.read ? 'has-text-dark has-background-text border-radius-right-fill' : ''"
>
<BigIcon
icon="BIconCheckCircle"
:legend="$t('bookform.read')"
:isSet="data.read"
@click="onReadIconClick"
/>
</div>
<BookDateWidget
class="is-hidden-mobile"
icon="BIconBook"
:legend="$t('bookform.startread')"
:start-read-date="data.startReadDate"
:is-expanded="isStartReadExpanded()"
:is-readonly="data.read"
@onStartDateChange="onStartReadDateChange"
@onIconClick="onStartReadIconClick"
/>
<BookDateWidget
class="is-hidden-mobile"
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 ref="mobiledates" class="mobile-dates pt-3 is-hidden-desktop">
<div class="mobiledate">
<DateWidget
v-if="isStartReadExpanded() || data.read"
dateinputid="startread"
dateinputlabel="bookdatewidget.started"
:initdate="data.startReadDate"
is-horizontal
@onDateChange="(d) => onStartReadDateChange(d)"
/>
</div>
<div class="mobiledate pt-2">
<DateWidget
v-if="data.read"
dateinputid="endread"
dateinputlabel="bookdatewidget.finished"
:initdate="data.endReadDate"
is-horizontal
@onDateChange="(d) => onEndReadDateChange(d)"
/>
</div>
</div>
<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>
</div>
</template>
@@ -232,38 +149,10 @@ img {
align-items: center;
}
.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) {
.left-panel {
margin-left: 3rem;
}
.border-radius-wantread-fill {
border-radius: 45px 45px 0px 0px;
}
.remove-border-bottom {
border-bottom: none;
}
.bigiconcontainer {
display: flex;
}
}
@media (max-width: 1024px) {
@@ -273,27 +162,10 @@ img {
padding: 20px;
}
.bigiconcontainer {
flex: 1;
}
.border-radius-wantread-fill {
border-radius: 38px 0px 0px 38px;
}
.image {
display: flex;
justify-content: center;
align-items: center;
}
.iconscontainer {
display: flex;
width: 100%;
}
.border-radius-right-fill {
border-radius: 0px 38px 38px 0px;
}
}
</style>