2020-12-20 20:19:50 +01:00
|
|
|
import React from "react";
|
|
|
|
import { useSelector, useDispatch } from "react-redux";
|
|
|
|
|
|
|
|
import { setPlugin, selectCore } from "./coreSlice";
|
|
|
|
import * as plugins from "./plugins";
|
|
|
|
|
|
|
|
function Core() {
|
|
|
|
const coreState = useSelector(selectCore);
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const plugin = plugins.default[coreState.plugin];
|
|
|
|
const props = {
|
|
|
|
data: coreState.data,
|
|
|
|
close: () => dispatch(setPlugin(false))
|
|
|
|
};
|
|
|
|
return <>
|
|
|
|
{plugin ? null :
|
|
|
|
<>
|
|
|
|
<p>Welcome to Honda!</p>
|
|
|
|
{Object.keys(plugins.default).map(
|
|
|
|
i => <p
|
|
|
|
onClick={() => dispatch(setPlugin(i))}
|
|
|
|
key={i}
|
|
|
|
>
|
|
|
|
{plugins.default[i].pluginName}
|
|
|
|
</p>)
|
|
|
|
}
|
|
|
|
</>
|
|
|
|
}
|
2020-12-21 10:46:05 +01:00
|
|
|
{plugin ? plugin(props) :null}
|
2020-12-20 20:19:50 +01:00
|
|
|
</>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Core;
|