mirror of
https://github.com/umami-software/umami.git
synced 2026-02-17 02:55:38 +01:00
Pixel/link metrics pages.
This commit is contained in:
parent
789b8b36d8
commit
8e766e2db7
42 changed files with 530 additions and 49 deletions
20
src/app/(main)/links/LinkProvider.tsx
Normal file
20
src/app/(main)/links/LinkProvider.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
'use client';
|
||||
import { createContext, ReactNode } from 'react';
|
||||
import { useLinkQuery } from '@/components/hooks';
|
||||
import { Loading } from '@umami/react-zen';
|
||||
|
||||
export const LinkContext = createContext(null);
|
||||
|
||||
export function LinkProvider({ linkId, children }: { linkId?: string; children: ReactNode }) {
|
||||
const { data: link, isLoading, isFetching } = useLinkQuery(linkId);
|
||||
|
||||
if (isFetching && isLoading) {
|
||||
return <Loading position="page" />;
|
||||
}
|
||||
|
||||
if (!link) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <LinkContext.Provider value={link}>{children}</LinkContext.Provider>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue