diff --git a/src/Components/Case/CaseListPage.js b/src/Components/Case/CaseListPage.js index 20abe22..a1db39b 100644 --- a/src/Components/Case/CaseListPage.js +++ b/src/Components/Case/CaseListPage.js @@ -1,7 +1,8 @@ -import React, { useEffect, useContext, useState } from "react"; +import React, { useEffect, useContext, useState, useRef } from "react"; import { useNavigate } from "react-router-dom"; import { CaseCard } from "../../pageElements/Cards.js"; import CreateModal from "../Modals/CreateModal.js"; +import MobileContent from "../MobileContent.js"; import { db } from "../../firebase"; import { AppContext } from "../../Hooks/useContext/appContext"; import SelectDropdown from "../../pageElements/SelectDropdown"; @@ -10,6 +11,9 @@ import ListPagination from "../../pageElements/ListPagination.js"; import Button from "../../pageElements/Button"; const CaseListPage = ({ perPage }) => { + const size = window.innerWidth < 440; + const [isMobile, setIsMobile] = useState(size); + const count = useRef(null); const navigate = useNavigate(); const [showModal, setShowModal] = useState(false); const [allCases, setAllCases] = useState(null); @@ -20,6 +24,15 @@ const CaseListPage = ({ perPage }) => { const { group } = appState; const appUserId = group ? group.appUserId : null; + useEffect(() => { + if (count.current == null) { + setIsMobile(window.innerWidth < 440); + } + return () => { + count.current = 1; + }; + }, []); + function getCases() { if (!appUserId) { setAllCases([]); @@ -85,68 +98,72 @@ const CaseListPage = ({ perPage }) => { if (!group) { return null; } - - return ( - <> -
You have not created any cases yet.
-- To get started, click "Create New Case" and enter case - information. -
- {createNewButton()} -You have not created any cases yet.
++ To get started, click "Create New Case" and enter case + information. +
+ {createNewButton()} +