From 462c2d7bd34bc75fc0d9ec1c659531e64e22dfd8 Mon Sep 17 00:00:00 2001 From: Antoine Clausse Date: Mon, 24 Feb 2025 11:07:22 +0100 Subject: [PATCH] [web] Show DS Navigation for all SAAS users regardless of feature flag (with fix!) (#23821) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Reapply "[web] Show DS Navigation for all SAAS users regardless of feature fla…" This reverts commit 8d4096a7e4b6a7894b1bef14290548225deebd57. * Fix: `hasDsNav` should check `isOverleaf` !!! * Change `hasDsNav` from a boolean to a function call for dynamic evaluation GitOrigin-RevId: 17463ac113a4278ed344622552d83da93b208b4d --- .../components/project-list-events.ts | 10 ++----- .../components/project-list-root.tsx | 8 +++--- .../components/sidebar/sidebar-filters.tsx | 5 ++-- .../components/sidebar/tags-list.tsx | 11 ++++---- .../components/survey-widget-ds-nav.tsx | 8 ++++++ .../project-list/components/use-is-ds-nav.tsx | 5 +++- .../components/sidebar/tags-list.test.tsx | 3 ++- .../components/survey-widget.test.tsx | 26 ++++++++++++++----- .../project-tools-rename.test.tsx | 4 ++- 9 files changed, 49 insertions(+), 31 deletions(-) diff --git a/services/web/frontend/js/features/project-list/components/project-list-events.ts b/services/web/frontend/js/features/project-list/components/project-list-events.ts index eda62016ed..03e426bc7e 100644 --- a/services/web/frontend/js/features/project-list/components/project-list-events.ts +++ b/services/web/frontend/js/features/project-list/components/project-list-events.ts @@ -1,5 +1,4 @@ import { useCallback } from 'react' -import { useSplitTestContext } from '@/shared/context/split-test-context' import { sendMB } from '@/infrastructure/event-tracking' export type ExtraSegmentations = { @@ -39,16 +38,11 @@ export type ExtraSegmentations = { } export const useSendProjectListMB = () => { - const { splitTestVariants } = useSplitTestContext() - const hasDsNav = splitTestVariants['sidebar-navigation-ui-update'] as - | 'default' - | 'active' return useCallback( ( event: T, payload: ExtraSegmentations[T] - ) => - sendMB(event, { ...payload, 'sidebar-navigation-ui-update': hasDsNav }), - [hasDsNav] + ) => sendMB(event, payload), + [] ) } diff --git a/services/web/frontend/js/features/project-list/components/project-list-root.tsx b/services/web/frontend/js/features/project-list/components/project-list-root.tsx index 420b2454ab..5de7d9372e 100644 --- a/services/web/frontend/js/features/project-list/components/project-list-root.tsx +++ b/services/web/frontend/js/features/project-list/components/project-list-root.tsx @@ -20,7 +20,7 @@ import ProjectListDefault from '@/features/project-list/components/project-list- import { ProjectListDsNav } from '@/features/project-list/components/project-list-ds-nav' import { DsNavStyleProvider, - useIsDsNav, + hasDsNav, } from '@/features/project-list/components/use-is-ds-nav' function ProjectListRoot() { @@ -82,14 +82,12 @@ function ProjectListPageContent() { const { t } = useTranslation() - const hasDsNav = useIsDsNav() - if (isLoading) { const loadingComponent = ( ) - if (hasDsNav) { + if (hasDsNav()) { return loadingComponent } else { return ( @@ -106,7 +104,7 @@ function ProjectListPageContent() { ) - } else if (hasDsNav) { + } else if (hasDsNav()) { return ( diff --git a/services/web/frontend/js/features/project-list/components/sidebar/sidebar-filters.tsx b/services/web/frontend/js/features/project-list/components/sidebar/sidebar-filters.tsx index 799ccbd6f3..ad908238ca 100644 --- a/services/web/frontend/js/features/project-list/components/sidebar/sidebar-filters.tsx +++ b/services/web/frontend/js/features/project-list/components/sidebar/sidebar-filters.tsx @@ -5,7 +5,7 @@ import { } from '../../context/project-list-context' import TagsList from './tags-list' import ProjectsFilterMenu from '../projects-filter-menu' -import { useIsDsNav } from '@/features/project-list/components/use-is-ds-nav' +import { hasDsNav } from '@/features/project-list/components/use-is-ds-nav' type SidebarFilterProps = { filter: Filter @@ -30,7 +30,6 @@ export function SidebarFilter({ filter, text }: SidebarFilterProps) { export default function SidebarFilters() { const { t } = useTranslation() - const hasDsNav = useIsDsNav() return (
    @@ -39,7 +38,7 @@ export default function SidebarFilters() { - {hasDsNav && ( + {hasDsNav() && (

  • diff --git a/services/web/frontend/js/features/project-list/components/sidebar/tags-list.tsx b/services/web/frontend/js/features/project-list/components/sidebar/tags-list.tsx index b149a6b44c..6b1c0db706 100644 --- a/services/web/frontend/js/features/project-list/components/sidebar/tags-list.tsx +++ b/services/web/frontend/js/features/project-list/components/sidebar/tags-list.tsx @@ -14,7 +14,7 @@ import { DropdownMenu, DropdownToggle, } from '@/features/ui/components/bootstrap-5/dropdown-menu' -import { useIsDsNav } from '@/features/project-list/components/use-is-ds-nav' +import { hasDsNav } from '@/features/project-list/components/use-is-ds-nav' export default function TagsList() { const { t } = useTranslation() @@ -35,7 +35,6 @@ export default function TagsList() { DeleteTagModal, } = useTag() - const isDsNav = useIsDsNav() return ( <>