getting data transformation with pub sub, although just need to solidify with more flow and just do it step by step as it can get complex

This commit is contained in:
talksik
2022-05-06 10:41:28 -05:00
parent 61c2ac14af
commit f3cd9edc95
5 changed files with 99 additions and 10 deletions
@@ -25,7 +25,7 @@ export default function NirvanaTerminal() {
// simply using this query for specific data on loading
// todo: add these properties in context provider value although more work down the line for control
const { isLoading: isLoadingInitialLines } = useUserLines();
const { linesMap } = useLineDataProvider();
const { linesMap, handleUserBroadcast } = useLineDataProvider();
const allLines: MasterLineData[] = useMemo(() => {
const masterLines: MasterLineData[] = Object.values(linesMap);
@@ -53,18 +53,24 @@ export default function NirvanaTerminal() {
setSelectedLineId(null);
}, [setSelectedLineId]);
const handleStartBroadcast = useCallback(() => {
if (selectedLineId) handleUserBroadcast(selectedLineId, true);
}, [selectedLineId]);
const keyMap: KeyMap = useMemo(
() => ({
DESELECT_LINE: "esc",
START_BROADCAST: "`",
}),
[handleEscape]
[]
);
const handlers = useMemo(
() => ({
DESELECT_LINE: handleEscape,
START_BROADCAST: handleStartBroadcast,
}),
[handleEscape]
[handleEscape, handleStartBroadcast]
);
return (