mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 15:47:13 +01:00
Settings refactor.
This commit is contained in:
parent
1b81074752
commit
c98f324c22
56 changed files with 706 additions and 348 deletions
|
|
@ -1,5 +1,5 @@
|
|||
'use client';
|
||||
import { TeamDetails } from '@/app/(main)/teams/[teamId]/settings/team/TeamDetails';
|
||||
import { TeamDetails } from '@/app/(main)/settings/teams/[teamId]/TeamDetails';
|
||||
import { TeamProvider } from '@/app/(main)/teams/[teamId]/TeamProvider';
|
||||
|
||||
export function AdminTeamPage({ teamId }: { teamId: string }) {
|
||||
|
|
|
|||
|
|
@ -1,22 +1,19 @@
|
|||
import { createContext, ReactNode, useEffect } from 'react';
|
||||
import { createContext, ReactNode } from 'react';
|
||||
import { Loading } from '@umami/react-zen';
|
||||
import { useModified, useUserQuery } from '@/components/hooks';
|
||||
import { useUserQuery } from '@/components/hooks';
|
||||
|
||||
export const UserContext = createContext(null);
|
||||
|
||||
export function UserProvider({ userId, children }: { userId: string; children: ReactNode }) {
|
||||
const { modified } = useModified(`user:${userId}`);
|
||||
const { data: user, isFetching, isLoading, refetch } = useUserQuery(userId);
|
||||
|
||||
useEffect(() => {
|
||||
if (modified) {
|
||||
refetch();
|
||||
}
|
||||
}, [modified]);
|
||||
const { data: user, isFetching, isLoading } = useUserQuery(userId);
|
||||
|
||||
if (isFetching && isLoading) {
|
||||
return <Loading position="page" />;
|
||||
}
|
||||
|
||||
return <UserContext.Provider value={{ ...user, modified }}>{children}</UserContext.Provider>;
|
||||
if (!user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <UserContext.Provider value={user}>{children}</UserContext.Provider>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue