mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-21 13:15:51 -05:00
Update - selects for playing
This commit is contained in:
@@ -63,6 +63,7 @@ class CallPlayer extends React.Component {
|
||||
playTime: 0,
|
||||
sourceIndex: 0,
|
||||
callScroll: false,
|
||||
callSelect: false,
|
||||
urlOptions: false,
|
||||
isPlaying: false,
|
||||
sidebarOpened: false,
|
||||
@@ -171,7 +172,7 @@ class CallPlayer extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
updateUri(props) {
|
||||
updateUri(props, state) {
|
||||
var search = "?"
|
||||
switch (props.filterType) {
|
||||
|
||||
@@ -186,6 +187,9 @@ class CallPlayer extends React.Component {
|
||||
break;
|
||||
|
||||
}
|
||||
if (state.callId) {
|
||||
search = search + `call-id=${state.callId}`
|
||||
}
|
||||
if (props.filterDate) {
|
||||
if (search.length !== 1) {
|
||||
search = search + '&';
|
||||
@@ -341,7 +345,8 @@ class CallPlayer extends React.Component {
|
||||
sourceIndex: 0,
|
||||
urlOptions: true,
|
||||
autoPlay: false,
|
||||
callScroll: true
|
||||
callScroll: true,
|
||||
callSelect: true
|
||||
});
|
||||
this.props.callActions.fetchCallInfo(_id);
|
||||
this.props.callActions.setCallTime(date);
|
||||
@@ -398,7 +403,7 @@ class CallPlayer extends React.Component {
|
||||
return true
|
||||
}
|
||||
|
||||
componentWillUpdate(nextProps) {
|
||||
componentWillUpdate(nextProps, nextState) {
|
||||
if (!this.props.groups && nextProps.groups) {
|
||||
if (!this.state.urlOptions && (nextProps.groups.length > 0)) {
|
||||
this.setState({
|
||||
@@ -428,7 +433,7 @@ class CallPlayer extends React.Component {
|
||||
break;
|
||||
}
|
||||
|
||||
this.updateUri(nextProps);
|
||||
this.updateUri(nextProps, nextState);
|
||||
if (this.props.live) {
|
||||
this.startSocket(this.props.shortName, typeString, filterCode, nextProps.filterStarred);
|
||||
}
|
||||
@@ -441,6 +446,10 @@ class CallPlayer extends React.Component {
|
||||
this.prevHeight = contextRef.clientHeight;
|
||||
this.autoScroll = true;
|
||||
}
|
||||
/* // if you do this, you also need to update time in the URI to be the call time...
|
||||
if (this.state.callId != nextState.callId) {
|
||||
this.updateUri(nextProps, nextState);
|
||||
}*/
|
||||
|
||||
if (this.state.callId && !this.state.callUrl) {
|
||||
const call = this.props.callsById[this.state.callId];
|
||||
@@ -460,6 +469,8 @@ class CallPlayer extends React.Component {
|
||||
|
||||
// scroll to a call once the calls have loaded
|
||||
if (this.state.callScroll && (this.props.callsAllIds.length > prevProps.callsAllIds.length)) {
|
||||
const call = this.props.callsById[this.state.callId];
|
||||
if (call) {
|
||||
this.setState({ callScroll: false });
|
||||
if (this.currentCallRef.current) {
|
||||
this.currentCallRef.current.scrollIntoView({
|
||||
@@ -472,6 +483,21 @@ class CallPlayer extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.state.callSelect) {
|
||||
const call = this.props.callsById[this.state.callId];
|
||||
if (call) {
|
||||
const audio = this.audioRef.current;
|
||||
var callUrl = call.url;
|
||||
this.setState({
|
||||
callUrl: callUrl,
|
||||
sourceIndex: 0,
|
||||
isPlaying: true,
|
||||
callSelect: false
|
||||
}, () => { audio.playSource(callUrl); }); //scrollToComponent(this.currentCallRef.current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//https://stackoverflow.com/questions/36559661/how-can-i-dispatch-from-child-components-in-react-redux
|
||||
//https://stackoverflow.com/questions/42597602/react-onclick-pass-event-with-parameter
|
||||
render() {
|
||||
|
||||
Reference in New Issue
Block a user