Files
plane/apps/web/core/hooks/use-workspace-paths.ts
chuan bba4bb40c8
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
feat: init
2025-11-11 01:56:44 +08:00

25 lines
735 B
TypeScript

"use client";
import { useParams, usePathname } from "next/navigation";
/**
* Custom hook to detect different workspace paths
* @returns Object containing boolean flags for different workspace paths
*/
export const useWorkspacePaths = () => {
const { workspaceSlug } = useParams();
const pathname = usePathname();
const isSettingsPath = pathname.includes(`/${workspaceSlug}/settings`);
const isWikiPath = pathname.includes(`/${workspaceSlug}/pages`);
const isAiPath = pathname.includes(`/${workspaceSlug}/pi-chat`);
const isProjectsPath = pathname.includes(`/${workspaceSlug}/`) && !isWikiPath && !isAiPath && !isSettingsPath;
return {
isSettingsPath,
isWikiPath,
isAiPath,
isProjectsPath,
};
};