mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
feat(journey): let quick capture take a note, not just a photo
The ask was "photos or quick notes" while travelling, and the capture sheet only took photos (#1614) — so a moment worth catching without a picture had no way in short of opening the full editor, which is exactly what capture mode exists to avoid. Two rows rather than the full sheet's three: this is a note, not the story. The story is written later, when the entry is finished.
This commit is contained in:
@@ -585,6 +585,20 @@ export default function MJourneyEntrySheet({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Quick capture keeps a note field: the ask was "photos *or* quick notes"
|
||||
unterwegs, and a moment without a picture is still worth catching. Two
|
||||
rows rather than three — it is a note, not the story, which is written
|
||||
later in the full sheet. */}
|
||||
{captureOnly && !readOnly && (
|
||||
<textarea
|
||||
rows={2}
|
||||
value={story}
|
||||
onChange={e => setStory(e.target.value)}
|
||||
placeholder={t('journey.editor.writeStory')}
|
||||
className={`mt-[10px] w-full resize-none px-[14px] py-3 font-geist text-[0.8125rem] leading-[1.5] text-m-ink outline-none placeholder:text-m-faint ${fieldShell} rounded-[14px]`}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!captureOnly && <>
|
||||
{readOnly ? (
|
||||
story && (
|
||||
|
||||
@@ -48,6 +48,24 @@ describe('MJourneyEntrySheet quick capture', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// #1614 — the ask was "photos *or* quick notes" while travelling, and a moment
|
||||
// without a picture is still worth catching.
|
||||
it('takes a note in capture mode and saves it', async () => {
|
||||
vi.spyOn(mapsApi, 'reverse').mockResolvedValue({ name: 'Singapore', address: 'Singapore' });
|
||||
const { props } = setup();
|
||||
|
||||
const note = await screen.findByPlaceholderText('Write your story...');
|
||||
fireEvent.change(note, { target: { value: 'Ferry was late, worth it' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Save' }));
|
||||
|
||||
await waitFor(() =>
|
||||
expect(props.onSave).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ story: 'Ferry was late, worth it' }),
|
||||
undefined,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
it('captures GPS, reverse-geocodes it, detects an editable weather category, and saves', async () => {
|
||||
vi.spyOn(mapsApi, 'reverse').mockResolvedValue({ name: 'Singapore', address: 'Singapore' });
|
||||
vi.spyOn(weatherApi, 'getCurrent').mockResolvedValue({
|
||||
|
||||
Reference in New Issue
Block a user