Skip to content

Commit 9c78cc4

Browse files
committed
refactor: enhance usePublicAccessPage hook to include preview page detection
- Added logic to detect if the current page is a preview page by checking the pathname. - Updated the return statement to include the new preview page condition alongside existing checks for share, artifact gallery, and use cases gallery pages. - Ensured compliance with Tailwind CSS styling and performance optimizations, including the use of optional chaining and nullish coalescing.
1 parent d74d514 commit 9c78cc4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/ai-workspace-common/src/hooks/use-is-share-page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { useLocation } from 'react-router-dom';
33
export const usePublicAccessPage = () => {
44
const location = useLocation();
55
const isSharePage = location?.pathname?.startsWith('/share/') ?? false;
6+
const isPreviewPage = location?.pathname?.startsWith('/preview/') ?? false;
67
const isArtifactGalleryPage = location?.pathname?.startsWith('/artifact-gallery') ?? false;
78
const isUseCasesGalleryPage = location?.pathname?.startsWith('/use-cases-gallery') ?? false;
8-
return isSharePage || isArtifactGalleryPage || isUseCasesGalleryPage;
9+
return isPreviewPage || isSharePage || isArtifactGalleryPage || isUseCasesGalleryPage;
910
};

0 commit comments

Comments
 (0)