diff --git a/src/components/manga/MangaEntryDetailsModal.vue b/src/components/manga/MangaEntryDetailsModal.vue new file mode 100644 index 0000000..2f23c9f --- /dev/null +++ b/src/components/manga/MangaEntryDetailsModal.vue @@ -0,0 +1,126 @@ + + + + + \ No newline at end of file diff --git a/src/components/manga/MangaListTable.vue b/src/components/manga/MangaListTable.vue index e8da0b0..1a12323 100644 --- a/src/components/manga/MangaListTable.vue +++ b/src/components/manga/MangaListTable.vue @@ -5,6 +5,8 @@ import {BTable, type TableItem} from 'bootstrap-vue-next'; import type {TableFieldObject} from 'bootstrap-vue-next/dist/src/types'; import type {MangaUpdatesChapter} from '@/data/models/mangaupdates/MangaUpdatesChapter'; import type {ViewEntry, ViewList} from '@/components/manga/MangaList.vue'; +import MangaEntryDetailsModal from '@/components/manga/MangaEntryDetailsModal.vue'; +import {latestChaptersSorted, latestChapterString, newChapterCount} from '@/components/manga/util.manga'; type HeadData = { label: string, @@ -25,7 +27,7 @@ type CellData = { @Options({ name: 'MangaListTable', - components: {BTable}, + components: {BTable, MangaEntryDetailsModal}, }) export default class MangaListTable extends Vue { @Prop({required: true}) @@ -33,39 +35,46 @@ export default class MangaListTable extends Vue { bTableRefreshHack = true; + //methods + latestChaptersSorted = latestChaptersSorted; + latestChapterString = latestChapterString; + newChapterCount = newChapterCount; + get fields(): TableFieldObject[] { return [{ key: 'media.coverImage.large', label: '', sortable: true, + tdClass: 'c-pointer', }, { key: 'media.title.userPreferred', label: this.$t('manga.title'), sortable: true, + tdClass: 'c-pointer', }, { key: 'entry.score', label: this.$t('manga.score'), sortable: true, - tdClass: 'text-center manga-column-score', + tdClass: 'text-center manga-column-score c-pointer', thClass: 'text-center manga-column-score', }, { key: 'entry.progress', label: this.$t('manga.progress'), sortable: true, - tdClass: 'text-end text-nowrap', + tdClass: 'text-end text-nowrap c-pointer', thClass: 'text-end', }, { key: 'newChapters', formatter: (value: never, key: never, item: ViewEntry) => this.newChapterCount(item), label: this.$t('manga.chapters.newCount'), sortable: true, - tdClass: 'text-end', + tdClass: 'text-end c-pointer', thClass: 'text-end', }, { key: 'latestChapters', label: this.$t('manga.chapters.latest'), sortable: true, - tdClass: 'manga-column-latest-chapters', + tdClass: 'manga-column-latest-chapters c-pointer', thClass: 'manga-column-latest-chapters', }]; } @@ -74,24 +83,6 @@ export default class MangaListTable extends Vue { return this.viewList.entries; } - newChapterCount(entry: ViewEntry): number { - const max = entry.media?.chapters || entry.chapters.reduce((l, r) => Math.max(l, r.chapter), 0); - return Math.max(0, max - entry.entry.progress); - } - - lastestChapterString(entry: ViewEntry): string { - if (entry.media?.chapters) { - return '' + entry.media.chapters; - } else if (entry.chapters.length) { - return entry.chapters.reduce((l, r) => Math.max(l, r.chapter), 0) + '+'; - } - return '?'; - } - - latestChaptersSorted(entry: ViewEntry): MangaUpdatesChapter[] { - return entry.chapters.sort((l, r) => l.chapter - r.chapter); - } - cd(data: V): CellData { return (data as CellData); } @@ -100,6 +91,10 @@ export default class MangaListTable extends Vue { return (data as HeadData); } + onRowClicked(entry: TableItem): void { + (this.$refs.detailsModal as MangaEntryDetailsModal).open(entry); + } + @Watch('viewList', {deep: true}) private onViewListChanged(): void { this.bTableRefreshHack = false; @@ -113,54 +108,59 @@ export default class MangaListTable extends Vue {