mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-16 18:57:47 -05:00
have it adding calls better
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
import { useSelector, useDispatch } from 'react-redux'
|
import { useSelector, useDispatch } from 'react-redux'
|
||||||
|
import React, { useState } from "react";
|
||||||
import {
|
import {
|
||||||
Header,
|
Header,
|
||||||
Divider,
|
Divider,
|
||||||
List,
|
List,
|
||||||
|
ListItem,
|
||||||
Segment,
|
Segment,
|
||||||
Statistic,
|
Statistic,
|
||||||
Icon,
|
Icon,
|
||||||
@@ -14,6 +15,7 @@ import {
|
|||||||
function PlaylistBuilder(props) {
|
function PlaylistBuilder(props) {
|
||||||
|
|
||||||
const { loading: callsLoading, data: callsData } = useSelector((state) => state.calls);
|
const { loading: callsLoading, data: callsData } = useSelector((state) => state.calls);
|
||||||
|
const [playlist, setPlaylist] = useState([]);
|
||||||
|
|
||||||
const onDragOver = (event) => {
|
const onDragOver = (event) => {
|
||||||
// It also receives a DragEvent.
|
// It also receives a DragEvent.
|
||||||
@@ -37,11 +39,22 @@ import {
|
|||||||
var callId = event.dataTransfer.getData("call-id");
|
var callId = event.dataTransfer.getData("call-id");
|
||||||
console.log("Dropping: " + callId);
|
console.log("Dropping: " + callId);
|
||||||
console.log("Found: " + callsData.entities[callId].freq);
|
console.log("Found: " + callsData.entities[callId].freq);
|
||||||
|
setPlaylist([...playlist, callId]);
|
||||||
}
|
}
|
||||||
|
let listItems = "";
|
||||||
|
|
||||||
|
listItems = playlist.map((callId, index) => {
|
||||||
|
const call = callsData.entities[callId];
|
||||||
|
return(<li><Icon name="wait" />{call.time}</li>)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tab.Pane attached='bottom'>
|
<Tab.Pane attached='bottom' onDragOver={onDragOver} onDrop={onDrop}>
|
||||||
<div onDragOver={onDragOver} onDrop={onDrop}>Placeholder</div>
|
<ul>
|
||||||
|
{listItems}
|
||||||
|
<li>test</li>
|
||||||
|
</ul>
|
||||||
</Tab.Pane>
|
</Tab.Pane>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user