dashboard: add retention and quick fix loading states

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-05-01 14:15:31 +02:00
parent c3815bf6ab
commit 5e743a3502
52 changed files with 1324 additions and 205 deletions

View File

@@ -1,11 +1,13 @@
import withSuspense from '@/hocs/with-suspense';
import { getLiveVisitors } from '@openpanel/db';
import type { LiveCounterProps } from './live-counter';
import LiveCounter from './live-counter';
export default async function ServerLiveCounter(
props: Omit<LiveCounterProps, 'data'>
) {
async function ServerLiveCounter(props: Omit<LiveCounterProps, 'data'>) {
const count = await getLiveVisitors(props.projectId);
return <LiveCounter data={count} {...props} />;
}
export default withSuspense(ServerLiveCounter, () => <div />);

View File

@@ -0,0 +1,20 @@
import { Button } from '@/components/ui/button';
import withSuspense from '@/hocs/with-suspense';
import { Globe2Icon } from 'lucide-react';
import { getShareByProjectId } from '@openpanel/db';
import { OverviewShare } from './overview-share';
type Props = {
projectId: string;
};
const OverviewShareServer = async ({ projectId }: Props) => {
const share = await getShareByProjectId(projectId);
return <OverviewShare data={share} />;
};
export default withSuspense(OverviewShareServer, () => (
<Button icon={Globe2Icon}>Private</Button>
));

View File

@@ -1,5 +1,13 @@
'use client';
import { Button } from '@/components/ui/button';
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import { pushModal } from '@/modals';
import { api } from '@/trpc/client';
import { EyeIcon, Globe2Icon, LockIcon } from 'lucide-react';
@@ -8,15 +16,6 @@ import { useRouter } from 'next/navigation';
import type { ShareOverview } from '@openpanel/db';
import { Button } from '../ui/button';
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuTrigger,
} from '../ui/dropdown-menu';
interface OverviewShareProps {
data: ShareOverview | null;
}