From d172e7004660953a6ca7b3f22fd7c7d6b9f0deec Mon Sep 17 00:00:00 2001 From: soup Date: Sat, 4 Mar 2023 23:45:43 +0100 Subject: [PATCH] enhancement(web): stats and releases pretty loading (#731) * enhancement(web): improved loading message * dark mode fix * added skeleton for loading * placeholder * handle activitytable loading * name StatsItems in isLoading * handling ReleaseTable loading * made releasetable 10 rows while loading * derp * style: simplify loading state --------- Co-authored-by: soup Co-authored-by: ze0s --- web/src/screens/dashboard/ActivityTable.tsx | 11 +- web/src/screens/dashboard/Stats.tsx | 20 +-- web/src/screens/releases/ReleaseTable.tsx | 155 +++++++++++++++++++- 3 files changed, 174 insertions(+), 12 deletions(-) diff --git a/web/src/screens/dashboard/ActivityTable.tsx b/web/src/screens/dashboard/ActivityTable.tsx index 5e652f1..4f8bd00 100644 --- a/web/src/screens/dashboard/ActivityTable.tsx +++ b/web/src/screens/dashboard/ActivityTable.tsx @@ -185,7 +185,16 @@ export const ActivityTable = () => { ); if (isLoading) - return null; + return ( +
+

+   +

+
+ +
+
+ ); return (
diff --git a/web/src/screens/dashboard/Stats.tsx b/web/src/screens/dashboard/Stats.tsx index f066028..7d3b52e 100644 --- a/web/src/screens/dashboard/Stats.tsx +++ b/web/src/screens/dashboard/Stats.tsx @@ -1,12 +1,14 @@ import { useQuery } from "react-query"; import { APIClient } from "../../api/APIClient"; +import { classNames } from "../../utils"; interface StatsItemProps { name: string; value?: number; + placeholder?: string; } -const StatsItem = ({ name, value }: StatsItemProps) => ( +const StatsItem = ({ name, placeholder, value }: StatsItemProps) => (
(

{name}

+
+

{placeholder}

+
+

{value}

@@ -28,20 +34,16 @@ export const Stats = () => { { refetchOnWindowFocus: false } ); - if (isLoading) - return null; - return (

Stats

- -
- +
+ {/* */} - - + +
); diff --git a/web/src/screens/releases/ReleaseTable.tsx b/web/src/screens/releases/ReleaseTable.tsx index d8ac79f..985743b 100644 --- a/web/src/screens/releases/ReleaseTable.tsx +++ b/web/src/screens/releases/ReleaseTable.tsx @@ -196,7 +196,159 @@ export const ReleaseTable = () => { return

Error

; if (isLoading) - return

Loading...

; + return ( +
+
+ {headerGroups.map((headerGroup) => + headerGroup.headers.map((column) => ( + column.Filter ? ( + {column.render("Filter")} + ) : null + )) + )} +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ {/* Add a sort direction indicator */} + + +
+
   
   
   
   
+

Loading release table...

+
   
   
   
   
   
+ + {/* Pagination */} +
+
+ previousPage()} disabled={!canPreviousPage}>Previous + nextPage()} disabled={!canNextPage}>Next +
+
+
+ + Page {pageIndex + 1} of {pageOptions.length} + + +
+
+ +
+
+
+
+
+ ); if (!data) return ; @@ -281,7 +433,6 @@ export const ReleaseTable = () => { })} - {/* Pagination */}