移动端不再默认打开详情面板
This commit is contained in:
@@ -141,9 +141,18 @@ const AlbumSharePage = ({ albumID, token, password }: AlbumSharePageProps) => {
|
|||||||
const album = data?.album
|
const album = data?.album
|
||||||
|
|
||||||
// Open the detail sidebar with the first (newest) photo when the page loads.
|
// Open the detail sidebar with the first (newest) photo when the page loads.
|
||||||
|
// On small screens the sidebar is a full-screen drawer, so leave it closed.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!album || openedAlbumID.current === album.id) return
|
if (!album || openedAlbumID.current === album.id) return
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof window === 'undefined' ||
|
||||||
|
typeof window.matchMedia !== 'function' ||
|
||||||
|
!window.matchMedia('(min-width: 1024px)').matches
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const firstMedia = album.media[0]
|
const firstMedia = album.media[0]
|
||||||
if (!firstMedia) return
|
if (!firstMedia) return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user