diff --git a/src/App.tsx b/src/App.tsx index 669e0b09..18900a69 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,15 +5,18 @@ import { getJobStatus, addRecipe } from "./utils/firebase"; import { getFirebaseRecipe, jsonToString } from "./utils/recipeLoader"; import { getSubmitPackingUrl, JOB_STATUS } from "./constants/aws"; import { FIRESTORE_FIELDS } from "./constants/firebase"; +import { SIMULARIUM_VIEWER_URL } from "./constants/urls"; import { useCurrentRecipeData, useJobId, useOutputsDirectory, + useResultUrl, useRunTime, useSetJobId, useSetPackingResults, } from "./state/store"; import PackingInput from "./components/PackingInput"; +import ShareModal from "./components/ShareModal"; import Viewer from "./components/Viewer"; import StatusBar from "./components/StatusBar"; @@ -25,6 +28,7 @@ const { Link } = Typography; function App() { const [jobStatus, setJobStatus] = useState(""); const [jobLogs, setJobLogs] = useState(""); + const [isShareModalOpen, setIsShareModalOpen] = useState(false); const setJobId = useSetJobId(); const jobId = useJobId(); @@ -32,6 +36,8 @@ function App() { const runTime = useRunTime(); const outputDir = useOutputsDirectory(); const edits = useCurrentRecipeData()?.edits || {}; + const resultUrl = useResultUrl(); + const shareUrl = resultUrl ? `${SIMULARIUM_VIEWER_URL}${resultUrl}` : ""; let start = 0; @@ -163,13 +169,20 @@ function App() { style={{ justifyContent: "space-between" }} >

cellPACK Studio

- - GitHub - +
+ + GitHub + +
+ setIsShareModalOpen(false)} + shareUrl={shareUrl} + /> @@ -185,6 +198,8 @@ function App() { jobId={jobId} errorLogs={jobLogs} outputDir={outputDir} + shareUrl={shareUrl} + onShareClick={() => setIsShareModalOpen(true)} /> diff --git a/src/assets/download.svg b/src/assets/download.svg new file mode 100644 index 00000000..c79fa79c --- /dev/null +++ b/src/assets/download.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/share.svg b/src/assets/share.svg new file mode 100644 index 00000000..054dbade --- /dev/null +++ b/src/assets/share.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/ShareModal/index.tsx b/src/components/ShareModal/index.tsx new file mode 100644 index 00000000..12600416 --- /dev/null +++ b/src/components/ShareModal/index.tsx @@ -0,0 +1,34 @@ +import { Button, Input, Modal, Space } from "antd"; + +interface ShareModalProps { + open: boolean; + onClose: () => void; + shareUrl: string; +} + +const ShareModal = ({ open, onClose, shareUrl }: ShareModalProps) => { + return ( + + + + + + + ); +}; + +export default ShareModal; diff --git a/src/components/StatusBar/index.tsx b/src/components/StatusBar/index.tsx index 1d09a445..34e69968 100644 --- a/src/components/StatusBar/index.tsx +++ b/src/components/StatusBar/index.tsx @@ -5,16 +5,31 @@ import { JOB_STATUS } from "../../constants/aws"; import "./style.css"; import ErrorLogs from "../ErrorLogs"; +const DownloadIcon = () => ( + + + +); + +const ShareIcon = () => ( + + + + +); + interface StatusBarProps { jobStatus: string; runTime: number; jobId: string; outputDir: string; errorLogs: string; + shareUrl: string; + onShareClick: () => void; } const StatusBar = (props: StatusBarProps): JSX.Element => { - const { jobStatus, runTime, jobId, errorLogs, outputDir } = props; + const { jobStatus, runTime, jobId, errorLogs, outputDir, shareUrl, onShareClick } = props; const [isDownloading, setIsDownloading] = useState(false); @@ -38,17 +53,29 @@ const StatusBar = (props: StatusBarProps): JSX.Element => { )} - {jobSucceeded && ( +
+ - )} +
{errorLogs && } ); diff --git a/src/components/StatusBar/style.css b/src/components/StatusBar/style.css index a4c477ef..ac33b884 100644 --- a/src/components/StatusBar/style.css +++ b/src/components/StatusBar/style.css @@ -12,7 +12,9 @@ align-items: center; } -.download-button { - height: auto; - min-height: 48px; +.status-bar-actions { + display: flex; + flex-direction: row; + gap: 12px; + align-items: center; }