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.
This commit is contained in:
@@ -5,16 +5,13 @@ const props = defineProps({
|
|||||||
icon: String,
|
icon: String,
|
||||||
legend: String,
|
legend: String,
|
||||||
isSet: Boolean,
|
isSet: Boolean,
|
||||||
isReadonly: Boolean,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const hovered = ref(false)
|
const hovered = ref(false)
|
||||||
const isOnMobile = ref(computeIsOnMobile())
|
const isOnMobile = ref(computeIsOnMobile())
|
||||||
|
|
||||||
const computedIcon = computed(
|
const computedIcon = computed(
|
||||||
() =>
|
() => props.icon + ((hovered.value && !isOnMobile.value) || props.isSet ? 'Fill' : ''),
|
||||||
props.icon +
|
|
||||||
(!props.isReadonly && ((hovered.value && !isOnMobile.value) || props.isSet) ? 'Fill' : ''),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
function computeIsOnMobile() {
|
function computeIsOnMobile() {
|
||||||
@@ -34,8 +31,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="bigiconandlegend"
|
class="bigiconandlegend showcanclick"
|
||||||
:class="props.isReadonly ? 'widget-readonly' : 'showcanclick'"
|
|
||||||
@mouseover="hovered = true"
|
@mouseover="hovered = true"
|
||||||
@mouseout="hovered = false"
|
@mouseout="hovered = false"
|
||||||
>
|
>
|
||||||
@@ -79,10 +75,6 @@ onUnmounted(() => {
|
|||||||
padding-bottom: 30px;
|
padding-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.widget-readonly {
|
|
||||||
opacity: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 1024px) {
|
@media (max-width: 1024px) {
|
||||||
.bigicon {
|
.bigicon {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ const props = defineProps({
|
|||||||
startReadDate: String,
|
startReadDate: String,
|
||||||
endReadDate: String,
|
endReadDate: String,
|
||||||
isExpanded: Boolean,
|
isExpanded: Boolean,
|
||||||
isReadonly: Boolean,
|
|
||||||
useEndDate: Boolean,
|
useEndDate: Boolean,
|
||||||
lastWidget: Boolean,
|
lastWidget: Boolean,
|
||||||
})
|
})
|
||||||
@@ -35,10 +34,9 @@ function computeParentClasses() {
|
|||||||
<div :class="computeParentClasses()">
|
<div :class="computeParentClasses()">
|
||||||
<BigIcon
|
<BigIcon
|
||||||
:icon="props.icon"
|
:icon="props.icon"
|
||||||
:is-readonly="props.isReadonly"
|
|
||||||
:legend="props.legend"
|
:legend="props.legend"
|
||||||
:isSet="props.isExpanded"
|
:isSet="props.isExpanded"
|
||||||
@click="props.isReadonly ? null : $emit('onIconClick')"
|
@click="$emit('onIconClick')"
|
||||||
/>
|
/>
|
||||||
<div v-if="props.isExpanded" class="inputdate">
|
<div v-if="props.isExpanded" class="inputdate">
|
||||||
<div class="ontopofinput">
|
<div class="ontopofinput">
|
||||||
|
|||||||
@@ -60,10 +60,14 @@ async function onStartReadIconClick() {
|
|||||||
if (!data.value.startReadDate) {
|
if (!data.value.startReadDate) {
|
||||||
data.value.startReadDate = today
|
data.value.startReadDate = today
|
||||||
putStartReadDate(props.id, data.value.startReadDate)
|
putStartReadDate(props.id, data.value.startReadDate)
|
||||||
} else {
|
} else if (!data.value.read) {
|
||||||
data.value.startReadDate = null
|
data.value.startReadDate = null
|
||||||
putStartReadDateUnset(props.id)
|
putStartReadDateUnset(props.id)
|
||||||
}
|
}
|
||||||
|
if (data.value.read) {
|
||||||
|
data.value.read = false
|
||||||
|
putUnreadBook(props.id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onStartReadDateChange(d) {
|
function onStartReadDateChange(d) {
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ async function onStartReadIconClick() {
|
|||||||
icon="BIconBook"
|
icon="BIconBook"
|
||||||
:legend="$t('bookform.wantread')"
|
:legend="$t('bookform.wantread')"
|
||||||
:is-set="isStartReadExpanded()"
|
:is-set="isStartReadExpanded()"
|
||||||
:is-readonly="props.read"
|
@click="onStartReadIconClick"
|
||||||
@click="props.read ? null : onStartReadIconClick()"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -82,7 +81,6 @@ async function onStartReadIconClick() {
|
|||||||
:legend="$t('bookform.startread')"
|
:legend="$t('bookform.startread')"
|
||||||
:start-read-date="props.startReadDate"
|
:start-read-date="props.startReadDate"
|
||||||
:is-expanded="isStartReadExpanded()"
|
:is-expanded="isStartReadExpanded()"
|
||||||
:is-readonly="props.read"
|
|
||||||
@onStartDateChange="(d) => $emit('onStartReadDateChange', d)"
|
@onStartDateChange="(d) => $emit('onStartReadDateChange', d)"
|
||||||
@onIconClick="onStartReadIconClick"
|
@onIconClick="onStartReadIconClick"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user