Call Info and Cal Modals converted

This commit is contained in:
Luke Berndt
2023-01-05 21:17:13 -05:00
parent 271ecee5d5
commit 9205224f23
2 changed files with 63 additions and 71 deletions

View File

@@ -11,20 +11,19 @@ import {
} from "semantic-ui-react";
// ----------------------------------------------------
class CallInfo extends React.Component {
function CallInfo(props) {
render() {
var srcList = "";
var callLength = "-";
var callFreq = "-";
var callDate = "-";
var callTime = "-";
var talkgroupNum = "-";
var callDownload = "";
var callTweet = "";
if (this.props.call) {
const currentCall = this.props.call;
let srcList = "";
let callLength = "-";
let callFreq = "-";
let callDate = "-";
let callTime = "-";
let talkgroupNum = "-";
let callDownload = "";
let callTweet = "";
if (props.call) {
const currentCall = props.call;
var time = new Date(currentCall.time);
callTime = time.toLocaleTimeString();
callDate = time.toLocaleDateString();
@@ -33,12 +32,11 @@ class CallInfo extends React.Component {
callFreq = Math.round(freq * 1000) / 1000;
}
srcList = currentCall.srcList.map((source, index) => <List.Item key={index}>{source.src}
[{source.pos}]</List.Item>);
srcList = currentCall.srcList.map((source, index) => <List.Item key={index}>{source.src}[{source.pos}]</List.Item>);
callLength = currentCall.len;
talkgroupNum = currentCall.talkgroupNum;
callDownload = currentCall.url;
callTweet = "https://twitter.com/intent/tweet?url="+encodeURIComponent(document.location.origin+this.props.link)+"&via="+encodeURIComponent("OpenMHz");
callTweet = "https://twitter.com/intent/tweet?url="+encodeURIComponent(document.location.origin+props.link)+"&via="+encodeURIComponent("OpenMHz");
}
@@ -46,7 +44,7 @@ class CallInfo extends React.Component {
return (
<div>
<Segment padded attached>
<Header as='h1'>{this.props.header}</Header>
<Header as='h1'>{props.header}</Header>
<List bulleted horizontal link>
{srcList}
</List>
@@ -84,11 +82,11 @@ class CallInfo extends React.Component {
<Menu attached='bottom'>
<a href={callTweet}><Menu.Item name="tweet" ><Icon name='twitter' />Tweet</Menu.Item></a>
<a href={callDownload}><Menu.Item name="download"><Icon name="download" />Download</Menu.Item></a>
<a href={this.props.link}><Menu.Item name="link"><Icon name="at" />Link</Menu.Item></a>
<a href={props.link}><Menu.Item name="link"><Icon name="at" />Link</Menu.Item></a>
</Menu>
</div>
);
}
}
export default CallInfo;