@@ -3,11 +3,14 @@ import librarySelectArea from './modules/librarySelectArea.vue'
33import libraryArea from ' ./modules/libraryArea.vue'
44import pioneerDeviceLibraryArea from ' ./modules/pioneerDeviceLibraryArea.vue'
55import songsArea from ' ./modules/songsArea/songsArea.vue'
6+ import SongsAreaPreviewHost from ' ./homePage/SongsAreaPreviewHost'
7+ import { useSongsAreaPaneViews } from ' ./homePage/useSongsAreaPaneViews'
68import pioneerSongsArea from ' ./modules/pioneerSongsArea.vue'
79import {
810 type ISongsAreaPaneRuntimeState ,
911 type LibrarySelection ,
1012 type SplitSongsAreaPaneKey ,
13+ type SongsAreaPaneKey ,
1114 useRuntimeStore
1215} from ' @renderer/stores/runtime'
1316import { onMounted , onUnmounted , ref , computed , watch } from ' vue'
@@ -164,7 +167,6 @@ onUnmounted(() => {
164167
165168let librarySelected = ref (' FilterLibrary' )
166169type CoreLibraryName = ' FilterLibrary' | ' CuratedLibrary' | ' SetLibrary' | ' MixtapeLibrary'
167- const splitPaneKeys: SplitSongsAreaPaneKey [] = [' left' , ' right' ]
168170const normalizeLibraryPath = (value : string ) => (value || ' ' ).replace (/ \\ / g , ' /' )
169171const isCoreLibraryName = (value : string ): value is CoreLibraryName =>
170172 [' FilterLibrary' , ' CuratedLibrary' , ' SetLibrary' , ' MixtapeLibrary' ].includes (value )
@@ -385,6 +387,7 @@ const showMainSongPlayer = computed(
385387const isSongsAreaSplit = computed (
386388 () => runtime .songsAreaPanels .splitEnabled && ! isPioneerDeviceLibraryView .value
387389)
390+ const visiblePaneViews = useSongsAreaPaneViews (runtime .songsAreaPanels .panes , isSongsAreaSplit )
388391const showEmptyRecycleBinButton = computed (
389392 () =>
390393 isRecycleBinView .value &&
@@ -438,9 +441,8 @@ watch(
438441 singlePaneHeaderRevealPending .value = false
439442 }
440443)
441- const isSplitPaneActive = (pane : SplitSongsAreaPaneKey ) =>
442- runtime .songsAreaPanels .activePane === pane
443- const handleSplitPaneMouseDown = (pane : SplitSongsAreaPaneKey ) => {
444+ const isSplitPaneActive = (pane : SongsAreaPaneKey ) => runtime .songsAreaPanels .activePane === pane
445+ const handleSplitPaneMouseDown = (pane : SongsAreaPaneKey ) => {
444446 // 激活歌曲操作的目标面板,不联动左侧正在浏览的库。
445447 activateSongsAreaPane (runtime , pane )
446448}
@@ -760,34 +762,41 @@ const drop = async (e: DragEvent) => {
760762 style =" width : 100% ; height : 100% ; min-width : 0 "
761763 />
762764 <div
763- v-else-if = " isSongsAreaSplit "
765+ v-else
764766 ref =" splitSongsAreaRef"
765- class =" splitSongsArea"
766- :style =" splitSongsAreaStyle"
767+ : class =" isSongsAreaSplit ? ' splitSongsArea' : 'singleSongsAreaShell' "
768+ :style =" isSongsAreaSplit ? splitSongsAreaStyle : undefined "
767769 >
770+ <SongsAreaPreviewHost />
768771 <div
769- v-for =" pane in splitPaneKeys"
770- :key =" pane"
771- class =" splitSongsAreaPane"
772- :class =" [`splitSongsAreaPane--${pane}`, { 'is-active': isSplitPaneActive(pane) }]"
772+ v-for =" { pane, viewId } in visiblePaneViews"
773+ :key =" viewId"
774+ :class ="
775+ isSongsAreaSplit
776+ ? [
777+ 'splitSongsAreaPane',
778+ `splitSongsAreaPane--${pane}`,
779+ { 'is-active': isSplitPaneActive(pane) }
780+ ]
781+ : 'singleSongsAreaShell'
782+ "
783+ :style =" !isSongsAreaSplit ? { flex: 1, minHeight: 0 } : undefined"
773784 @mousedown.capture =" handleSplitPaneMouseDown(pane)"
774785 >
775786 <SongsAreaPaneHeader
787+ v-if =" isSongsAreaSplit || showSingleSongsAreaHeader "
776788 :pane =" pane "
777789 v-model :search-query =" runtime .songsAreaPanels .panes [pane ].searchQuery "
778790 v-model :compatible-key-only =" runtime .songsAreaPanels .panes [pane ].compatibleKeyOnly "
779791 :title =" resolveSongsPaneTitle (pane )"
780792 :show-empty-recycle-bin-button =" showEmptyRecycleBinButton "
781793 @empty-recycle-bin =" emptyRecycleBinWithOptimisticUpdate (runtime )"
782- @close =" handleSplitPaneClose (pane )"
783- />
784- <songsArea
785- :pane =" pane"
786- :enable-preview-player =" pane === 'left'"
787- style =" flex : 1 ; min-width : 0 ; min-height : 0 "
794+ @close =" pane === ' single' ? handleSinglePaneClose () : handleSplitPaneClose (pane )"
788795 />
796+ <songsArea :pane =" pane" style =" flex : 1 ; min-width : 0 ; min-height : 0 " />
789797 </div >
790798 <div
799+ v-if =" isSongsAreaSplit"
791800 class =" splitSongsAreaDivider"
792801 :class =" {
793802 'is-hovered': splitDividerHovered,
@@ -800,23 +809,6 @@ const drop = async (e: DragEvent) => {
800809 @mouseleave =" splitDividerHovered = isSongsAreaSplitDividerResizing"
801810 ></div >
802811 </div >
803- <div v-else class =" singleSongsAreaShell" >
804- <SongsAreaPaneHeader
805- v-if =" showSingleSongsAreaHeader "
806- pane="single"
807- v-model :search-query =" runtime .songsAreaPanels .panes .single .searchQuery "
808- v-model :compatible-key-only =" runtime .songsAreaPanels .panes .single .compatibleKeyOnly "
809- :title =" resolveSongsPaneTitle (' single' )"
810- :show-empty-recycle-bin-button =" showEmptyRecycleBinButton "
811- @empty-recycle-bin =" emptyRecycleBinWithOptimisticUpdate (runtime )"
812- @close =" handleSinglePaneClose "
813- />
814- <songsArea
815- pane =" single"
816- :enable-preview-player =" true"
817- style =" flex : 1 ; min-width : 0 ; min-height : 0 "
818- />
819- </div >
820812 </div >
821813 </div >
822814 <div class =" mainPlayerShell" :class =" { 'mainPlayerShell--visible': showMainSongPlayer }" >
0 commit comments