forked from gotson/komga
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(webui): lazy load collections on browse series
also adjusted layout for smaller screens
- Loading branch information
Showing
5 changed files
with
140 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<template> | ||
<v-expansion-panels v-model="collectionPanel"> | ||
<v-expansion-panel v-for="(c, index) in collections" | ||
:key="index" | ||
> | ||
<v-expansion-panel-header>{{ c.name }} collection</v-expansion-panel-header> | ||
<v-expansion-panel-content> | ||
<horizontal-scroller> | ||
<template v-slot:prepend> | ||
<router-link class="overline" | ||
:to="{name: 'browse-collection', params: {collectionId: c.id}}" | ||
>Manage collection | ||
</router-link> | ||
</template> | ||
<template v-slot:content> | ||
<item-browser :items="collectionsContent[index]" | ||
nowrap | ||
:selectable="false" | ||
:action-menu="false" | ||
:fixed-item-width="100" | ||
/> | ||
</template> | ||
</horizontal-scroller> | ||
</v-expansion-panel-content> | ||
</v-expansion-panel> | ||
</v-expansion-panels> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import HorizontalScroller from '@/components/HorizontalScroller.vue' | ||
import ItemBrowser from '@/components/ItemBrowser.vue' | ||
import Vue from 'vue' | ||
export default Vue.extend({ | ||
name: 'CollectionsExpansionPanels', | ||
components: { | ||
HorizontalScroller, | ||
ItemBrowser, | ||
}, | ||
props: { | ||
collections: { | ||
type: Array as () => CollectionDto[], | ||
required: true, | ||
}, | ||
}, | ||
data: () => { | ||
return { | ||
collectionPanel: undefined as number | undefined, | ||
collectionsContent: [[]] as any[], | ||
} | ||
}, | ||
watch: { | ||
collections: { | ||
handler (val) { | ||
this.collectionPanel = undefined | ||
this.collectionsContent = [...Array(val.length)].map(elem => new Array(0)) | ||
}, | ||
immediate: true, | ||
}, | ||
async collectionPanel (val) { | ||
if (val !== undefined) { | ||
const collId = this.collections[val].id | ||
if (this.$_.isEmpty(this.collectionsContent[val])) { | ||
const content = (await this.$komgaCollections.getSeries(collId, { unpaged: true } as PageRequest)).content | ||
this.collectionsContent.splice(val, 1, content) | ||
} | ||
} | ||
}, | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.