fix(notifications): a notice keeps what to say and says it in the reader's language when shown
This commit is contained in:
@@ -81,6 +81,7 @@ import RemoteImage from "../../components/ui/RemoteImage";
|
||||
import { useOpenLinkedPlayer } from "../../features/player/useOpenLinkedPlayer";
|
||||
import { budgetFrom, budgetParams, DEFAULT_BUDGET } from "../../lib/homeUrlState";
|
||||
import { useUrlMirror } from "../../lib/useUrlMirror";
|
||||
import { msg } from "../../lib/notifications";
|
||||
|
||||
// The Home surface — "Mit nézzek most?".
|
||||
//
|
||||
@@ -868,10 +869,10 @@ export default function Home() {
|
||||
// click raises a bare fetch TypeError, so there is no server reason to prefer over it. It
|
||||
// would describe a state the user can see is untrue, over a fully populated page whose
|
||||
// invalidations never even ran (they sit inside `.then`).
|
||||
.catch((e: unknown) => notifyActionError(e, t("home.actionFailed")));
|
||||
.catch((e: unknown) => notifyActionError(e, msg("home.actionFailed")));
|
||||
return write;
|
||||
},
|
||||
[qc, t],
|
||||
[qc],
|
||||
);
|
||||
|
||||
const onToggleSave = useCallback(
|
||||
@@ -887,9 +888,9 @@ export default function Home() {
|
||||
qc.invalidateQueries({ queryKey: qk.discover() });
|
||||
})
|
||||
// The write key, for the same reason as `onState` above.
|
||||
.catch((e: unknown) => notifyActionError(e, t("home.actionFailed")));
|
||||
.catch((e: unknown) => notifyActionError(e, msg("home.actionFailed")));
|
||||
},
|
||||
[qc, t],
|
||||
[qc],
|
||||
);
|
||||
|
||||
// One click plays. A shelf tile resolves through its `next` (a show → the episode that would
|
||||
@@ -940,11 +941,11 @@ export default function Home() {
|
||||
// re-asks the server rather than trying to predict a cross-rail consequence.
|
||||
const onToggleWatched = useCallback(
|
||||
(card: PlexCard) =>
|
||||
void toggleWatchState(card, t, {
|
||||
void toggleWatchState(card, {
|
||||
optimistic: () => {},
|
||||
resync: () => qc.invalidateQueries({ queryKey: qk.discover() }),
|
||||
}),
|
||||
[qc, t],
|
||||
[qc],
|
||||
);
|
||||
|
||||
// Shelf reorder, from the comfort rail's menu. Optimistic on THIS budget's cached payload so the
|
||||
@@ -986,7 +987,7 @@ export default function Home() {
|
||||
.reorderComfortPins(ids)
|
||||
.catch((e: unknown) => {
|
||||
qc.setQueryData<DiscoverPayload>(key, (old) => (old ? { ...old, comfort: cards } : old));
|
||||
notifyActionError(e, t("home.shelf.moveFailed"));
|
||||
notifyActionError(e, msg("home.shelf.moveFailed"));
|
||||
})
|
||||
.finally(() => {
|
||||
shelfSavingRef.current = false;
|
||||
@@ -1000,7 +1001,7 @@ export default function Home() {
|
||||
void qc.invalidateQueries({ queryKey: qk.discover() });
|
||||
});
|
||||
},
|
||||
[budget, lang, qc, t],
|
||||
[budget, lang, qc],
|
||||
);
|
||||
|
||||
const reroll = useCallback(
|
||||
|
||||
Reference in New Issue
Block a user