Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"use client";
// components
import { AppHeader, ContentWrapper } from "@/components/core";
// plane web components
import { WorkspaceAnalyticsHeader } from "./header";

export default function WorkspaceAnalyticsLayout({ children }: { children: React.ReactNode }) {
export default function WorkspaceAnalyticsTabLayout({ children }: { children: React.ReactNode }) {
return (
<>
<AppHeader header={<WorkspaceAnalyticsHeader />} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,58 @@ import { useCommandPalette, useEventTracker, useProject, useUserPermissions, use
import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path";
import { getAnalyticsTabs } from "@/plane-web/components/analytics/tabs";

const AnalyticsPage = observer(() => {
type Props = {
params: {
tabId: string;
};
};

const AnalyticsPage = observer((props: Props) => {
// props
const { params } = props;
const { tabId } = params;

// hooks
const router = useRouter();
const searchParams = useSearchParams();

// plane imports
const { t } = useTranslation();

// store hooks
const { toggleCreateProjectModal } = useCommandPalette();
const { setTrackElement } = useEventTracker();
const { workspaceProjectIds, loader } = useProject();
const { currentWorkspace } = useWorkspace();
const { allowPermissions } = useUserPermissions();

// helper hooks
const resolvedPath = useResolvedAssetPath({ basePath: "/empty-state/onboarding/analytics" });
// derived values
const pageTitle = currentWorkspace?.name
? t(`workspace_analytics.page_label`, { workspace: currentWorkspace?.name })
: undefined;

// permissions
const canPerformEmptyStateActions = allowPermissions(
[EUserPermissions.ADMIN, EUserPermissions.MEMBER],
EUserPermissionsLevel.WORKSPACE
);

// derived values
const pageTitle = currentWorkspace?.name
? t(`workspace_analytics.page_label`, { workspace: currentWorkspace?.name })
: undefined;
const ANALYTICS_TABS = useMemo(() => getAnalyticsTabs(t), [t]);

const tabs = useMemo(
() =>
ANALYTICS_TABS.map((tab) => ({
key: tab.key,
label: tab.label,
content: <tab.content />,
onClick: () => {
router.push(`?tab=${tab.key}`);
router.push(`/${currentWorkspace?.slug}/analytics/${tab.key}`);
},
isDisabled: tab.isDisabled,
})),
[ANALYTICS_TABS, router]
[ANALYTICS_TABS, router, currentWorkspace?.slug]
);
const defaultTab = searchParams.get("tab") || ANALYTICS_TABS[0].key;
const defaultTab = tabId || ANALYTICS_TABS[0].key;

return (
<>
Expand All @@ -70,8 +82,9 @@ const AnalyticsPage = observer(() => {
defaultTab={defaultTab}
size="md"
tabListContainerClassName="px-6 py-2 border-b border-custom-border-200 flex items-center justify-between"
tabListClassName="my-2 max-w-36"
tabPanelClassName="h-full w-full overflow-hidden overflow-y-auto"
tabListClassName="my-2 w-auto"
tabClassName="px-3"
tabPanelClassName="h-full overflow-hidden overflow-y-auto px-2"
storeInLocalStorage={false}
actions={<AnalyticsFilterActions />}
/>
Expand Down
5 changes: 5 additions & 0 deletions web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ const nextConfig = {
destination: "/:workspaceSlug/settings/projects/:projectId/:path*",
permanent: true,
},
{
source: "/:workspaceSlug/analytics",
destination: "/:workspaceSlug/analytics/overview",
permanent: true,
},
{
source: "/:workspaceSlug/settings/api-tokens",
destination: "/:workspaceSlug/settings/account/api-tokens",
Expand Down