feat: video footage now properly syncs up with the history page.
This commit is contained in:
parent
6830ac9ac5
commit
8b5c4b0b20
@ -1,8 +1,10 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useAppDispatch } from 'src/redux/hooks';
|
import { useAppDispatch, useAppSelector } from 'src/redux/hooks';
|
||||||
import { updateElement } from 'src/redux/slices/minimapSlice';
|
import { updateElement } from 'src/redux/slices/minimapSlice';
|
||||||
import type { InformationElement } from 'src/types/element';
|
import type { InformationElement } from 'src/types/element';
|
||||||
import { capitalizeFirstLetter as cfl } from 'src/utils/helpers';
|
import { capitalizeFirstLetter as cfl } from 'src/utils/helpers';
|
||||||
|
import {getElementsInGaze, getGazesAndKeys } from 'src/redux/slices/gazeSlice';
|
||||||
|
import { getCommunication, updateCommunication } from 'src/redux/slices/communicationSlice';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
element: InformationElement;
|
element: InformationElement;
|
||||||
@ -12,7 +14,9 @@ type Props = {
|
|||||||
const M_HEIGHT = 60;
|
const M_HEIGHT = 60;
|
||||||
|
|
||||||
const MapThreatInfoElement = ({ element, inGaze }: Props) => {
|
const MapThreatInfoElement = ({ element, inGaze }: Props) => {
|
||||||
|
const communications = useAppSelector(getCommunication);
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
const gazesAndKeys = useAppSelector(getGazesAndKeys);
|
||||||
// could also fetch messages from redux
|
// could also fetch messages from redux
|
||||||
// provided there is a conversation number
|
// provided there is a conversation number
|
||||||
const { title, message, collapsed, h, w, size, escalate, deescalate } =
|
const { title, message, collapsed, h, w, size, escalate, deescalate } =
|
||||||
@ -25,6 +29,27 @@ const MapThreatInfoElement = ({ element, inGaze }: Props) => {
|
|||||||
target = 'missile';
|
target = 'missile';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
for(let gk of gazesAndKeys){
|
||||||
|
if(gk.keyPress === "1"){
|
||||||
|
if(element === undefined || gk.elemsInGaze[0] === undefined){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(element.id == gk.elemsInGaze[0].id && element.type == 'information'){
|
||||||
|
console.log(element);
|
||||||
|
dispatch(updateCommunication({
|
||||||
|
...communications,
|
||||||
|
//@ts-ignore
|
||||||
|
activeConversationId: element.message.conversationId,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [gazesAndKeys]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// react to deescalation
|
// react to deescalation
|
||||||
if (deescalate) {
|
if (deescalate) {
|
||||||
|
@ -14,6 +14,7 @@ import {
|
|||||||
} from 'src/redux/slices/conversationSlice';
|
} from 'src/redux/slices/conversationSlice';
|
||||||
import { getAllElements } from 'src/redux/slices/minimapSlice';
|
import { getAllElements } from 'src/redux/slices/minimapSlice';
|
||||||
|
|
||||||
|
|
||||||
type ListWidgetProps = {
|
type ListWidgetProps = {
|
||||||
widget: Widget;
|
widget: Widget;
|
||||||
};
|
};
|
||||||
@ -81,26 +82,25 @@ const ListWidget = ({ widget }: ListWidgetProps) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
for(let gk of gazesAndKeys){
|
// for(let gk of gazesAndKeys){
|
||||||
if(gk.keyPress === "1"){
|
// if(gk.keyPress === "1"){
|
||||||
for(let element of allElements){
|
// for(let element of allElements){
|
||||||
if(element === undefined || gk.elemsInGaze[0] === undefined){
|
// if(element === undefined || gk.elemsInGaze[0] === undefined){
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
if(element.id == gk.elemsInGaze[0].id && element.type == 'information'){
|
// if(element.id == gk.elemsInGaze[0].id && element.type == 'information'){
|
||||||
console.log(element);
|
// console.log(element);
|
||||||
dispatch(updateCommunication({
|
// dispatch(updateCommunication({
|
||||||
//@ts-ignore
|
// //@ts-ignore
|
||||||
activeConversationId: element.conversationId,
|
// activeConversationId: element.conversationId,
|
||||||
activeElementId: element.id
|
// activeElementId: element.id
|
||||||
|
// }));
|
||||||
}));
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }, [gazesAndKeys]);
|
||||||
}, [gazesAndKeys]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// change selected element in list of arrow up or arrow down
|
// change selected element in list of arrow up or arrow down
|
||||||
|
Loading…
Reference in New Issue
Block a user