Move dashboard to client components. (#26)
* Move to client components * Move to client components * Fix create team
This commit is contained in:
23
apps/web/src/providers/dashboard-provider.tsx
Normal file
23
apps/web/src/providers/dashboard-provider.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import { FullScreenLoading } from "~/components/FullScreenLoading";
|
||||
import CreateTeam from "~/components/team/CreateTeam";
|
||||
import { api } from "~/trpc/react";
|
||||
|
||||
export const DashboardProvider = ({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) => {
|
||||
const { data: teams, status } = api.team.getTeams.useQuery();
|
||||
|
||||
if (status === "pending") {
|
||||
return <FullScreenLoading />;
|
||||
}
|
||||
|
||||
if (!teams || teams.length === 0) {
|
||||
return <CreateTeam />;
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
};
|
Reference in New Issue
Block a user