Events is functional!!!

Just need to clean some things up and test
This commit is contained in:
Luke Berndt
2023-01-22 21:56:53 -05:00
parent 1ab774ec8f
commit b23734c4a3
14 changed files with 506 additions and 29 deletions

View File

@@ -366,6 +366,7 @@ function Calls(props) {
<span> </span><Icon name="close" inverted={true} link={true} size='small' /></Menu.Item>
<Link to="/"><Menu.Item link>Home</Menu.Item></Link>
<Link to="/systems"><Menu.Item link>Systems</Menu.Item></Link>
<Link to="/events"><Menu.Item link>Events</Menu.Item></Link>
<Link to="/about"><Menu.Item link>About</Menu.Item></Link>
</Sidebar>
<Menu fixed="top">

View File

@@ -7,16 +7,19 @@ import {
import { addStar, removeStar } from "../../features/calls/callsSlice";
import { useGetTalkgroupsQuery } from '../../features/api/apiSlice'
import { useDispatch } from 'react-redux'
const CallItem = (props) => {
const call = props.call;
const activeCall = props.activeCall;
const [starVisible, setStarVisible] = useState(false);
const [starClicked, setStarClicked] = useState(false);
const { data: talkgroupsData, isSuccess: isTalkgroupsSuccess } = useGetTalkgroupsQuery(call.shortName);
const dispatch = useDispatch();
const call = props.call;
const time = new Date(call.time);
const activeCall = props.activeCall;
const handleStarClicked = (e) => {
e.preventDefault();
@@ -79,10 +82,10 @@ const CallItem = (props) => {
}
}
let talkgroup;
if ((typeof props.talkgroups == 'undefined') || (typeof props.talkgroups[call.talkgroupNum] == 'undefined')) {
if ((typeof talkgroupsData == 'undefined') || (typeof talkgroupsData.talkgroups[call.talkgroupNum] == 'undefined')) {
talkgroup = call.talkgroupNum;
} else {
talkgroup = props.talkgroups[call.talkgroupNum].description;
talkgroup = talkgroupsData.talkgroups[call.talkgroupNum].description;
}
return (
<Table.Row draggable="true" onClick={(e) => props.onClick({ call: call }, e)} {...rowSelected} onDragStart={onDragStart} data-callid={call._id}>

View File

@@ -40,9 +40,9 @@ const ListCalls = (props) => {
{
props.callsData.ids.map((callId, index) => {
if (callId === props.activeCallId) {
return (<Ref innerRef={activeCallRef} key={index} ><CallItem activeCall={true} call={props.callsData.entities[callId]} talkgroups={props.talkgroups} key={index} onClick={props.playCall}/></Ref>)
return (<Ref innerRef={activeCallRef} key={index} ><CallItem activeCall={true} call={props.callsData.entities[callId]} key={index} onClick={props.playCall}/></Ref>)
} else {
return <CallItem activeCall={false} call={props.callsData.entities[callId]} talkgroups={props.talkgroups} key={index} onClick={props.playCall}/>
return <CallItem activeCall={false} call={props.callsData.entities[callId]} key={index} onClick={props.playCall}/>
}
})