diff --git a/assets/vue/app/domain/manga/presentation/components/MangaVolume.vue b/assets/vue/app/domain/manga/presentation/components/MangaVolume.vue index d8b4ab7..241bc93 100644 --- a/assets/vue/app/domain/manga/presentation/components/MangaVolume.vue +++ b/assets/vue/app/domain/manga/presentation/components/MangaVolume.vue @@ -83,7 +83,7 @@ ChevronUpIcon, MagnifyingGlassIcon } from '@heroicons/vue/24/outline'; -import { ref } from 'vue'; +import { ref, watch } from 'vue'; import { useMangaStore } from '../../application/store/mangaStore'; import MangaChapterList from './MangaChapterList.vue'; @@ -106,13 +106,21 @@ import MangaChapterList from './MangaChapterList.vue'; } }); + const emit = defineEmits(['toggle']); + const store = useMangaStore(); const isOpen = ref(props.isOpen); const isSearching = ref(false); const isDownloading = ref(false); + // Synchroniser l'état local avec la prop + watch(() => props.isOpen, (newValue) => { + isOpen.value = newValue; + }); + const toggleVolume = () => { isOpen.value = !isOpen.value; + emit('toggle', props.volume.number); }; const handleSearch = async () => { diff --git a/assets/vue/app/domain/manga/presentation/components/MangaVolumeList.vue b/assets/vue/app/domain/manga/presentation/components/MangaVolumeList.vue index e04be61..4623b87 100644 --- a/assets/vue/app/domain/manga/presentation/components/MangaVolumeList.vue +++ b/assets/vue/app/domain/manga/presentation/components/MangaVolumeList.vue @@ -6,12 +6,14 @@ :volume="volume" :mangaSlug="mangaSlug" :mangaId="mangaId" - :isOpen="index === 0" /> + :isOpen="expandedVolumes.has(volume.number)" + @toggle="handleVolumeToggle" /> diff --git a/assets/vue/app/domain/manga/presentation/pages/MangaDetails.vue b/assets/vue/app/domain/manga/presentation/pages/MangaDetails.vue index 070d4c2..5ba9664 100644 --- a/assets/vue/app/domain/manga/presentation/pages/MangaDetails.vue +++ b/assets/vue/app/domain/manga/presentation/pages/MangaDetails.vue @@ -27,7 +27,13 @@
{{ errorVolumes.message || 'Une erreur est survenue lors du chargement des volumes.' }}
- + @@ -80,8 +86,8 @@ BookmarkIcon, BookmarkSlashIcon, ChevronDoubleDownIcon, + ChevronDoubleUpIcon, Cog6ToothIcon, - DocumentArrowDownIcon, PencilSquareIcon, TrashIcon, WrenchIcon @@ -118,6 +124,10 @@ import { useMangaStore } from '../../application/store/mangaStore'; const isSavingChapters = ref(false); const chaptersError = ref(null); + // État d'expansion des volumes + const isAllExpanded = ref(false); + const volumeListRef = ref(null); + const { data: currentManga, isLoading: isLoadingDetails, @@ -270,6 +280,17 @@ import { useMangaStore } from '../../application/store/mangaStore'; } }; + // Fonction pour étendre/réduire tous les volumes + const handleExpandAll = () => { + if (!volumeListRef.value) return; + + if (isAllExpanded.value) { + volumeListRef.value.collapseAllVolumes(); + } else { + volumeListRef.value.expandAllVolumes(); + } + }; + const toolbarConfig = computed(() => ({ leftSection: [ { @@ -286,12 +307,6 @@ import { useMangaStore } from '../../application/store/mangaStore'; type: 'button', onClick: openManageChaptersModal }, - { - icon: DocumentArrowDownIcon, - label: 'Manage cbz', - type: 'button', - onClick: () => console.log('Manage cbz') - }, { icon: Cog6ToothIcon, label: 'Preferred Sources', @@ -322,10 +337,11 @@ import { useMangaStore } from '../../application/store/mangaStore'; onClick: () => console.log('Delete') }, { - icon: ChevronDoubleDownIcon, - label: 'Expand all', + icon: isAllExpanded.value ? ChevronDoubleUpIcon : ChevronDoubleDownIcon, + label: isAllExpanded.value ? 'Collapse all' : 'Expand all', type: 'button', - onClick: () => console.log('Expand all') + onClick: handleExpandAll, + variant: isAllExpanded.value ? 'active' : 'default' } ] }));