cleaned up some errors

This commit is contained in:
Luke Berndt
2023-01-17 20:50:47 -05:00
parent 0a5e88c652
commit 1d55a63f7f
8 changed files with 37 additions and 66 deletions

View File

@@ -1,13 +1,12 @@
import React, { useState } from "react";
import {
Table,
Icon,
Label
} from "semantic-ui-react";
import { connect } from "react-redux"
import { addStar, removeStar} from "../features/calls/callsSlice";
import { addStar, removeStar } from "../features/calls/callsSlice";
import { useDispatch } from 'react-redux'
const CallItem = (props) => {
@@ -22,7 +21,7 @@ const CallItem = (props) => {
const handleStarClicked = (e) => {
e.preventDefault();
e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
e.nativeEvent.stopImmediatePropagation();
if (!starClicked) {
setStarClicked(true);
dispatch(addStar(props.call._id));
@@ -32,11 +31,11 @@ const CallItem = (props) => {
}
}
var rowSelected={};
var rowSelected = {};
let starButton;
var starClickable = {};
if (!starClicked) {
starClickable = {link: true };
starClickable = { link: true };
}
if (!call.star && starVisible) {
starButton = <Icon name='star outline' />
@@ -47,32 +46,33 @@ const CallItem = (props) => {
}
if (call.star && call.star > 1) {
starButton = (<Icon.Group >
<Icon {...starClickable} name='star' />
<Label circular color='red' size='mini' floating>
{call.star}
</Label>
</Icon.Group>)
<Icon {...starClickable} name='star' />
<Label circular color='red' size='mini' floating>
{call.star}
</Label>
</Icon.Group>)
}
if (activeCall) {
rowSelected={positive: true,
rowSelected = {
positive: true,
color: "blue",
key: "blue",
inverted: "true"
}
key: "blue",
inverted: "true"
}
}
var talkgroup;
if ((typeof props.talkgroups == 'undefined') || (typeof props.talkgroups[call.talkgroupNum] == 'undefined')) {
talkgroup = call.talkgroupNum;
if ((typeof props.talkgroups == 'undefined') || (typeof props.talkgroups[call.talkgroupNum] == 'undefined')) {
talkgroup = call.talkgroupNum;
} else {
talkgroup = props.talkgroups[call.talkgroupNum].description;
talkgroup = props.talkgroups[call.talkgroupNum].description;
}
return (
<Table.Row onClick={(e) => props.onClick({call: call}, e)} {...rowSelected}>
<Table.Cell> {call.len} </Table.Cell>
<Table.Cell> {talkgroup} </Table.Cell>
<Table.Cell> {time.toLocaleTimeString()} </Table.Cell>
<Table.Cell onMouseEnter={()=> setStarVisible(true)} onMouseLeave={() => setStarVisible(false)} onClick={handleStarClicked}>{starButton}</Table.Cell>
<Table.Row onClick={(e) => props.onClick({ call: call }, e)} {...rowSelected}>
<Table.Cell> {call.len} </Table.Cell>
<Table.Cell> {talkgroup} </Table.Cell>
<Table.Cell> {time.toLocaleTimeString()} </Table.Cell>
<Table.Cell onMouseEnter={() => setStarVisible(true)} onMouseLeave={() => setStarVisible(false)} onClick={handleStarClicked}>{starButton}</Table.Cell>
</Table.Row>