mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 21:11:14 +00:00
feat(places): tags on places, owned by the trip
A place keeps its one category, which decides its marker, and can now carry any number of tags as extra labels to filter by. - Tags belong to the trip (tags.trip_id): every member sees the same list and whoever may edit the trip's places adds, renames and deletes. Personal tags stay what they were. - The place form picks them on desktop and mobile through one shared hook, usePlaceTags, and can add a new tag to the trip on the spot. - The existing category filter of the places list lists the tags as well. - Tags show on the place (inspector pills, phone place sheet); the marker is untouched. - MCP: create_place, create_and_assign_place and update_place take `tags`, and list/create/update/delete_trip_tag manage a trip's tags. - /api/trips/:tripId/tags and the tripTags:changed event keep every client of the trip in step.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { roadtripPreferencesRepo } from '../repo/roadtripPreferencesRepo'
|
||||
import { tourRepo } from '../repo/tourRepo'
|
||||
import { tripTagRepo } from '../repo/tripTagRepo'
|
||||
/**
|
||||
* Trip sync manager — seeds Dexie with trip data for offline use.
|
||||
*
|
||||
@@ -155,6 +156,14 @@ async function syncTrip(tripId: number): Promise<void> {
|
||||
await roadtripPreferencesRepo.read(tripId).catch(() => { /* optional cache */ })
|
||||
}
|
||||
|
||||
// The trip's own tags, which the repo keeps as it reads them. Never fatal either.
|
||||
try {
|
||||
await tripTagRepo.list(tripId)
|
||||
} catch {
|
||||
// An optional cache: the places carry the tags they have, so without this
|
||||
// list only the unused ones are missing offline, until the next sync.
|
||||
}
|
||||
|
||||
// Tours, the same way: optional, and never fatal. Without them every Tour
|
||||
// reads as a plain place offline. Asked only while the addon is on, so a
|
||||
// sync of many trips does not spend a refused request on each.
|
||||
|
||||
Reference in New Issue
Block a user