Add sharing to pixel and link detail pages

This commit is contained in:
Mike Cao committed 2026-03-09 01:26:02 -07:00
1 parent c4226bc63d
commit 64bf4c378c
23 files changed
+582 -43

No files matched your search

+5 -2
View File
@@ -13,6 +13,8 @@ export interface ShareData {
websiteId?: string;
websiteIds?: string[];
boardId?: string;
pixelId?: string;
linkId?: string;
parameters: any;
token: string;
whiteLabel?: WhiteLabel;
@@ -54,12 +56,13 @@ export function ShareProvider({ slug, children }: { slug: string; children: Reac
const pathname = usePathname();
const path = getSharePath(pathname);
const isBoardShare = share?.shareType === ENTITY_TYPE.board;
const isWebsiteShare = share?.shareType === ENTITY_TYPE.website;
const allowedSections = !isBoardShare && share?.parameters
const allowedSections = isWebsiteShare && share?.parameters
? ALL_SECTION_IDS.filter(id => share.parameters[id] !== false)
: [];
const shouldRedirect = !isBoardShare &&
const shouldRedirect = isWebsiteShare &&
allowedSections.length === 1 &&
allowedSections[0] !== 'overview' &&
(path === undefined || path === '' || path === 'overview');
+11 -1
View File
@@ -2,6 +2,8 @@
import { Column, Grid, Row, useTheme } from '@umami/react-zen';
import { usePathname } from 'next/navigation';
import { useEffect, useState } from 'react';
import { LinkPage } from '@/app/(main)/links/[linkId]/LinkPage';
import { PixelPage } from '@/app/(main)/pixels/[pixelId]/PixelPage';
import { AttributionPage } from '@/app/(main)/websites/[websiteId]/(reports)/attribution/AttributionPage';
import { BreakdownPage } from '@/app/(main)/websites/[websiteId]/(reports)/breakdown/BreakdownPage';
import { FunnelsPage } from '@/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelsPage';
@@ -59,7 +61,7 @@ export function SharePage() {
const { setTheme } = useTheme();
const pathname = usePathname();
const path = getSharePath(pathname);
const { websiteId, boardId, parameters = {}, shareType } = share;
const { websiteId, boardId, pixelId, linkId, parameters = {}, shareType } = share;
useEffect(() => {
const url = new URL(window?.location?.href);
@@ -81,6 +83,14 @@ export function SharePage() {
);
}
if (shareType === ENTITY_TYPE.pixel && pixelId) {
return <PixelPage pixelId={pixelId} showHeaderActions={false} />;
}
if (shareType === ENTITY_TYPE.link && linkId) {
return <LinkPage linkId={linkId} showHeaderActions={false} />;
}
// Check if the requested path is allowed
const pageKey = path || '';
const isAllowed = pageKey === '' || pageKey === 'overview' || parameters[pageKey] !== false;