移动端不再默认打开详情面板

This commit is contained in:
gallery
2026-11-15 23:21:28 +08:00
parent 5ea5cd9e1d
commit 2899666724
@@ -141,9 +141,18 @@ const AlbumSharePage = ({ albumID, token, password }: AlbumSharePageProps) => {
const album = data?.album
// 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(() => {
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]
if (!firstMedia) return