Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
chore(pages:problems): display a loading component for /problems page
Browse files Browse the repository at this point in the history
  ## what
  - display a loading component for `/problems` page

  ## how

  ## why

  ## where
  - ./src/app/problems/page.tsx

  ## usage
  • Loading branch information
Clumsy-Coder committed Jan 2, 2024
1 parent 87927e2 commit 380fa20
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/app/problems/page.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
"use client";

import { DataTable } from "@/components/ui/data-table";
import DataTableLoading from "@/components/ui/data-table/loading";
import { columns } from "@/app/problems/components/data-table/columns";
import { useFetchProblems } from "@/hooks";

const ProblemsPage = () => {
const { data, isLoading, isError } = useFetchProblems();

if (isLoading) {
return <div>Fetching data </div>;
return (
<section>
<h1 className="text-3xl">All Problems</h1>
<DataTableLoading numColumns={2} numRows={8} />
</section>
);
}

if (isError) {
return <div>Error fetching data</div>;
}

return (
<section>
<h1 className="text-3xl">All Problems</h1>
<DataTable columns={columns} data={data} />
</section>
)
<section>
<h1 className="text-3xl">All Problems</h1>
<DataTable columns={columns} data={data} />
</section>
);
};

export default ProblemsPage;

0 comments on commit 380fa20

Please sign in to comment.