[WEB-4363]: Analytics tab improvements #7248

fix: padding in tabs
This commit is contained in:
JayashTripathy 2025-06-24 14:17:40 +05:30 committed by GitHub
parent fbcc8fc8a0
commit 22a9d48ca3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 31 additions and 14 deletions

View file

@ -1,10 +1,9 @@
"use client"; "use client";
// components // components
import { AppHeader, ContentWrapper } from "@/components/core"; import { AppHeader, ContentWrapper } from "@/components/core";
// plane web components
import { WorkspaceAnalyticsHeader } from "./header"; import { WorkspaceAnalyticsHeader } from "./header";
export default function WorkspaceAnalyticsLayout({ children }: { children: React.ReactNode }) { export default function WorkspaceAnalyticsTabLayout({ children }: { children: React.ReactNode }) {
return ( return (
<> <>
<AppHeader header={<WorkspaceAnalyticsHeader />} /> <AppHeader header={<WorkspaceAnalyticsHeader />} />

View file

@ -16,23 +16,32 @@ import { useCommandPalette, useEventTracker, useProject, useUserPermissions, use
import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path"; import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path";
import { getAnalyticsTabs } from "@/plane-web/components/analytics/tabs"; 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 router = useRouter();
const searchParams = useSearchParams();
// plane imports // plane imports
const { t } = useTranslation(); const { t } = useTranslation();
// store hooks // store hooks
const { toggleCreateProjectModal } = useCommandPalette(); const { toggleCreateProjectModal } = useCommandPalette();
const { setTrackElement } = useEventTracker(); const { setTrackElement } = useEventTracker();
const { workspaceProjectIds, loader } = useProject(); const { workspaceProjectIds, loader } = useProject();
const { currentWorkspace } = useWorkspace(); const { currentWorkspace } = useWorkspace();
const { allowPermissions } = useUserPermissions(); const { allowPermissions } = useUserPermissions();
// helper hooks // helper hooks
const resolvedPath = useResolvedAssetPath({ basePath: "/empty-state/onboarding/analytics" }); const resolvedPath = useResolvedAssetPath({ basePath: "/empty-state/onboarding/analytics" });
// derived values
const pageTitle = currentWorkspace?.name
? t(`workspace_analytics.page_label`, { workspace: currentWorkspace?.name })
: undefined;
// permissions // permissions
const canPerformEmptyStateActions = allowPermissions( const canPerformEmptyStateActions = allowPermissions(
@ -40,8 +49,11 @@ const AnalyticsPage = observer(() => {
EUserPermissionsLevel.WORKSPACE 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 ANALYTICS_TABS = useMemo(() => getAnalyticsTabs(t), [t]);
const tabs = useMemo( const tabs = useMemo(
() => () =>
ANALYTICS_TABS.map((tab) => ({ ANALYTICS_TABS.map((tab) => ({
@ -49,13 +61,13 @@ const AnalyticsPage = observer(() => {
label: tab.label, label: tab.label,
content: <tab.content />, content: <tab.content />,
onClick: () => { onClick: () => {
router.push(`?tab=${tab.key}`); router.push(`/${currentWorkspace?.slug}/analytics/${tab.key}`);
}, },
isDisabled: tab.isDisabled, 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 ( return (
<> <>
@ -70,8 +82,9 @@ const AnalyticsPage = observer(() => {
defaultTab={defaultTab} defaultTab={defaultTab}
size="md" size="md"
tabListContainerClassName="px-6 py-2 border-b border-custom-border-200 flex items-center justify-between" tabListContainerClassName="px-6 py-2 border-b border-custom-border-200 flex items-center justify-between"
tabListClassName="my-2 max-w-36" tabListClassName="my-2 w-auto"
tabPanelClassName="h-full w-full overflow-hidden overflow-y-auto" tabClassName="px-3"
tabPanelClassName="h-full overflow-hidden overflow-y-auto px-2"
storeInLocalStorage={false} storeInLocalStorage={false}
actions={<AnalyticsFilterActions />} actions={<AnalyticsFilterActions />}
/> />

View file

@ -53,6 +53,11 @@ const nextConfig = {
destination: "/:workspaceSlug/settings/projects/:projectId/:path*", destination: "/:workspaceSlug/settings/projects/:projectId/:path*",
permanent: true, permanent: true,
}, },
{
source: "/:workspaceSlug/analytics",
destination: "/:workspaceSlug/analytics/overview",
permanent: true,
},
{ {
source: "/:workspaceSlug/settings/api-tokens", source: "/:workspaceSlug/settings/api-tokens",
destination: "/:workspaceSlug/settings/account/api-tokens", destination: "/:workspaceSlug/settings/account/api-tokens",