diff --git a/src/common/ResponsiveTable.tsx b/src/common/ResponsiveTable.tsx index 4fff6fd..bb975d7 100644 --- a/src/common/ResponsiveTable.tsx +++ b/src/common/ResponsiveTable.tsx @@ -395,7 +395,6 @@ export default function ResponsiveTable(props: Props) { }) : Object.values(row).map((value, j) => { - console return ( {value ? value.toString() : ""} @@ -431,7 +430,7 @@ export default function ResponsiveTable(props: Props) { handlePageChange(page)} diff --git a/src/navigation/Router.tsx b/src/navigation/Router.tsx index bb1dca8..ee7f0da 100644 --- a/src/navigation/Router.tsx +++ b/src/navigation/Router.tsx @@ -23,23 +23,56 @@ interface Props { export default function Router(props: Props) { const {open, onOpen, onClose, toggleTheme } = props; - const { isAuthenticated, loginWithRedirect, isLoading } = useAuth0() - const isMobile = useMobile() + const { isAuthenticated, loginWithRedirect, isLoading } = useAuth0(); + const isMobile = useMobile(); - const hello = () => { + const RelativeRoutes = () => { + console.log("relative route") return ( - - Hello! - + + } /> + } /> + ) } - // useEffect(() => { - // setAuthorized(isAuthenticated || offline); - // if (isAuthenticated && !user.empty() && !user.status.finishedIntro) { - // history.push("/welcome"); - // } - // }, [history, isAuthenticated, offline, user]); + const TeamsRoute = () => { + console.log("teams route") + return ( + + } + /> + } + /> + } + /> + + ); + }; + + const DevicesRoute = () => { + console.log("devices route") + return ( +
+ + } + /> + {/* } + /> */} + +
+ ); + }; if (isLoading) return null; if (!isAuthenticated) { @@ -65,22 +98,14 @@ export default function Router(props: Props) { {/* Redirects */} } /> } /> + } /> {/* Page routes */} - - } /> - } /> - } /> - } /> - } /> - {/* } - /> */} - {/* } /> - } /> - } /> */} + Hello!} /> + } /> } /> + } /> + {isMobile && } diff --git a/src/pages/Devices.tsx b/src/pages/Devices.tsx index b19b10b..b8030ac 100644 --- a/src/pages/Devices.tsx +++ b/src/pages/Devices.tsx @@ -11,6 +11,7 @@ import PageContainer from "./PageContainer"; import { useMobile } from "hooks"; import { useLocation, useNavigate } from "react-router-dom"; import { or } from "utils/types"; +import { getContextKeys, getContextTypes } from "pbHelpers/Context"; const useStyles = makeStyles((theme: Theme) => { return ({ @@ -30,7 +31,7 @@ export default function Devices() { const location = useLocation(); const deviceAPI = useDeviceAPI(); const [limit, setLimit] = useState(10); - const [offset, setOffset] = useState(0); + const [page, setPage] = useState(0); const [order, ] = useState<"asc" | "desc">("asc"); const [orderBy, ] = useState("name"); const [search, setSearch] = useState(""); @@ -47,7 +48,21 @@ export default function Devices() { }; const loadDevices = () => { - deviceAPI.list(limit, offset*limit, order, orderBy, search).then(resp => { + deviceAPI.list( + limit, + page*limit, + order, + orderBy, + search, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + getContextKeys(), + getContextTypes() + ).then(resp => { setDevices(resp.data.devices) setTotal(resp.data.total) }) @@ -55,7 +70,7 @@ export default function Devices() { useEffect(() => { loadDevices() - }, [limit, offset, order, orderBy, search]) + }, [limit, page, order, orderBy, search]) const handleChange = (event: any) => { setLimit(event.target.value); @@ -102,8 +117,8 @@ export default function Devices() { columns={columns()} total={total} pageSize={limit} - page={offset} - setPage={setOffset} + page={page} + setPage={setPage} handleRowsPerPageChange={handleChange} onRowClick={toDevice} setSearchText={setSearch} diff --git a/src/pages/Teams.tsx b/src/pages/Teams.tsx index 2e74628..21acce7 100644 --- a/src/pages/Teams.tsx +++ b/src/pages/Teams.tsx @@ -1,5 +1,6 @@ import { useMobile } from "hooks"; import PageContainer from "pages/PageContainer"; +import { Outlet } from "react-router-dom"; import TeamList from "teams/TeamList"; export default function Teams() { @@ -7,6 +8,7 @@ export default function Teams() { return ( + ); }