Skip to content

Commit

Permalink
feat: Layout and loading set for root page
Browse files Browse the repository at this point in the history
  • Loading branch information
ipapandinas committed Jan 21, 2024
1 parent d9439f0 commit ce92893
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 67 deletions.
23 changes: 0 additions & 23 deletions app/explore/[slug]/layout.tsx

This file was deleted.

17 changes: 16 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { SITE_CONFIG } from "@/data/config";
import clsx from "clsx";
import CtaBanner from "@/components/cta-banner";
import { container, title } from "@/components/primitives";
import Toolbar from "@/components/filters/toolbar";
import { FiltersProvider } from "@/contexts/filters";
import { decodingSlug } from "@/utils/url";
import { initFilters } from "@/utils/filters";

export const fontSans = Inter({
subsets: ["latin"],
Expand Down Expand Up @@ -60,9 +64,13 @@ export const viewport: Viewport = {

export default function RootLayout({
children,
params,
}: {
children: React.ReactNode;
params: { slug: string };
}) {
const filters = params.slug ? decodingSlug(params.slug) : initFilters();

return (
<html
lang="en"
Expand All @@ -84,7 +92,14 @@ export default function RootLayout({
<section className={container()}>
<CtaBanner />
</section>
<div className="pt-10">{children}</div>
<div className="pt-10">
<FiltersProvider initialFilters={filters}>
<div className="flex flex-col">
<Toolbar />
<section className={container()}>{children}</section>
</div>
</FiltersProvider>
</div>
</main>
<footer className="py-6 px-6 md:px-8 md:py-0">
<div className="container flex flex-col items-center justify-between gap-4 md:h-24 md:flex-row">
Expand Down
5 changes: 5 additions & 0 deletions app/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import TableSkeleton from "@/components/table/skeleton";

export default function Loading() {
return <TableSkeleton />;
}
11 changes: 7 additions & 4 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import ControlledTable from "@/components/controlled-table";
import ContributionsTable from "@/components/table/table";
import { DEFAULT_PAGE_SIZE } from "@/data/fetch";
import { queryDatabase } from "@/lib/notion";
import { PaginatedCustomDataResponse } from "@/types";
import { Contribution } from "@/types/contribution";
import { initFilters } from "@/utils/filters";
import { transformNotionDataToContributions } from "@/utils/notion";

export default async function Home() {
const filters = initFilters();
const data = await queryDatabase({
page_size: DEFAULT_PAGE_SIZE,
});
Expand All @@ -19,6 +17,11 @@ export default async function Home() {
};

return (
<ControlledTable filters={filters} items={items} queryFilter={undefined} />
<ContributionsTable
items={items}
queries={{
page_size: DEFAULT_PAGE_SIZE,
}}
/>
);
}
39 changes: 0 additions & 39 deletions components/controlled-table.tsx

This file was deleted.

0 comments on commit ce92893

Please sign in to comment.