fix(journey): give the entry photo picker its own dialog

The entry editor capped the provider picker in a small panel, so filters and competing footers displaced the photo grid. Open the picker over the editor at the available height on desktop and at full screen on mobile. Keep queued photos and draft edits in the editor until it is saved.

Closes #3266
This commit is contained in:
Maurice
2026-11-30 22:10:01 +01:00
parent 8fc7745d59
commit 714fc6beaf
12 changed files with 289 additions and 288 deletions
+9 -3
View File
@@ -26,10 +26,14 @@ export interface DialogShellProps {
labelledBy: string
/** 520 px for a single question, 600 px for a detail, 720 px for an editor, 960 px for one in two columns. */
width?: keyof typeof PANEL_WIDTH
/** Fill the available height when the body is a browser with its own scrolling area. */
fillHeight?: boolean
/** 'top' pins the upper edge, so a dialog whose content changes height does not jump. */
align?: 'center' | 'top'
/** True while a question opened from here is being answered: Escape and the backdrop leave the dialog alone. */
blocked?: boolean
/** A separate dialog is open in front of this one. */
covered?: boolean
header: ReactNode
footer?: ReactNode
/** Makes the scrolling body a form. */
@@ -86,7 +90,7 @@ export function DialogShell({ open = true, ...frame }: DialogShellProps) {
return open ? <DialogFrame {...frame} /> : null
}
function DialogFrame({ onClose, labelledBy, width = 'detail', align = 'center', blocked = false, header, footer, onSubmit, children, bodyClassName, onPaste, discardGuard }: Omit<DialogShellProps, 'open'>) {
function DialogFrame({ onClose, labelledBy, width = 'detail', fillHeight = false, align = 'center', blocked = false, covered = false, header, footer, onSubmit, children, bodyClassName, onPaste, discardGuard }: Omit<DialogShellProps, 'open'>) {
const { t } = useTranslation()
const panelRef = useRef<HTMLDivElement>(null)
const pressedOn = useRef<EventTarget | null>(null)
@@ -95,7 +99,7 @@ function DialogFrame({ onClose, labelledBy, width = 'detail', align = 'center',
// The unsaved-changes question (#2253). The backdrop and Escape are the two
// ways out a hand can take by accident; both go through requestClose.
const { asking, markStart, requestClose, keepEditing, discard } = useDiscardGuard(discardGuard, onClose)
const held = blocked || asking
const held = blocked || covered || asking
useEffect(() => {
if (held) return
@@ -133,6 +137,8 @@ function DialogFrame({ onClose, labelledBy, width = 'detail', align = 'center',
return createPortal(
<div
role="presentation"
aria-hidden={covered || undefined}
inert={covered || undefined}
className={`${BACKDROP} ${align === 'top' ? 'items-start' : 'items-center'}`}
style={{ paddingTop: 40, paddingBottom: 'calc(40px + var(--bottom-nav-h, 0px))' }}
// Only a press that starts and ends on the backdrop closes: a selection
@@ -157,7 +163,7 @@ function DialogFrame({ onClose, labelledBy, width = 'detail', align = 'center',
}}
onPointerDownCapture={markStart}
onKeyDown={e => { if (panelRef.current) trapTab(e, panelRef.current) }}
className={`trek-modal-enter relative flex max-h-full w-full ${PANEL_WIDTH[width]} flex-col overflow-hidden rounded-[22px] bg-surface-card shadow-2xl outline-none`}
className={`trek-modal-enter relative flex max-h-full w-full ${PANEL_WIDTH[width]} flex-col overflow-hidden rounded-[22px] bg-surface-card shadow-2xl outline-none${fillHeight ? ' h-full' : ''}`}
>
{header}
{body}