From 850491d42b6a2aea58e930d9dbe9e8f9268fbe00 Mon Sep 17 00:00:00 2001 From: Adam Chmara Date: Thu, 7 Nov 2024 10:49:32 +0100 Subject: [PATCH] feat(web): new dashboard naming --- ...Widget.tsx => NewDashboardOptInWidget.tsx} | 24 +++++++++---------- apps/web/src/components/nav/RootNavMenu.tsx | 4 ++-- packages/shared/src/types/clerk/types.ts | 4 ++-- .../src/types/feature-flags/feature-flags.ts | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) rename apps/web/src/components/layout/components/v2/{V3DashboardOptInWidget.tsx => NewDashboardOptInWidget.tsx} (74%) diff --git a/apps/web/src/components/layout/components/v2/V3DashboardOptInWidget.tsx b/apps/web/src/components/layout/components/v2/NewDashboardOptInWidget.tsx similarity index 74% rename from apps/web/src/components/layout/components/v2/V3DashboardOptInWidget.tsx rename to apps/web/src/components/layout/components/v2/NewDashboardOptInWidget.tsx index 1b579fd7a5c..439468bf3e8 100644 --- a/apps/web/src/components/layout/components/v2/V3DashboardOptInWidget.tsx +++ b/apps/web/src/components/layout/components/v2/NewDashboardOptInWidget.tsx @@ -3,41 +3,41 @@ import { css } from '@novu/novui/css'; import { Text, Title, Button, IconButton } from '@novu/novui'; import { IconOutlineClose } from '@novu/novui/icons'; import { useUser } from '@clerk/clerk-react'; -import { FeatureFlagsKeysEnum, V3DashboardOptInStatusEnum } from '@novu/shared'; +import { FeatureFlagsKeysEnum, NewDashboardOptInStatusEnum } from '@novu/shared'; import { IS_SELF_HOSTED } from '../../../../config'; import { useFeatureFlag } from '../../../../hooks'; -export function V3DashboardOptInWidget() { +export function NewDashboardOptInWidget() { const { user } = useUser(); - const isV3DashboardEnabled = useFeatureFlag(FeatureFlagsKeysEnum.IS_V3_DASHBOARD_ENABLED); + const isNewDashboardEnabled = useFeatureFlag(FeatureFlagsKeysEnum.IS_NEW_DASHBOARD_ENABLED); - const isDismissed = user?.unsafeMetadata?.v3DashboardOptInStatus === V3DashboardOptInStatusEnum.DISMISSED; + const isDismissed = user?.unsafeMetadata?.newDashboardOptInStatus === NewDashboardOptInStatusEnum.DISMISSED; - if (IS_SELF_HOSTED || isDismissed || !isV3DashboardEnabled) { + if (IS_SELF_HOSTED || isDismissed || !isNewDashboardEnabled) { return null; } - const updateUserOptInStatus = (status: V3DashboardOptInStatusEnum) => { + const updateUserOptInStatus = (status: NewDashboardOptInStatusEnum) => { if (!user) return; user.update({ unsafeMetadata: { ...user.unsafeMetadata, - v3DashboardOptInStatus: status, + newDashboardOptInStatus: status, }, }); }; function handleOptIn() { - const v3DashboardUrl = process.env.V3_DASHBOARD_URL; - if (!v3DashboardUrl || !user) return; + const newDashboardUrl = process.env.NEW_DASHBOARD_URL; + if (!newDashboardUrl || !user) return; - updateUserOptInStatus(V3DashboardOptInStatusEnum.OPTED_IN); - window.location.href = v3DashboardUrl; + updateUserOptInStatus(NewDashboardOptInStatusEnum.OPTED_IN); + window.location.href = newDashboardUrl; } function handleDismiss() { - updateUserOptInStatus(V3DashboardOptInStatusEnum.DISMISSED); + updateUserOptInStatus(NewDashboardOptInStatusEnum.DISMISSED); } return ( diff --git a/apps/web/src/components/nav/RootNavMenu.tsx b/apps/web/src/components/nav/RootNavMenu.tsx index af50177fc78..fe74056496a 100644 --- a/apps/web/src/components/nav/RootNavMenu.tsx +++ b/apps/web/src/components/nav/RootNavMenu.tsx @@ -39,7 +39,7 @@ import { SidebarFooter } from '../layout/components/LocalStudioSidebar/SidebarFo import { useNavigateToLocalStudio } from '../../studio/hooks/useNavigateToLocalStudio'; import { OpenLocalStudioModal } from '../../studio/components/OpenLocalStudioModal'; import { OutlineButton } from '../../studio/components/OutlineButton'; -import { V3DashboardOptInWidget } from '../layout/components/v2/V3DashboardOptInWidget'; +import { NewDashboardOptInWidget } from '../layout/components/v2/NewDashboardOptInWidget'; const getEnvPageRoute = (route: ROUTES, env: BaseEnvironmentEnum) => parseUrl(route, { env }); @@ -162,7 +162,7 @@ export const RootNavMenu: React.FC = () => { {isV2Enabled ? ( <> - + Open Local Studio diff --git a/packages/shared/src/types/clerk/types.ts b/packages/shared/src/types/clerk/types.ts index bca31ba40eb..310e354c2af 100644 --- a/packages/shared/src/types/clerk/types.ts +++ b/packages/shared/src/types/clerk/types.ts @@ -24,10 +24,10 @@ export type UserPublicMetadata = { * Unsafe metadata can be updated from the frontend directly */ export type UserUnsafeMetadata = { - v3DashboardOptInStatus?: V3DashboardOptInStatusEnum; + newDashboardOptInStatus?: NewDashboardOptInStatusEnum; }; -export enum V3DashboardOptInStatusEnum { +export enum NewDashboardOptInStatusEnum { OPTED_IN = 'opted_in', // user switched to the new dashboard DISMISSED = 'dismissed', // user dismissed the opt-in widget OPTED_OUT = 'opted_out', // user switched back to the old dashboard diff --git a/packages/shared/src/types/feature-flags/feature-flags.ts b/packages/shared/src/types/feature-flags/feature-flags.ts index 73aa0fe626f..ce3af8ec06f 100644 --- a/packages/shared/src/types/feature-flags/feature-flags.ts +++ b/packages/shared/src/types/feature-flags/feature-flags.ts @@ -16,5 +16,5 @@ export enum FeatureFlagsKeysEnum { IS_INTEGRATION_INVALIDATION_DISABLED = 'IS_INTEGRATION_INVALIDATION_DISABLED', IS_EMAIL_INLINE_CSS_DISABLED = 'IS_EMAIL_INLINE_CSS_DISABLED', IS_CONTROLS_AUTOCOMPLETE_ENABLED = 'IS_CONTROLS_AUTOCOMPLETE_ENABLED', - IS_V3_DASHBOARD_ENABLED = 'IS_V3_DASHBOARD_ENABLED', + IS_NEW_DASHBOARD_ENABLED = 'IS_NEW_DASHBOARD_ENABLED', }