diff --git a/src/Components/Dashboard/Dashboard.js b/src/Components/Dashboard/Dashboard.js index 448bb31..86f2e91 100644 --- a/src/Components/Dashboard/Dashboard.js +++ b/src/Components/Dashboard/Dashboard.js @@ -1,6 +1,7 @@ -import React, { useState, useContext, useEffect } from "react"; +import React, { useState, useContext, useEffect, useRef } from "react"; import { CaseCard } from "../../pageElements/Cards.js"; import { Link, useNavigate } from "react-router-dom"; +import MobileContent from "../MobileContent"; import { ArrowRight, Activity, @@ -16,6 +17,9 @@ import UploadModal from "../Modals/UploadModal.js"; import Button from "react-bootstrap/Button"; const Dashboard = () => { + const size = window.innerWidth < 440; + const [isMobile, setIsMobile] = useState(size); + const count = useRef(null); const navigate = useNavigate(); const [allCases, setAllCases] = useState(null); const [selectedCase, setSelectedCase] = useState(null); @@ -25,6 +29,18 @@ const Dashboard = () => { const { appState } = useContext(AppContext); const { group } = appState; const appUserId = group ? group.appUserId : null; + const isDashboard = true; + useEffect(() => { + if (count.current == null) { + setIsMobile(window.innerWidth < 440); + } + if (count.current < 3) { + setIsMobile(window.innerWidth < 440); + } + return () => { + count.current = 1; + }; + }, []); function getCases() { if (!appUserId) { @@ -83,6 +99,67 @@ const Dashboard = () => { return null; } + const DesktopContent = () => { + return allCases !== null ? ( +
+ Novodraft is a desktop application. The functionailty of your Dashboard + in mobile mode is limited to displaying stats and important + notifications. +
++ Please login on your desktop device to use all of the functions your + Dashboard. +
+