@@ -46,7 +46,10 @@ const CommonList = (
4646 const [ dialogOpen , setDialogOpen ] = useState ( false )
4747 const [ selectIndex , setSelectIndex ] = useState < number | null > ( null )
4848 const [ selectIndexArray , setSelectIndexArray ] = useState < number [ ] > ( [ ] )
49+
4950 const isSelectMode = selectIndexArray . length > 0
51+ const shuffleDisplay = listData . filter ( item => item . fileType === 'audio' || item . fileType === 'video' ) . length > 0
52+ const playAllDisplay = shuffleDisplay || listData . filter ( item => item . fileType === 'folder' && / ^ ( d i s c | d i s k ) \s * \d + $ / . test ( item . fileName . toLocaleLowerCase ( ) ) ) . length > 0
5053
5154 const addSelectIndex = ( index : number ) => { setSelectIndexArray ( [ ...selectIndexArray , index ] . sort ( ) ) }
5255
@@ -222,24 +225,24 @@ const CommonList = (
222225 const scroll = scrollRef . current
223226 const fab = fabRef . current
224227 if ( fab && isSelectMode ) {
225- fab . style . visibility = 'visible '
228+ fab . style . transform = 'translateY(0) '
226229 } else if ( scroll && fab && ! isSelectMode ) {
227230 const onWheel = ( e : WheelEvent ) => {
228231 if ( e . deltaY > 0 )
229- fab . style . visibility = 'hidden '
232+ fab . style . transform = 'translateY(200%) '
230233 else
231- fab . style . visibility = 'visible '
234+ fab . style . transform = 'translateY(0) '
232235 }
233236 const onTouchStart = ( e : TouchEvent ) => {
234237 touchStartYRef . current = ( e . touches [ 0 ] . clientY )
235238 }
236239 const onTouchMove = ( e : TouchEvent ) => {
237240 if ( e . touches [ 0 ] . clientY > touchStartYRef . current ) {
238- fab . style . visibility = 'visible '
241+ fab . style . transform = 'translateY(0) '
239242 touchStartYRef . current = ( e . touches [ 0 ] . clientY )
240243 }
241244 else {
242- fab . style . visibility = 'hidden '
245+ fab . style . transform = 'translateY(200%) '
243246 touchStartYRef . current = ( e . touches [ 0 ] . clientY )
244247 }
245248
@@ -256,7 +259,7 @@ const CommonList = (
256259 } , [ isSelectMode ] )
257260
258261 return (
259- < Box sx = { { height : '100%' , width : '100%' , position : 'relative' } } >
262+ < Box sx = { { height : '100%' , width : '100%' , position : 'relative' , overflow : 'hidden' } } >
260263
261264 { /* 文件列表 */ }
262265 < Grid container sx = { { flexDirection : 'column' , flexWrap : 'nowrap' , height : '100%' } } >
@@ -344,6 +347,7 @@ const CommonList = (
344347 justifyContent : 'center' ,
345348 alignItems : 'center' ,
346349 gap : '0.5rem' ,
350+ transition : 'all 0.2s ease-out' ,
347351 } }
348352 >
349353 {
@@ -355,13 +359,19 @@ const CommonList = (
355359 {
356360 ( listType !== 'playQueue' ) && ! isSelectMode && ! disableFAB &&
357361 < >
358- < Fab size = 'small' onClick = { handleClickShuffleAll } >
359- < ShuffleRoundedIcon />
360- </ Fab >
361- < Fab variant = 'extended' color = 'primary' onClick = { handleClickPlayAll } >
362- < PlayArrowRoundedIcon />
363- < span style = { { marginLeft : '0.5rem' } } > { t `Play all` } </ span >
364- </ Fab >
362+ {
363+ shuffleDisplay &&
364+ < Fab size = 'small' onClick = { handleClickShuffleAll } >
365+ < ShuffleRoundedIcon />
366+ </ Fab >
367+ }
368+ {
369+ playAllDisplay &&
370+ < Fab variant = 'extended' color = 'primary' onClick = { handleClickPlayAll } >
371+ < PlayArrowRoundedIcon />
372+ < span style = { { marginLeft : '0.5rem' } } > { t `Play all` } </ span >
373+ </ Fab >
374+ }
365375 </ >
366376 }
367377
0 commit comments