diff --git a/static/js/shop/CrateMode.jsx b/static/js/shop/CrateMode.jsx index ac207ee..8478a82 100644 --- a/static/js/shop/CrateMode.jsx +++ b/static/js/shop/CrateMode.jsx @@ -23,4 +23,4 @@ export function CrateMode({crate_index}) { ))} ); -} +} \ No newline at end of file diff --git a/static/js/shop/ImportJSON.jsx b/static/js/shop/ImportJSON.jsx index 19a01c7..2dc0d9c 100644 --- a/static/js/shop/ImportJSON.jsx +++ b/static/js/shop/ImportJSON.jsx @@ -1,5 +1,71 @@ +import {useShopStore} from "./shop_store"; +import {useClickAway} from "./options/useClickAway"; +import {Modal} from "react-bootstrap"; +import React from "react"; +import {Validation} from "./validate"; + +const JSONExample = JSON.stringify({ + "items": [{"pn": "1124"}, {"pn": "2118"}, {"pn": "2118"}, {"pn": "2128"}], + "type": "desktop" +}); + export function ImportJSON() { - return ( -
Import JSON PLACEHOLDER
- ) + const {shouldShow, data, loadDescription, updateImportDescription, closeImport, showImport} = useShopStore(state => ({ + shouldShow: state.importShouldOpen, + data: state.importValue, + loadDescription: state.loadDescription, + updateImportDescription: state.updateImportDescription, + closeImport: state.closeImport, + showImport: state.openImport, + })); + + const ref = useClickAway((e) => { + if (e.type === "mousedown") // ignore touchstart + closeImport() + } + ); + + return (<> + + + +
+

+ Input the JSON description below. Should be something like: +
+ {JSONExample} +

+
+ +
+