From ff7eac97dc392b997f861b3eae2b8354e706f552 Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Wed, 13 Dec 2023 12:39:15 +0800 Subject: [PATCH] Restored all the functionality, but needs UI fixes Signed-off-by: Egor Savkin --- static/js/shop/CrateMode.jsx | 2 +- static/js/shop/ImportJSON.jsx | 72 +++++++++++++++++++++++++-- static/js/shop/OrderForm.jsx | 15 ++---- static/js/shop/OrderPanel.jsx | 10 ++-- static/js/shop/RFQFeedback.jsx | 36 ++++++++++++++ static/js/shop/Shop.jsx | 6 +-- static/js/shop/ShowJSON.jsx | 44 +++++++++++++++-- static/js/shop/json_porter.js | 15 ++++-- static/js/shop/shop_store.js | 89 +++++++++++++++++++++++++++++----- webpack.config.js | 8 +-- 10 files changed, 251 insertions(+), 46 deletions(-) create mode 100644 static/js/shop/RFQFeedback.jsx 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} +

+
+ +
+