ADD: added tracklist and automated update

This commit is contained in:
hwinkel
2023-09-19 14:14:50 +02:00
parent b391c8e7ff
commit df41e5d9ea
10 changed files with 122 additions and 51 deletions

View File

@@ -25,19 +25,18 @@ class App extends Component {
}
componentDidMount() {
connect((msg) => {
console.log("New Message")
console.log(msg.data)
var jsonMSG;
try {
jsonMSG = JSON.parse(msg.data);
} catch (error) {
console.log(error);
}
if(jsonMSG["Type"] == "COP"){
console.log(msg.data)
var Entities = Array.from(jsonMSG["Entities"])
if(Array.isArray(Entities))
{
@@ -46,27 +45,34 @@ class App extends Component {
});
}
}
// this.state.Entities = jsonMSG
// var jsonmsg = JSON.parse(msg);
this.setState(prevState => ({
// chatHistory: [...this.state.History, msg]
// chatHistory: [...this.state.History, msg]
// this.setState(prevState => ({
// // chatHistory: [...this.state.History, msg]
// // chatHistory: [...this.state.History, msg]
}))
// }))
console.log(this.state.Entities);
});
}
// send() {
// console.log("hello");
// // sendMsg("hello world");
// }
handleCallback = (ChildData) => {
this.setState({name: ChildData})
console.log(ChildData);
updateMap()
{
var msg =
{
Type: "Request",
Data: "COP"
}
sendMsg(JSON.stringify(msg));
}
MapIntervalCallback = () => {
this.updateMap()
}
render() {
@@ -74,16 +80,18 @@ class App extends Component {
return (
<div className="App">
<Header />
<Controls />
<div className="Content">
<Controls Entities= {this.state.Entities} />
{/* <ChatHistory History={this.state.History} /> */}
<div>
{/* <div>
{name}
</div> */}
<OpenSeaMap Entities= {this.state.Entities} parentCallback = {this.MapIntervalCallback}/>
</div>
<OpenSeaMap Entities= {this.state.Entities} parentCallback = {this.handleCallback}/>
<button onClick={this.send}>Hit</button>
{/* <button onClick={this.send}>Hit</button> */}
</div>
);