Merge pull request #109 from kjannette/request

Request
This commit is contained in:
S Jannette
2024-02-25 19:30:08 -06:00
committed by GitHub
9 changed files with 167 additions and 29 deletions

View File

@@ -30,6 +30,7 @@ const Dashboard = () => {
const { group } = appState; const { group } = appState;
const appUserId = group ? group.appUserId : null; const appUserId = group ? group.appUserId : null;
const isDashboard = true; const isDashboard = true;
useEffect(() => { useEffect(() => {
if (count.current == null) { if (count.current == null) {
setIsMobile(window.innerWidth < 440); setIsMobile(window.innerWidth < 440);

View File

@@ -136,6 +136,10 @@ const DocumentListPage = ({ perPage }) => {
{ label: "Associated case name z - a", value: "parentCaseName2" }, { label: "Associated case name z - a", value: "parentCaseName2" },
]; ];
const handleNovos = (e) => {
navigate("/how-to");
};
function handleNavigate( function handleNavigate(
documentId, documentId,
responseGenerations, responseGenerations,
@@ -188,7 +192,16 @@ const DocumentListPage = ({ perPage }) => {
<div className="document-list-upper-wrapper"> <div className="document-list-upper-wrapper">
<div className="list-upper-left"> <div className="list-upper-left">
<div className="toggle-outer"> <div className="toggle-outer">
<div className="toggle-header"> Response Verbosity</div> <div className="toggle-header">
{" "}
<p
onClick={handleNovos}
href=""
className="doclist-toggle-link"
>
Novos
</p>
</div>
<div className="toggle-box"> <div className="toggle-box">
<p className="select-billing-text">Min</p> <p className="select-billing-text">Min</p>
<Toggle value={verbValue} onClick={handleToggle} /> <Toggle value={verbValue} onClick={handleToggle} />

View File

@@ -20,12 +20,14 @@ const Login = () => {
} }
setIsBusy(true); setIsBusy(true);
setNotice(""); setNotice("");
try { try {
const userCredential = await signInWithEmailAndPassword( const userCredential = await signInWithEmailAndPassword(
auth, auth,
email, email,
password password
); );
// Signed in // Signed in
userCredential?.user && navigate("/dashboard"); userCredential?.user && navigate("/dashboard");
} catch (error) { } catch (error) {

View File

@@ -6,11 +6,13 @@ import Button from "../../pageElements/Button";
import Form from "react-bootstrap/Form"; import Form from "react-bootstrap/Form";
import Row from "react-bootstrap/Row"; import Row from "react-bootstrap/Row";
import Col from "react-bootstrap/Col"; import Col from "react-bootstrap/Col";
import Radiogroup from "../../pageElements/Radiogroup";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { collection, setDoc, doc } from "firebase/firestore"; import { collection, setDoc, doc } from "firebase/firestore";
import { db } from "../../firebase"; import { db } from "../../firebase";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import TextInput from "../../pageElements/TextInput"; import TextInput from "../../pageElements/TextInput";
import { ExclamationTriangle } from "react-bootstrap-icons";
import Radio from "../../pageElements/Radio"; import Radio from "../../pageElements/Radio";
import "../../styles/modals.scss"; import "../../styles/modals.scss";
@@ -30,6 +32,8 @@ const UploadModal = (props) => {
const [fileToUpload, setFileToUpload] = useState(); const [fileToUpload, setFileToUpload] = useState();
const [fileToParse, setFileToParse] = useState(""); const [fileToParse, setFileToParse] = useState("");
const [fileChanged, setFileChanged] = useState(); const [fileChanged, setFileChanged] = useState();
const [radioValue, setRadioValue] = useState(null);
const [radioValueError, setRadioValueError] = useState("");
const [showFileDetails, setShowFileDetails] = useState(""); const [showFileDetails, setShowFileDetails] = useState("");
const [titleError, setShowTitleError] = useState(""); const [titleError, setShowTitleError] = useState("");
const [docError, setShowDocError] = useState(""); const [docError, setShowDocError] = useState("");
@@ -41,6 +45,19 @@ const UploadModal = (props) => {
? process.env.REACT_APP_API_DEV ? process.env.REACT_APP_API_DEV
: process.env.REACT_APP_API_PROD; : process.env.REACT_APP_API_PROD;
const radioOptions = [
{
name: "Discovery request",
label: "Discovery request",
value: "discovery-request",
},
{ name: "Complaint", label: "Complaint", value: "complaint" },
];
const handleSetRadioValue = (e) => {
setRadioValue(e.value);
};
async function saveToDb(uuidName) { async function saveToDb(uuidName) {
const createdAt = new Date(); const createdAt = new Date();
const data = { const data = {
@@ -72,12 +89,21 @@ const UploadModal = (props) => {
async function uploadFile(file) { async function uploadFile(file) {
try { try {
if (radioValue === "complaint") {
const response = await fetch(`${apiUrl}/v1/gen-disc-request`, {
method: "POST",
body: file,
});
const res = response;
return res;
} else {
const response = await fetch(`${apiUrl}/parseNewDoc`, { const response = await fetch(`${apiUrl}/parseNewDoc`, {
method: "POST", method: "POST",
body: file, body: file,
}); });
const res = response; const res = response;
return res; return res;
}
} catch (error) { } catch (error) {
console.error("Error:", error); console.error("Error:", error);
} }
@@ -112,9 +138,10 @@ const UploadModal = (props) => {
} }
async function handleUpload() { async function handleUpload() {
if (!docTitle && !fileToParse) { if (!docTitle && !fileToParse && !radioValue) {
setShowDocError("Please select a document to upload."); setShowDocError("Please select a document to upload.");
setShowTitleError("Please enter a document title"); setShowTitleError("Please enter a document title");
setRadioValueError("Please select document type");
return; return;
} else if (!docTitle) { } else if (!docTitle) {
setShowTitleError("Please enter a document title"); setShowTitleError("Please enter a document title");
@@ -173,17 +200,37 @@ const UploadModal = (props) => {
<Modal.Body> <Modal.Body>
<div className="modal-header-text-wrapper"> <div className="modal-header-text-wrapper">
<p className="upload-modal-header-text"> <p className="upload-modal-header-text">
Select a document in pdf format for upload. Enter the document title Select a .pdf file for upload, then 1. enter title, and 2. choose
below. Document description is optional. document type (other fields optional).
</p> </p>
<p className="upload-modal-header-text"> <p className="upload-modal-header-text">
This document will be associated with {caption} v. {captionTwo} The document created will be associated with{" "}
<em>
{caption} v. {captionTwo}
</em>
{caseNumber ? `, ${caseNumber}` : ""}. {caseNumber ? `, ${caseNumber}` : ""}.
</p> </p>
<p className="upload-modal-header-text"> <p className="upload-modal-header-text">
If that is not the case you want to associate with this document, If that is not the correct case: 1. click cancel 2. click back, then
click "cancel", go back and select the intended case from your 3. select correct case from active cases.
active case list. </p>
<p className="upload-modal-header-text red">
<span className="upload-header-text">
<ExclamationTriangle
style={{
color: "red",
marginBottom: "4px",
marginRight: "8px",
}}
/>
NOTE: Selecting incorrect document type may result in errors.
<p className="upload-modal-header-text red indent">
Clicking upload begins document creation.
</p>
</span>
</p>
<p className="upload-modal-header-text red right">
Document credit will be debited from account.
</p> </p>
</div> </div>
<Form> <Form>
@@ -219,9 +266,19 @@ const UploadModal = (props) => {
label={dateServed ? "" : "Date Served"} label={dateServed ? "" : "Date Served"}
/> />
</Col> </Col>
<Col /> <Col>
<div className="radio-wrapper">
<Radiogroup
title="Document type"
options={radioOptions}
value={radioValue}
radioError={radioValueError}
onClick={(e) => handleSetRadioValue(e, "documentType")}
/>
</div>
</Col>
</Row> </Row>
<Row> <Row className="file-upload-row">
<Col className="mb-3"> <Col className="mb-3">
<Form.Label>Select Document</Form.Label> <Form.Label>Select Document</Form.Label>
<div className="file-uploader"> <div className="file-uploader">
@@ -256,7 +313,7 @@ const UploadModal = (props) => {
<Button <Button
labelText="Upload" labelText="Upload"
className="primary-button pr-1 pl-1" className="primary-button pr-1 pl-1"
onClick={handleUpload} onClick={() => handleUpload(radioValue)}
/> />
</Modal.Footer> </Modal.Footer>
</Modal> </Modal>

View File

@@ -51,6 +51,7 @@ const SignupPage = () => {
); );
// const [showSelectPlan, setShowSelectPlan] = useState(true); // const [showSelectPlan, setShowSelectPlan] = useState(true);
const [activeRadioOption, setActiveRadioOption] = useState("partner"); const [activeRadioOption, setActiveRadioOption] = useState("partner");
const [selectedPlan, setSelectedPlan] = useState([signupRadioFields[1]]); const [selectedPlan, setSelectedPlan] = useState([signupRadioFields[1]]);
const stripe = new Stripe(stripeApiKey); const stripe = new Stripe(stripeApiKey);

View File

@@ -24,8 +24,8 @@ export const Steps = () => (
Click <span className="bold-span"> Upload.</span> Click <span className="bold-span"> Upload.</span>
</div> </div>
<div className="mini-break"> <div className="mini-break">
Parsing the document usually takes under 2 minutes, but be patient - Parsing the document for language processing usually takes fewer
it may take up to 5. than 2 minutes, but be patient - it may take up to 5.
</div> </div>
</div> </div>
</div> </div>
@@ -46,8 +46,16 @@ export const Steps = () => (
<span className="bold-span">GENERATE THE RESPONSE: </span>From the <span className="bold-span">GENERATE THE RESPONSE: </span>From the
Document List View, click the Generate Responses'' button. Novdrafts Document List View, click the Generate Responses'' button. Novdrafts
Intellidraft AI will generate the response and automatically navigate to Intellidraft AI will generate the response and automatically navigate to
the interactive Document Editor. You can edit the responses and save the interactive Document Editor. Note the Response Novos toggle button -
progress any time by clicking the Save Changes button. this controls the amount of logical branching used in forumilting hte
response language. You can edit the responses and save progress any time
by clicking the Save Changes button.
</div>
<div className="steps-text-wrapper">
Novos level: this controls the amount of branching applied in deductive
persuasion. At the higher setting, the LLM will generate persuasive
rhetoric beyond the statement of an authoritative rule additional
attention will be given to application of the rule to factual scenarios.{" "}
</div> </div>
<div className="steps-text-wrapper"> <div className="steps-text-wrapper">
<span className="bold-span">DOWNLOAD YOUR RESPONSE DOCUMENT: </span> <span className="bold-span">DOWNLOAD YOUR RESPONSE DOCUMENT: </span>

View File

@@ -12,6 +12,7 @@ const Radiogroup = (props) => {
value, value,
options, options,
disabled, disabled,
radioError,
} = props; } = props;
const classCheckbox = "checkbox"; const classCheckbox = "checkbox";
const classOption = "option"; const classOption = "option";
@@ -81,6 +82,13 @@ const Radiogroup = (props) => {
</div> </div>
))} ))}
</div> </div>
<div className="radio-error-box">
{radioError ? (
<div className="modal-document-error">{radioError}</div>
) : (
<></>
)}
</div>
</div> </div>
); );
}; };

View File

@@ -68,6 +68,10 @@
.toggle-outer { .toggle-outer {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
border: 1px solid var(--accent-orange-light);
margin-right: 12px;
border-radius: 10px;
background-color: var(--background-blue);
} }
.toggle-box { .toggle-box {
@@ -81,13 +85,18 @@
.toggle-header { .toggle-header {
display: flex; display: flex;
justify-content: center; justify-content: center;
padding-right: 12px; padding-right: 7px;
margin-top: -8px;
height: 28px; height: 28px;
} }
.list-upper-right { .doclist-toggle-link {
// color: blue;
}
.doclist-toggle-link:hover {
cursor: pointer;
color: orange;
text-decoration: underline;
} }
.document-list-lower-wrapper { .document-list-lower-wrapper {

View File

@@ -12,21 +12,38 @@
} }
.modal-header-text-wrapper { .modal-header-text-wrapper {
margin-bottom: 12px; margin-bottom: 18px;
padding: 0px 8px; padding: 0px 8px;
} }
.upload-modal-header-text { .upload-modal-header-text {
font-family: Roboto; font-family: Roboto;
font-size: 0.89rem;
font-weight: 400; font-weight: 400;
line-height: 1.25rem; line-height: 1.1rem;
margin: 0px 0px 10px 0px; margin: 0px 0px 10px 0px;
&.right {
margin-top: -7px;
margin-left: 23px;
}
&.indent {
margin-left: 23px;
}
}
.upload-header-bold {
font-weight: 500;
}
.file-upload-row {
margin-top: 6px;
} }
.modal-document-error { .modal-document-error {
margin: -10px 2px 0px 5px; margin: -10px 2px 0px 5px;
color: red; color: red;
font-size: 0.85rem; font-size: 0.89rem;
} }
.create-modal-header { .create-modal-header {
@@ -66,6 +83,7 @@
} }
} }
} }
.caption-one-container > .mb-3 { .caption-one-container > .mb-3 {
margin-bottom: 0px !important; margin-bottom: 0px !important;
} }
@@ -130,6 +148,27 @@
padding-left: 7px; padding-left: 7px;
} }
.zora {
width: 160px !important;
}
.radio-wrapper {
height: 110px;
}
.radio-option-container {
display: flex;
flex-direction: column;
}
.checkbox-option-div {
height: 20px;
}
.radio-error-box {
margin-top: 16px;
margin-left: -3px;
}
@media only screen and (max-width: 820px) { @media only screen and (max-width: 820px) {
.modal-body { .modal-body {
width: 580px !important; width: 580px !important;