2022-06-08 00:07:04 +08:00
|
|
|
import Player from '@/web/components/New/PlayerMobile'
|
|
|
|
import { css, cx } from '@emotion/css'
|
|
|
|
import { useMemo } from 'react'
|
|
|
|
import { player } from '@/web/store'
|
|
|
|
import { useSnapshot } from 'valtio'
|
|
|
|
import Router from '@/web/components/New/Router'
|
|
|
|
import MenuBar from './MenuBar'
|
2022-06-25 13:47:07 +08:00
|
|
|
import Topbar from './Topbar/TopbarMobile'
|
2022-06-30 00:02:21 +08:00
|
|
|
import { isIOS, isIosPwa, isPWA, isSafari } from '@/web/utils/common'
|
2022-06-14 23:23:34 +08:00
|
|
|
import Login from './Login'
|
2022-06-25 13:47:07 +08:00
|
|
|
import { useLocation } from 'react-router-dom'
|
|
|
|
import PlayingNext from './PlayingNextMobile'
|
2022-06-08 00:07:04 +08:00
|
|
|
|
|
|
|
const LayoutMobile = () => {
|
|
|
|
const playerSnapshot = useSnapshot(player)
|
2022-06-11 00:19:07 +08:00
|
|
|
const showPlayer = !!playerSnapshot.track
|
2022-06-25 13:47:07 +08:00
|
|
|
const location = useLocation()
|
2022-06-08 00:07:04 +08:00
|
|
|
|
|
|
|
return (
|
2022-06-30 00:02:21 +08:00
|
|
|
<div id='layout' className='bg-white select-none pb-28 dark:bg-black'>
|
|
|
|
<main className='min-h-screen pb-16 overflow-x-hidden overflow-y-auto'>
|
2022-06-25 13:47:07 +08:00
|
|
|
{location.pathname === '/' && <Topbar />}
|
2022-06-08 00:07:04 +08:00
|
|
|
<Router />
|
|
|
|
</main>
|
2022-06-08 11:48:22 +08:00
|
|
|
<div
|
|
|
|
className={cx(
|
2022-06-25 13:47:07 +08:00
|
|
|
'fixed bottom-0 left-0 right-0 z-20 pt-3 dark:bg-black',
|
2022-06-08 11:48:22 +08:00
|
|
|
css`
|
|
|
|
padding-bottom: calc(
|
2022-06-30 00:02:21 +08:00
|
|
|
${isIosPwa ? '24px' : 'env(safe-area-inset-bottom)'} + 0.75rem
|
2022-06-08 11:48:22 +08:00
|
|
|
);
|
|
|
|
`
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
{showPlayer && (
|
|
|
|
<div
|
|
|
|
className={cx(
|
2022-06-25 13:47:07 +08:00
|
|
|
'absolute left-7 right-7 z-20',
|
2022-06-08 11:48:22 +08:00
|
|
|
css`
|
|
|
|
top: calc(
|
2022-06-30 00:02:21 +08:00
|
|
|
-100% - 6px + ${isIosPwa ? '24px' : 'env(safe-area-inset-bottom)'}
|
2022-06-08 11:48:22 +08:00
|
|
|
);
|
|
|
|
`
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<Player />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
|
2022-06-08 00:07:04 +08:00
|
|
|
<MenuBar />
|
2022-06-25 13:47:07 +08:00
|
|
|
{/* <PlayingNext /> */}
|
2022-06-08 00:07:04 +08:00
|
|
|
</div>
|
2022-06-09 20:16:05 +08:00
|
|
|
|
2022-06-14 23:23:34 +08:00
|
|
|
<Login />
|
|
|
|
|
2022-06-09 20:16:05 +08:00
|
|
|
{/* Notch background */}
|
2022-06-30 00:02:21 +08:00
|
|
|
{isIosPwa && (
|
2022-06-09 20:16:05 +08:00
|
|
|
<div
|
|
|
|
className={cx(
|
|
|
|
'fixed left-0 right-0 bg-black/30 backdrop-blur-sm',
|
|
|
|
css`
|
|
|
|
top: -50px;
|
|
|
|
height: 50px;
|
|
|
|
`
|
|
|
|
)}
|
|
|
|
></div>
|
|
|
|
)}
|
2022-06-08 00:07:04 +08:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default LayoutMobile
|