From 14a894c161888d199ae1bf23fc4e53987ce0ae68 Mon Sep 17 00:00:00 2001 From: ascibisz Date: Thu, 8 Jan 2026 09:43:25 -0800 Subject: [PATCH 1/5] basic upload recipe from local device modal --- src/App.css | 4 ++ src/App.tsx | 36 ++++++++++--- src/components/LocalRecipe/index.tsx | 29 +++++++++++ src/components/UploadModal/index.tsx | 77 ++++++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 8 deletions(-) create mode 100644 src/components/LocalRecipe/index.tsx create mode 100644 src/components/UploadModal/index.tsx diff --git a/src/App.css b/src/App.css index f03baa79..9507d94d 100644 --- a/src/App.css +++ b/src/App.css @@ -26,6 +26,10 @@ padding: 0 40px; } +.load-button { + margin-right: 20px; +} + .footer { display: flex; flex-direction: row; diff --git a/src/App.tsx b/src/App.tsx index c330ada3..105b3fed 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; import { v4 as uuidv4 } from "uuid"; -import { Layout, Typography } from "antd"; +import { Button, Layout, Typography } from "antd"; import { getJobStatus, addRecipe } from "./utils/firebase"; import { getFirebaseRecipe, jsonToString } from "./utils/recipeLoader"; import { getSubmitPackingUrl, JOB_STATUS } from "./constants/aws"; @@ -15,6 +15,7 @@ import { useSetPackingResults, } from "./state/store"; import PackingInput from "./components/PackingInput"; +import UploadModal from "./components/UploadModal"; import Viewer from "./components/Viewer"; import StatusBar from "./components/StatusBar"; @@ -25,6 +26,8 @@ const { Link } = Typography; function App() { const [jobStatus, setJobStatus] = useState(""); + const [isModalOpen, setIsModalOpen] = useState(false); + const [localFile, setLocalFile] = useState(null); const setJobLogs = useSetJobLogs(); const jobLogs = useJobLogs(); @@ -44,6 +47,9 @@ function App() { recipeId: string, recipeString: string ): Promise => { + if (!recipeId) { + return true; + } const originalRecipe = await getFirebaseRecipe(recipeId); return !(jsonToString(originalRecipe) == recipeString); }; @@ -156,6 +162,14 @@ function App() { } }; + const showUploadDialog = () => { + setIsModalOpen(true); + }; + + const handleModalClose = () => { + setIsModalOpen(false); + }; + return (

cellPACK Studio

- - GitHub - +
+ + + GitHub + +
+ - + diff --git a/src/components/LocalRecipe/index.tsx b/src/components/LocalRecipe/index.tsx new file mode 100644 index 00000000..b42f22ce --- /dev/null +++ b/src/components/LocalRecipe/index.tsx @@ -0,0 +1,29 @@ +import { Button, Input } from 'antd'; + +const { TextArea } = Input; + +interface LocalRecipeProps { + recipeString: string; + startPacking: (recipeId: string, configId: string, recipeString: string) => Promise; + maxHeight?: number; +} + +const LocalRecipe: React.FC = ({ recipeString, startPacking, maxHeight }) => { + return ( +
+

Uploaded Recipe

+