mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 09:35:36 +01:00
Updates to team components.
This commit is contained in:
parent
102f5b78b1
commit
dbb3801e66
28 changed files with 173 additions and 159 deletions
|
|
@ -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;
|
||||
|
|
|
|||
6
src/app/(main)/teams/[teamId]/TeamContext.tsx
Normal file
6
src/app/(main)/teams/[teamId]/TeamContext.tsx
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
'use client';
|
||||
import { createContext } from 'react';
|
||||
|
||||
export const TeamContext = createContext(null);
|
||||
|
||||
export default TeamContext;
|
||||
Loading…
Add table
Add a link
Reference in a new issue