Redesigned share page.

This commit is contained in:
Mike Cao 2026-01-28 23:10:42 -08:00
parent 9d3f5ad0fd
commit 78d467b478
9 changed files with 130 additions and 88 deletions

View file

@ -0,0 +1,29 @@
'use client';
import { Loading } from '@umami/react-zen';
import { createContext, type ReactNode } from 'react';
import { useShareTokenQuery } from '@/components/hooks';
import type { WhiteLabel } from '@/lib/types';
export interface ShareData {
shareId: string;
websiteId: string;
parameters: any;
token: string;
whiteLabel?: WhiteLabel;
}
export const ShareContext = createContext<ShareData>(null);
export function ShareProvider({ shareId, children }: { shareId: string; children: ReactNode }) {
const { share, isLoading, isFetching } = useShareTokenQuery(shareId);
if (isFetching && isLoading) {
return <Loading placement="absolute" />;
}
if (!share) {
return null;
}
return <ShareContext.Provider value={share}>{children}</ShareContext.Provider>;
}