mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 00:20:07 +00:00
feat(places): notes, visits, tours, history, tags and location in the place sheet, saved lists on the trip map
Both the desktop sheet and the phone sheet of All places show the place's location as a badge, its notes per list, its visits from trips (hidden without any), linked tours and bookings, its change history and the reader's own tags with a tag filter. A trip map can show the places of linked lists and add one to the trip. All places reloads after a list is added or removed.
This commit is contained in:
@@ -8,10 +8,18 @@ import apiClient from './client';
|
||||
|
||||
const base = '/addons/collections/library/places';
|
||||
|
||||
/** The query as the server reads it: a tag filter (PLC-21) as its ids joined by commas, not `tag_ids[]=`. */
|
||||
function queryParams(query: PlacesLibraryQueryInput): Record<string, unknown> {
|
||||
const { tag_ids: tagIds, ...rest } = query;
|
||||
if (tagIds === undefined) return rest;
|
||||
const joined = Array.isArray(tagIds) ? tagIds.join(',') : tagIds;
|
||||
return joined === '' ? rest : { ...rest, tag_ids: joined };
|
||||
}
|
||||
|
||||
/** PLC-07/PLC-08 "All places": one page of entries, and one entry by the trip place or saved place it was opened from. */
|
||||
export const placesLibraryApi = {
|
||||
list: (query: PlacesLibraryQueryInput = {}, signal?: AbortSignal): Promise<PlacesLibraryPageResponse> =>
|
||||
apiClient.get(base, { params: query, signal }).then((r) => r.data),
|
||||
apiClient.get(base, { params: queryParams(query), signal }).then((r) => r.data),
|
||||
detail: (kind: PlacesLibraryKind, id: number, signal?: AbortSignal): Promise<PlacesLibraryDetailResponse> =>
|
||||
apiClient.get(`${base}/${kind}/${id}`, { signal }).then((r) => r.data),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user