feat(journey): the marker card, and what testing it turned up

Everything here came out of putting the first commit in front of somebody and
watching them use it.

**The marker card is one card now, and it carries the entry's photos.** Leaflet
showed a one-line label and the GL map a two-line card, so the same marker said
different things depending on a renderer setting nobody connects to journeys.
Both now build from one module: a strip of up to three thumbnails bleeding to
the card's edges, the name, and the place and date as chips. On the GL map the
thumbnails open the entry's photos; the rest of the card still never takes the
pointer, so the map drags from anywhere on it.

**A pin that would not sit still.** Dragging the map left the marker trailing
behind and snapping back at the end. The app's press-feedback rule puts a 180ms
transition on `[role="button"]`, MapLibre and Mapbox give their marker element
exactly that role, and both rewrite its `transform` on every frame of a
movement. Markers are excluded now — every map in TREK, not just this one.

**The phone card, after four rounds of looking at it.** The day is the card's
own edge rather than a bar across its foot, and the ring is inset because the
carousel clips. A card without a photo is opaque: it was a wash of the day's
colour over the map. The country is a real flag rather than two letters —
Windows has no flag glyphs, so the emoji drew "DE" where a flag was meant, and
the image falls back to the emoji when it cannot be fetched. Mood, weather and
the date share the top edge; the flag sits opposite them.

**The day bar answers to a finger.** Press the date and slide sideways to run
through the days. The bar is still a row of buttons underneath, because that is
the only version of it a keyboard can reach, and each one is 20px tall now
rather than 3.

Also here:

- Videos upload to an entry (issue #2341). The gallery has taken them since
  #823 and an entry could not: everything went through the images-only filter
  and came back 400, reported as "1 of 1 photos failed". Same two-part upload,
  same absence of transcoding, and the editor now previews a clip in a `<video>`
  instead of a broken-image glyph.
- The search box takes the gap the toolbar already had instead of clipping its
  own placeholder.
- Entry cards line up with the day header again: the reorder arrows moved out of
  a column of their own into the feed's padding and appear on hover, and the
  day-coloured ring on the active card is a layer over it — an outline tight
  enough to sit on the card's edge was painting behind it.
- Map attribution is collapsed to its ⓘ. It cannot go away — the OSM licence
  asks for it — but it does not have to lie under the carousel.
- The suggestion dismiss and the day-header plus use TREK's own tooltip rather
  than the browser's.
This commit is contained in:
Maurice
2026-09-13 19:52:14 +02:00
parent c2707b7eff
commit 15aefa449e
49 changed files with 706 additions and 267 deletions
@@ -1465,18 +1465,35 @@ export class JourneyDomainService {
.get(entryId, galleryId) as JourneyPhoto | null;
}
/**
* Attach an uploaded file to an entry.
*
* `media` carries what a clip needs beyond a picture: the type, so the viewer
* plays it instead of trying to draw it, and the duration the browser measured
* while it took the poster frame. The gallery route has taken both since #823;
* the entry route could not, which is why a video dropped on an entry came
* back as a 400 (issue #2341).
*/
addPhoto(
entryId: number,
userId: number,
filePath: string,
thumbnailPath?: string,
caption?: string,
media?: { mediaType?: string; durationMs?: number | null },
): JourneyPhoto | null {
const entry = this.db.prepare('SELECT * FROM journey_entries WHERE id = ?').get(entryId) as JourneyEntry | undefined;
if (!entry) return null;
if (!this.canEdit(entry.journey_id, userId)) return null;
const trekPhotoId = this.photos.getOrCreateLocal(filePath, thumbnailPath);
const trekPhotoId = this.photos.getOrCreateLocal(
filePath,
thumbnailPath,
null,
null,
media?.mediaType || 'image',
media?.durationMs ?? null,
);
const galleryId = this.db.connection.transaction(() => this.ensureInGallery(entry.journey_id, trekPhotoId, caption))();
const result = this.linkGalleryPhotoToEntry(galleryId, entryId);
this.promoteSkeletonIfNeeded(entry);
@@ -267,6 +267,56 @@ export class JourneyController {
return { photos: results };
}
/**
* A clip on an entry.
*
* The gallery has taken video since #823 and an entry could not: everything an
* entry uploaded went through the images-only filter above, so picking an mp4
* in the editor came back 400 and the save reported "1 of 1 photos failed"
* (issue #2341). Same two parts as the gallery route — the clip plus the poster
* frame the browser grabbed — and the same absence of transcoding.
*/
@Post('entries/:entryId/video')
@UseInterceptors(FileFieldsInterceptor(
[{ name: 'video', maxCount: 1 }, { name: 'poster', maxCount: 1 }],
{ limits: { fileSize: MAX_VIDEO_SIZE }, fileFilter: VIDEO_FILE_FILTER },
))
async uploadEntryVideo(
@CurrentUser() user: User,
@Param('entryId') entryId: string,
@UploadedFiles() files: { video?: Express.Multer.File[]; poster?: Express.Multer.File[] } | undefined,
@Body() body: JourneyGalleryVideoDto,
) {
const video = files?.video?.[0];
const poster = files?.poster?.[0];
const cleanup = () => {
for (const f of [video, poster]) {
if (f?.path) { try { fs.unlinkSync(f.path); } catch { /* best-effort */ } }
}
};
if (!video) {
cleanup();
throw new HttpException({ error: 'No video uploaded' }, 400);
}
await this.commitJourneyUploads(poster ? [video, poster] : [video]);
const durationMs = body?.duration_ms != null ? Number(body.duration_ms) : null;
const photo = this.journey.addPhoto(
Number(entryId),
user.id,
`journey/${video.filename}`,
poster ? `journey/${poster.filename}` : undefined,
undefined,
{ mediaType: 'video', durationMs: durationMs != null && Number.isFinite(durationMs) ? durationMs : null },
);
if (!photo) {
// Committed already, so the pre-commit unlink would orphan the bytes.
await this.storage.delete('journey', video.filename).catch(() => {});
if (poster) await this.storage.delete('journey', poster.filename).catch(() => {});
throw new HttpException({ error: 'Not allowed' }, 403);
}
return { photos: [photo] };
}
@Post('entries/:entryId/provider-photos')
providerPhotos(@CurrentUser() user: User, @Param('entryId') entryId: string, @Body() body: JourneyProviderPhotosDto) {
const pp = body.passphrase && typeof body.passphrase === 'string' ? body.passphrase : undefined;
+1 -1
View File
@@ -62,7 +62,7 @@ export class JourneyService {
reorderEntries(id: number, userId: number, orderedIds: number[], sid?: string) { return this.journey.reorderEntries(id, userId, orderedIds, sid); }
// Photos
addPhoto(entryId: number, userId: number, filePath: string, thumbnailPath: string | undefined, caption: string | undefined) { return this.journey.addPhoto(entryId, userId, filePath, thumbnailPath, caption); }
addPhoto(entryId: number, userId: number, filePath: string, thumbnailPath: string | undefined, caption: string | undefined, media?: { mediaType?: string; durationMs?: number | null }) { return this.journey.addPhoto(entryId, userId, filePath, thumbnailPath, caption, media); }
setPhotoProvider(photoId: number, provider: string, assetId: string, ownerId: number) { return this.journey.setPhotoProvider(photoId, provider, assetId, ownerId); }
addProviderPhoto(entryId: number, userId: number, provider: string, assetId: string, caption?: string, passphrase?: string, mediaType?: string) { return this.journey.addProviderPhoto(entryId, userId, provider, assetId, caption, passphrase, mediaType); }
linkPhotoToEntry(entryId: number, journeyPhotoId: number, userId: number) { return this.journey.linkPhotoToEntry(entryId, journeyPhotoId, userId); }