From 7b24efcbf553323db6eef1315a796c96242802bb Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Tue, 16 Feb 2021 13:15:50 +0100 Subject: [PATCH] registration --- packages/dashboard/src/components/Layout.js | 4 +-- packages/dashboard/src/components/Table.js | 2 +- packages/dashboard/src/pages/index.js | 31 +++++++-------------- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/packages/dashboard/src/components/Layout.js b/packages/dashboard/src/components/Layout.js index d868c1ec..3ebcd379 100644 --- a/packages/dashboard/src/components/Layout.js +++ b/packages/dashboard/src/components/Layout.js @@ -142,7 +142,7 @@ export default function Layout({ title, children }) { diff --git a/packages/dashboard/src/components/Table.js b/packages/dashboard/src/components/Table.js index c2e3fdb1..01c3811e 100644 --- a/packages/dashboard/src/components/Table.js +++ b/packages/dashboard/src/components/Table.js @@ -24,7 +24,7 @@ function Button({ children, disabled, className, ...props }) { export default function Table({ items, count, headers, actions, offset, setOffset, pageSize = 10 }) { useEffect(() => { if (offset < 0) setOffset(0); - else if (offset >= count) setOffset(Math.floor(count / pageSize - 1) * pageSize); + else if (offset >= count && count > 0) setOffset(Math.floor(count / pageSize - 1) * pageSize); else if (offset % pageSize) setOffset(offset - (offset % pageSize)); }, [offset, pageSize, setOffset]); diff --git a/packages/dashboard/src/pages/index.js b/packages/dashboard/src/pages/index.js index 27eb6709..e36575d3 100644 --- a/packages/dashboard/src/pages/index.js +++ b/packages/dashboard/src/pages/index.js @@ -20,7 +20,8 @@ export default function Home() { return (
-
+ {/* change to lg:grid-cols-3 when we have more stats */} +
{/* ============ */}