Updates to team components.

This commit is contained in:
Mike Cao 2024-02-04 18:03:26 -08:00
parent 102f5b78b1
commit dbb3801e66
28 changed files with 173 additions and 159 deletions

View file

@ -1,10 +1,10 @@
'use client';
import { useTeam, useTeamContext } from 'components/hooks';
import { useTeam, useTeamUrl } from 'components/hooks';
import { Loading } from 'react-basics';
import notFound from 'app/not-found';
import TeamContext from './TeamContext';
export function Team({ children }) {
const { teamId } = useTeamContext();
const { teamId } = useTeamUrl();
const { data: team, isLoading } = useTeam(teamId);
if (isLoading) {
@ -12,10 +12,10 @@ export function Team({ children }) {
}
if (!team) {
return notFound();
return null;
}
return children;
return <TeamContext.Provider value={team}>{children}</TeamContext.Provider>;
}
export default Team;

View file

@ -0,0 +1,6 @@
'use client';
import { createContext } from 'react';
export const TeamContext = createContext(null);
export default TeamContext;