mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +00:00
fix(trips): the journal link's toast and tab texts as literal keys
lint:i18n-keys only reaches a key through a literal t() or a *Key property: the three save toasts were passed to run() as bare keys and the tab label came out of TRIP_TAB_LABEL_KEYS, so four new en keys counted as unused. They are translated where they are named now.
This commit is contained in:
@@ -193,7 +193,7 @@ export function useTripJournalLink(tripId: number) {
|
||||
setBusy(true);
|
||||
try {
|
||||
await write();
|
||||
toast.success(t(done));
|
||||
toast.success(done);
|
||||
cancel();
|
||||
} catch (err: unknown) {
|
||||
fail(err);
|
||||
@@ -201,20 +201,20 @@ export function useTripJournalLink(tripId: number) {
|
||||
setBusy(false);
|
||||
}
|
||||
},
|
||||
[cancel, fail, t, toast]
|
||||
[cancel, fail, toast]
|
||||
);
|
||||
|
||||
const save = useCallback(async () => {
|
||||
if (mode === 'pick' && pickedId != null) {
|
||||
await run(() => store().link(tripId, pickedId, chosenMembers), 'trip.journal.linked');
|
||||
await run(() => store().link(tripId, pickedId, chosenMembers), t('trip.journal.linked'));
|
||||
} else if (mode === 'members') {
|
||||
await run(() => store().setMembers(tripId, chosenMembers), 'trip.journal.membersSaved');
|
||||
await run(() => store().setMembers(tripId, chosenMembers), t('trip.journal.membersSaved'));
|
||||
}
|
||||
}, [mode, pickedId, run, store, tripId, chosenMembers]);
|
||||
}, [mode, pickedId, run, store, tripId, chosenMembers, t]);
|
||||
|
||||
const unlink = useCallback(async () => {
|
||||
await run(() => store().unlink(tripId), 'trip.journal.unlinked');
|
||||
}, [run, store, tripId]);
|
||||
await run(() => store().unlink(tripId), t('trip.journal.unlinked'));
|
||||
}, [run, store, tripId, t]);
|
||||
|
||||
return {
|
||||
/** The section shows at all: the addon is on and this person may link, or the trip has a journal they see. */
|
||||
|
||||
@@ -215,7 +215,7 @@ export function useTripPlanner() {
|
||||
...(enabledAddons.documents ? [{ id: 'dateien', label: t(TRIP_TAB_LABEL_KEYS.dateien), icon: FolderOpen }] : []),
|
||||
...(enabledAddons.collab ? [{ id: 'collab', label: t(TRIP_TAB_LABEL_KEYS.collab), icon: Users }] : []),
|
||||
// A journal from the Journey addon tied to this trip, for whoever the link lets in.
|
||||
...(journal.openJournalId != null ? [{ id: 'journal', label: t(TRIP_TAB_LABEL_KEYS.journal), icon: LinkedJournalIcon }] : []),
|
||||
...(journal.openJournalId != null ? [{ id: 'journal', label: t('trip.tabs.journal'), icon: LinkedJournalIcon }] : []),
|
||||
].filter(tab => tab.id === 'plan' || !replacedTabs.has(tab.id))
|
||||
// Positioned plugin tabs splice in ascending order so two positions stay stable;
|
||||
// the rest append, exactly as before this capability existed.
|
||||
|
||||
Reference in New Issue
Block a user