more
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { useContext, useEffect, useState, useRef } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { AppContext } from "../../Hooks/useContext/appContext";
|
||||
import SelectDropdown from "../../pageElements/SelectDropdown";
|
||||
@@ -21,6 +21,7 @@ import "../../styles/doclist-page.scss";
|
||||
const DocumentListPage = ({ perPage }) => {
|
||||
const size = window.innerWidth < 440;
|
||||
const [isMobile, setIsMobile] = useState(size);
|
||||
const count = useRef(null);
|
||||
const navigate = useNavigate();
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [selectedDocumentId, setSelectedDocumentId] = useState(null);
|
||||
@@ -36,6 +37,18 @@ const DocumentListPage = ({ perPage }) => {
|
||||
const [selectedDocumentType, setSelectedDocumentType] = useState();
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (count.current == null) {
|
||||
setIsMobile(window.innerWidth < 440);
|
||||
}
|
||||
if (count.current < 3) {
|
||||
setIsMobile(window.innerWidth < 440);
|
||||
}
|
||||
return () => {
|
||||
count.current = 1;
|
||||
};
|
||||
}, []);
|
||||
|
||||
function getDocuments() {
|
||||
if (!appUserId) {
|
||||
setAllDocs([]);
|
||||
@@ -121,17 +134,6 @@ const DocumentListPage = ({ perPage }) => {
|
||||
{ label: "Associated case name z - a", value: "parentCaseName2" },
|
||||
];
|
||||
|
||||
async function openDoc(docId) {
|
||||
/*
|
||||
may deprecate this functionality
|
||||
try {
|
||||
window.open(`${baseUrl}/Backend/Documents/Uploads/${docId}`, "_blank");
|
||||
} catch (err) {
|
||||
console.log("Error occurred fetching document:", err);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
function handleNavigate(
|
||||
documentId,
|
||||
responseGenerations,
|
||||
@@ -203,7 +205,6 @@ const DocumentListPage = ({ perPage }) => {
|
||||
docType={doc.docType}
|
||||
documentId={doc.documentId}
|
||||
dateServed={doc.dateServed}
|
||||
openDocument={openDoc}
|
||||
confirmDelete={confirmDelete}
|
||||
handleNavigate={handleNavigate}
|
||||
displayDeleteButton={true}
|
||||
@@ -266,7 +267,6 @@ const DocumentListPage = ({ perPage }) => {
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
return isMobile ? <MobileContent /> : <DesktopContent />;
|
||||
};
|
||||
|
||||
|
||||
@@ -271,7 +271,6 @@ export const DocCard = (props) => {
|
||||
parentCaseId,
|
||||
documentId,
|
||||
dateServed,
|
||||
openDocument,
|
||||
docType,
|
||||
displayDeleteButton,
|
||||
handleNavigate,
|
||||
@@ -283,11 +282,7 @@ export const DocCard = (props) => {
|
||||
<div className="doc-card-container">
|
||||
<div className="doc-card-input">
|
||||
<div className="card-col-icon">
|
||||
<FileEarmarkText
|
||||
className="doc-file-icon"
|
||||
onClick={() => openDocument(documentId)}
|
||||
size="22px"
|
||||
/>
|
||||
<FileEarmarkText className="doc-file-icon" size="22px" />
|
||||
</div>
|
||||
<div className="doc-col2">{title}</div>
|
||||
{dateServed ? (
|
||||
|
||||
Reference in New Issue
Block a user