Skip to content

Commit

Permalink
fix: series order number on card #140
Browse files Browse the repository at this point in the history
  • Loading branch information
bayang committed Sep 21, 2024
1 parent f32d1fb commit c15ac02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/jelu-ui/src/components/BookCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const props = defineProps<{
forceSelect: boolean,
showSelect: boolean,
proposeAdd: boolean,
seriesId?: string,
}>();
const emit = defineEmits<{
(e: 'update:modalClosed', open: boolean): void,
Expand Down Expand Up @@ -89,6 +90,17 @@ const progressBarTooltip = computed(() => {
return props.book.currentPageNumber != null ? `p. ${props.book.currentPageNumber}` : `${props.book.percentRead} %`
})
const currentSeries = computed(() => {
if (props.book.book.series != null && props.book.book.series?.length > 0) {
if (props.seriesId != null) {
return props.book.book.series?.find(s => s.seriesId === props.seriesId)
} else {
return props.book.book.series[0]
}
}
return null
})
function modalClosed() {
console.log("modal closed from card")
emit("update:modalClosed", true)
Expand Down Expand Up @@ -233,12 +245,12 @@ watch(checked, (newVal, oldVal) => {
>{{ eventText }}</span>
<div class="flex">
<router-link
v-if="book.book.series && book.book.series.length > 0"
v-tooltip="book.book.series[0].name"
v-if="currentSeries != null"
v-tooltip="currentSeries.name"
class="badge mx-1"
:to="{ name: 'series', params: { seriesId: book.book.series[0].seriesId } }"
:to="{ name: 'series', params: { seriesId: currentSeries.seriesId } }"
>
#{{ book.book.series[0].numberInSeries }}
#{{ currentSeries.numberInSeries }}
</router-link>
<span
v-if="book.userAvgRating"
Expand Down
1 change: 1 addition & 0 deletions src/jelu-ui/src/components/SeriesBooks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ getBooks()
:force-select="selectAll"
:show-select="showSelect"
:propose-add="true"
:series-id="series.id"
class="h-full"
@update:modal-closed="modalClosed"
@update:checked="cardChecked"
Expand Down

0 comments on commit c15ac02

Please sign in to comment.