feat(journey): photo provider buttons beside upload in the gallery header

This commit is contained in:
Maurice
2026-09-01 14:42:04 +02:00
committed by Maurice
parent 9f6cd3dc6d
commit a96bebc8bb
4 changed files with 71 additions and 40 deletions
+25 -10
View File
@@ -10,7 +10,7 @@ import EmptyState from '../components/shared/EmptyState'
import { Outlet } from 'react-router'
import {
ArrowLeft, MoreHorizontal, List, Grid, MapPin,
Plus, ChevronUp, ChevronDown, Eye, EyeOff, BookOpen,
Plus, ChevronUp, ChevronDown, Eye, EyeOff, BookOpen, Image,
} from 'lucide-react'
import MobileMapTimeline from '../components/Journey/MobileMapTimeline'
import MobileEntryView from '../components/Journey/MobileEntryView'
@@ -44,7 +44,8 @@ function JourneyDetailPageDesktop() {
showInvite, setShowInvite, showAddTrip, setShowAddTrip,
unlinkTrip, setUnlinkTrip, showSettings, setShowSettings,
hideSkeletons, setHideSkeletons,
mapRef, fullMapRef, galleryUploadRef, activeLocationId, handleMarkerClick, handleLocationClick,
mapRef, fullMapRef, galleryUploadRef, galleryProviders, setGalleryProviders, galleryBrowseRef,
activeLocationId, handleMarkerClick, handleLocationClick,
mapEntries, sidebarMapItems, tripDates, isMobile, tracks,
feedEdge, scrollFeedTo,
loadJourney, updateEntry, deleteEntry, reorderEntries, uploadPhotos, deletePhoto,
@@ -346,14 +347,27 @@ function JourneyDetailPageDesktop() {
</button>
)}
{canEditEntries && view === 'gallery' && (
<button type="button"
onClick={() => galleryUploadRef.current?.()}
className="inline-flex items-center gap-1.5 h-9 px-4 rounded-full text-[13px] font-semibold transition-transform hover:-translate-y-0.5"
style={{ background: 'var(--vg-ink)', color: 'var(--vg-bg)' }}
>
<Plus size={16} strokeWidth={2.4} />
{t('common.upload')}
</button>
<div className="flex items-center gap-2">
{galleryProviders.map(p => (
<button type="button"
key={p.id}
onClick={() => galleryBrowseRef.current?.(p.id)}
className="inline-flex items-center gap-1.5 h-9 px-4 rounded-full text-[13px] font-semibold transition-transform hover:-translate-y-0.5"
style={{ background: 'var(--vg-ink)', color: 'var(--vg-bg)' }}
>
<Image size={16} strokeWidth={2.4} />
{p.name}
</button>
))}
<button type="button"
onClick={() => galleryUploadRef.current?.()}
className="inline-flex items-center gap-1.5 h-9 px-4 rounded-full text-[13px] font-semibold transition-transform hover:-translate-y-0.5"
style={{ background: 'var(--vg-ink)', color: 'var(--vg-bg)' }}
>
<Plus size={16} strokeWidth={2.4} />
{t('common.upload')}
</button>
</div>
)}
</div>
@@ -452,6 +466,7 @@ function JourneyDetailPageDesktop() {
>
<GalleryView
onRegisterUpload={(fn) => { galleryUploadRef.current = fn }}
onRegisterProviders={(providers, browse) => { setGalleryProviders(providers); galleryBrowseRef.current = browse }}
entries={current.entries}
gallery={current.gallery || []}
journeyId={current.id}
@@ -31,6 +31,11 @@ export function useJourneyDetail() {
const fullMapRef = useRef<JourneyMapHandle>(null)
/** The gallery hands its file picker up here, so the hero button can open it. */
const galleryUploadRef = useRef<(() => void) | null>(null)
/** Same deal for photo providers: the gallery probes which ones are
connected and reports them up, so the header can render an Immich/
Synology button next to Upload. */
const [galleryProviders, setGalleryProviders] = useState<{ id: string; name: string }[]>([])
const galleryBrowseRef = useRef<((provider: string) => void) | null>(null)
const [activeLocationId, setActiveLocationId] = useState<string | null>(null)
const isMobile = useIsMobile()
@@ -384,7 +389,8 @@ export function useJourneyDetail() {
showInvite, setShowInvite, showAddTrip, setShowAddTrip,
unlinkTrip, setUnlinkTrip, showSettings, setShowSettings,
hideSkeletons, setHideSkeletons,
mapRef, fullMapRef, galleryUploadRef, activeLocationId, handleMarkerClick, handleLocationClick,
mapRef, fullMapRef, galleryUploadRef, galleryProviders, setGalleryProviders, galleryBrowseRef,
activeLocationId, handleMarkerClick, handleLocationClick,
mapEntries, sidebarMapItems, tripDates, isMobile, tracks,
feedEdge, scrollFeedTo,
loadJourney, updateEntry, deleteEntry, reorderEntries, uploadPhotos, deletePhoto,