feat(client): open views follow member, settings, tag, atlas and journey changes made elsewhere

This commit is contained in:
Maurice
2026-10-22 12:14:28 +02:00
parent b24a82fe33
commit 8d4d3423ff
53 changed files with 1269 additions and 133 deletions
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
import { packingApi } from '../../api/client';
import { useServerPing } from '../../sync/useServerPing';
import { offlineOr } from '../../utils/needsConnection';
type Translate = (key: string, params?: Record<string, string | number>) => string;
@@ -23,14 +24,24 @@ export interface CategoryAssignee {
export function usePackingCategoryAssignees({ tripId, t, toast }: { tripId: number; t: Translate; toast: Toaster }) {
const [categoryAssignees, setCategoryAssignees] = useState<Record<string, CategoryAssignee[]>>({});
const reload = useCallback(
() =>
packingApi
.getCategoryAssignees(tripId)
.then((data) => setCategoryAssignees(data.assignees || {}))
.catch(() => {
// A failed read leaves the last answer standing; there is nothing to undo.
}),
[tripId]
);
useEffect(() => {
packingApi
.getCategoryAssignees(tripId)
.then((data) => setCategoryAssignees(data.assignees || {}))
.catch(() => {
// A failed read leaves every category unassigned; there is nothing to undo.
});
}, [tripId]);
void reload();
}, [reload]);
// Assignees set elsewhere (a fellow traveller, the assistant) are read back,
// one read per burst, rather than patched in from the event.
useServerPing('packing:assignees', true, reload);
const setAssignees = async (category: string, userIds: number[]) => {
try {