import React, { useState } from "react"; import { Navbar, Nav, Modal, Button, Form } from "react-bootstrap"; import styled from "styled-components"; import { useInput } from "sagemaker-worker"; import Utils from "utils"; import { useStoreState } from "appstore"; const LogoImage = styled.img` height: 24px; margin-right: 1.5rem; `; const InstructionsModal = (props: { show: boolean; handleClose: () => void; }) => { const { show, handleClose } = props; return ( Instructions Tabular Document Digitization annotator instructions here Close ); }; const RejectModal = (props: { show: boolean; handleClose: () => void }) => { const { show, handleClose } = props; const [reason, setReason] = useState(""); const [isSubmitting, setIsSubmitting] = useState(false); const documentModel = useStoreState((s) => s.documentModel); const [reasonRequiredError, setReasonRequiredError] = useState(""); const reject = async () => { if (!reason) { setReasonRequiredError("A reason is required"); return; } setIsSubmitting(true); await Utils.submitReject(documentModel, reason); setIsSubmitting(false); handleClose(); }; return ( Reject Document? What is wrong with this document? setReason(e.target.value)} isInvalid={reasonRequiredError !== ""} /> {reasonRequiredError} Cancel Reject Document ); }; const SubmitConfirmModal = (props: { show: boolean; handleClose: () => void; }) => { const { show, handleClose } = props; const [isSubmitting, setIsSubmitting] = useState(false); const documentModel = useStoreState((s) => s.documentModel); const submit = async () => { setIsSubmitting(true); await Utils.submit(documentModel); setIsSubmitting(false); handleClose(); }; return ( Submit Document? Are you sure you want to submit this document? Cancel Submit Document ); }; export default () => { const [showInstructions, setShowInstructions] = useState(false); const [showReject, setShowReject] = useState(false); const [showSubmit, setShowSubmit] = useState(false); const logoUrl = useInput("logo"); const hideInstructionsModal = () => { setShowInstructions(false); }; const showInstructionsModal = (e: React.MouseEvent) => { e.preventDefault(); setShowInstructions(true); }; const toggleRejectModal = () => { setShowReject(!showReject); }; const toggleSubmitModal = () => { setShowSubmit(!showSubmit); }; return ( Tabular Document Annotation Tool Instructions Reject Submit ); };
Tabular Document Digitization annotator instructions here
Are you sure you want to submit this document?