From c62f24bb9de3ae1dcdf6a5d37c336eed3a008eb6 Mon Sep 17 00:00:00 2001 From: gallery Date: Sun, 15 Nov 2026 20:42:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E6=94=B6=E7=AA=84=E8=87=B3=20380px=EF=BC=9B=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E9=A1=B5=E5=8A=A0=E8=BD=BD=E6=97=B6=E8=87=AA=E5=8A=A8=E6=89=93?= =?UTF-8?q?=E5=BC=80=E9=A6=96=E5=BC=A0=E7=85=A7=E7=89=87=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/Pages/SharePage/AlbumSharePage.tsx | 22 +++++++++++++++++++--- ui/src/components/header/Header.tsx | 2 +- ui/src/components/layout/Layout.tsx | 2 +- ui/src/components/messages/Messages.tsx | 2 +- ui/src/components/sidebar/Sidebar.tsx | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ui/src/Pages/SharePage/AlbumSharePage.tsx b/ui/src/Pages/SharePage/AlbumSharePage.tsx index ae6eef8..8d132f8 100644 --- a/ui/src/Pages/SharePage/AlbumSharePage.tsx +++ b/ui/src/Pages/SharePage/AlbumSharePage.tsx @@ -1,6 +1,8 @@ -import React from 'react' +import React, { useContext, useEffect, useRef } from 'react' import Layout from '../../components/layout/Layout' import AlbumGallery from '../../components/albumGallery/AlbumGallery' +import { SidebarContext } from '../../components/sidebar/Sidebar' +import MediaSidebar from '../../components/sidebar/MediaSidebar/MediaSidebar' import styled from 'styled-components' import { gql, useQuery } from '@apollo/client' import { useTranslation } from 'react-i18next' @@ -103,6 +105,9 @@ type AlbumSharePageProps = { const AlbumSharePage = ({ albumID, token, password }: AlbumSharePageProps) => { const { t } = useTranslation() + const { updateSidebar } = useContext(SidebarContext) + const openedAlbumID = useRef(null) + const urlParams = useURLParameters() const orderParams = useOrderingParams( urlParams, @@ -133,12 +138,23 @@ const AlbumSharePage = ({ albumID, token, password }: AlbumSharePageProps) => { getItems: data => data.album.media, }) + const album = data?.album + + // Open the detail sidebar with the first (newest) photo when the page loads. + useEffect(() => { + if (!album || openedAlbumID.current === album.id) return + + const firstMedia = album.media[0] + if (!firstMedia) return + + openedAlbumID.current = album.id + updateSidebar() + }, [album, updateSidebar]) + if (error) { return
{error.message}
} - const album = data?.album - return ( {

diff --git a/ui/src/components/layout/Layout.tsx b/ui/src/components/layout/Layout.tsx index 1f075f9..fe7a6f9 100644 --- a/ui/src/components/layout/Layout.tsx +++ b/ui/src/components/layout/Layout.tsx @@ -37,7 +37,7 @@ const Layout = ({ children, title, ...otherProps }: LayoutProps) => {
diff --git a/ui/src/components/messages/Messages.tsx b/ui/src/components/messages/Messages.tsx index 606544c..d65cccd 100644 --- a/ui/src/components/messages/Messages.tsx +++ b/ui/src/components/messages/Messages.tsx @@ -11,7 +11,7 @@ const Container = styled.div` bottom: 20px; right: 20px; /* Match the sidebar width */ - width: 420px; + width: 380px; /* Keep notifications above the sidebar (z-40) and modals (z-40) */ z-index: 50; diff --git a/ui/src/components/sidebar/Sidebar.tsx b/ui/src/components/sidebar/Sidebar.tsx index 4e052a6..ce169e7 100644 --- a/ui/src/components/sidebar/Sidebar.tsx +++ b/ui/src/components/sidebar/Sidebar.tsx @@ -113,7 +113,7 @@ export const Sidebar = () => { content == null && !pinned ? 'translate-x-full' : 'translate-x-0' } ${ pinned ? 'lg:border-l' : 'lg:shadow-separator' - } lg:w-[420px] lg:right-0 lg:top-0 lg:z-40`} + } lg:w-[380px] lg:right-0 lg:top-0 lg:z-40`} > {content}