mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
feat(mobile): TREK Studio opens over the journey on an iPad on its side and an unfolded Duo
Studio is a child route of the journey, opened on top of it. The touch shell's journey now renders that child in the split size class, where the header offers Studio beside the menu, as the desktop's bar does. The editor is the desktop's: tapping a panel, adding an element and dragging it with a finger work through its pointer events. On the phone and in a single pane the journey stays alone, whatever the address says, and offers no Studio.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'
|
||||
import { useSearchParams } from 'react-router'
|
||||
import { ChevronLeft, MapPin, Grid3x3, MoreHorizontal, Play, Image, Camera, EyeOff, Settings2, X, Route, ListChecks } from 'lucide-react'
|
||||
import { Outlet, useSearchParams } from 'react-router'
|
||||
import { BookOpen, ChevronLeft, MapPin, Grid3x3, MoreHorizontal, Play, Image, Camera, EyeOff, Settings2, X, Route, ListChecks } from 'lucide-react'
|
||||
import JourneyLayeredMap from '../../../components/Journey/JourneyLayeredMap'
|
||||
import PhotoLightbox from '../../../components/Journey/PhotoLightbox'
|
||||
import ContributorInviteDialog from '../../../components/Journey/ContributorInviteDialog'
|
||||
@@ -324,8 +324,9 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD
|
||||
// keeps a single "more" affordance.
|
||||
//
|
||||
// There is no book export here any more: the book is a Studio document now,
|
||||
// and Studio is a desktop editor. A phone-sized PDF of a book laid out for
|
||||
// print was the old export's answer to a question nobody was asking.
|
||||
// and Studio needs the room of a desktop, an iPad on its side or an unfolded
|
||||
// Duo (split), where the header offers it. A phone-sized PDF of a book laid
|
||||
// out for print was the old export's answer to a question nobody was asking.
|
||||
const toggleSkeletons = async (next: boolean) => {
|
||||
setHideSkeletons(next)
|
||||
try {
|
||||
@@ -498,6 +499,16 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD
|
||||
<span className="h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" />
|
||||
</span>
|
||||
)}
|
||||
{split && !embedded && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void navigate(`/journey/${current.id}/studio`)}
|
||||
aria-label={t('journey.studio.openAria')}
|
||||
className="flex h-[38px] w-[38px] items-center justify-center rounded-full bg-[color:var(--m-sheet)] text-m-ink shadow-[0_5px_14px_-6px_rgba(0,0,0,.3)]"
|
||||
>
|
||||
<BookOpen size={17} strokeWidth={2} />
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowActionMenu(true)}
|
||||
@@ -805,6 +816,10 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD
|
||||
onClose={() => setLightbox(null)}
|
||||
/>
|
||||
)}
|
||||
{/* TREK Studio, the book designer, opens over the journey on a screen with room for
|
||||
two panes, as on the desktop (its route is a child of this one). The phone keeps
|
||||
the journey alone, whatever the address says. */}
|
||||
{split && !embedded && <Outlet />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// FE-MOB-JDET-001 to FE-MOB-JDET-050
|
||||
// FE-MOB-JDET-001 to FE-MOB-JDET-052
|
||||
import { describe, it, expect, beforeEach, afterEach, onTestFinished, vi } from 'vitest';
|
||||
import { setSizeClass } from '../../../helpers/sizeClass';
|
||||
import { render, screen, fireEvent, waitFor, act } from '../../../helpers/render';
|
||||
@@ -830,4 +830,16 @@ describe('MJourneyDetail', () => {
|
||||
setup({ view: 'gallery' });
|
||||
expect(screen.queryByText('journey.detail.day')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-MOB-JDET-051: with room for two panes the header opens Studio over the journey', () => {
|
||||
setSizeClass('split');
|
||||
const { hook } = setup();
|
||||
fireEvent.click(screen.getByRole('button', { name: 'journey.studio.openAria' }));
|
||||
expect(hook.navigate).toHaveBeenCalledWith(expect.stringMatching(/^\/journey\/\d+\/studio$/));
|
||||
});
|
||||
|
||||
it('FE-MOB-JDET-052: the phone and a single pane offer no Studio', () => {
|
||||
setup();
|
||||
expect(screen.queryByRole('button', { name: 'journey.studio.openAria' })).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user