Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Feat/book series info #3839

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions client/components/modals/EditSeriesModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<template>
<modals-modal v-model="show" name="edit-series" :processing="isProcessing" :width="500" :height="'unset'">
<div ref="container" class="w-full rounded-lg bg-bg box-shadow-md overflow-y-auto overflow-x-hidden p-4" style="max-height: 80vh; min-height: 40vh">
<h3 class="text-xl font-semibold mb-8">{{ $strings.LabelEditSeries }}</h3>
<div class="flex items-center mb-4">
<ui-textarea-with-label v-model="descriptionValue" :label="$strings.LabelSeriesDescription" :rows="8" />
</div>
<div class="absolute bottom-0 left-0 w-full py-2 md:py-4 bg-bg border-t border-white border-opacity-5">
<div class="flex items-center px-4">
<div class="flex-grow" />

<!-- desktop -->
<ui-btn @click="save" class="mx-2 hidden md:block">{{ $strings.ButtonSave }}</ui-btn>
<ui-btn @click="saveAndClose" class="mx-2 hidden md:block">{{ $strings.ButtonSaveAndClose }}</ui-btn>
<!-- mobile -->
<ui-btn @click="saveAndClose" class="mx-2 md:hidden">{{ $strings.ButtonSave }}</ui-btn>
</div>
</div>
</div>
</modals-modal>
</template>

<script>
export default {
props: {
value: Boolean,
series: Object
},
data() {
return {
isProcessing: false,
descriptionValue: this.series.description || ''
}
},
computed: {
show: {
get() {
return this.value
},
set(val) {
this.$emit('input', val)
}
}
},
methods: {
async save() {
if (this.isProcessing) {
return null
}

const payload = {
description: this.descriptionValue
}

this.isProcessing = true
const updateResult = await this.$axios.$patch(`/api/series/${this.series.id}`, payload).catch((error) => {
console.error('Failed to update', error)
return false
})
this.isProcessing = false
},
async saveAndClose() {
const wasUpdated = await this.save()
if (wasUpdated !== null) this.show = false
}
}
}
</script>
39 changes: 35 additions & 4 deletions client/pages/library/_library/series/_id.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
<template>
<div class="page" :class="streamLibraryItem ? 'streaming' : ''">
<app-book-shelf-toolbar :selected-series="series" />
<app-lazy-bookshelf page="series-books" :series-id="seriesId" />
<div id="page-wrapper" class="page" :class="streamLibraryItem ? 'streaming' : ''">
<app-book-shelf-toolbar id="series-toolbar" :selected-series="series" />
<div class="max-w-6xl mx-auto">
<div class="flex items-center my-8">
<h1 class="text-2xl">{{ series.name }}</h1>

<button class="w-8 h-8 rounded-full flex items-center justify-center mx-4 cursor-pointer text-gray-300 hover:text-warning transform hover:scale-125 duration-100" @click="showEditSeries">
<span class="material-symbols text-base">edit</span>
</button>
</div>
<div class="mb-6">
<h2 class="font-semibold">
{{ $strings.LabelDescription }}
</h2>
<div>{{ series.description }}</div>
</div>
<app-lazy-bookshelf page="series-books" :series-id="seriesId" />
</div>

<modals-edit-series-modal v-model="showEditSeriesModal" :series="series" />
</div>
</template>

Expand Down Expand Up @@ -33,7 +50,9 @@ export default {
}
},
data() {
return {}
return {
showEditSeriesModal: false
}
},
computed: {
streamLibraryItem() {
Expand All @@ -43,6 +62,9 @@ export default {
methods: {
seriesUpdated(series) {
this.series = series
},
showEditSeries() {
this.showEditSeriesModal = !this.showEditSeriesModal
}
},
mounted() {
Expand All @@ -57,3 +79,12 @@ export default {
}
}
</script>

<style scoped>
#bookshelf {
background-image: none;
}
#series-toolbar {
background-color: rgba(55, 56, 56, 1);
}
</style>
2 changes: 2 additions & 0 deletions client/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Edit",
"LabelEditSeries": "Edit Series",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsRejectUnauthorized": "Reject unauthorized certificates",
Expand Down Expand Up @@ -543,6 +544,7 @@
"LabelSequence": "Sequence",
"LabelSerial": "Serial",
"LabelSeries": "Series",
"LabelSeriesDescription": "Series Description",
"LabelSeriesName": "Series Name",
"LabelSeriesProgress": "Series Progress",
"LabelServerLogLevel": "Server Log Level",
Expand Down
Loading