From 0452be58f0364cc197da36e297ca10c36448bcf2 Mon Sep 17 00:00:00 2001 From: Antoine Clausse Date: Fri, 21 Feb 2025 16:14:58 +0100 Subject: [PATCH] Merge pull request #23811 from overleaf/revert-23801-ac-remove-ds-nav-code-3 Revert "[web] Show DS Navigation for all SAAS users regardless of feature flag" GitOrigin-RevId: 3a5b5603718da2fddabc9f1460151efd9cbf6178 --- .../components/project-list-events.ts | 10 +++++-- .../components/project-list-root.tsx | 4 ++- .../components/sidebar/sidebar-filters.tsx | 3 ++- .../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 | 2 +- .../components/survey-widget.test.tsx | 26 +++++-------------- .../project-tools-rename.test.tsx | 4 +-- 9 files changed, 28 insertions(+), 45 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 03e426bc7e..eda62016ed 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,4 +1,5 @@ import { useCallback } from 'react' +import { useSplitTestContext } from '@/shared/context/split-test-context' import { sendMB } from '@/infrastructure/event-tracking' export type ExtraSegmentations = { @@ -38,11 +39,16 @@ 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), - [] + ) => + sendMB(event, { ...payload, 'sidebar-navigation-ui-update': hasDsNav }), + [hasDsNav] ) } 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 abb26d3b71..420b2454ab 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, - hasDsNav, + useIsDsNav, } from '@/features/project-list/components/use-is-ds-nav' function ProjectListRoot() { @@ -82,6 +82,8 @@ function ProjectListPageContent() { const { t } = useTranslation() + const hasDsNav = useIsDsNav() + if (isLoading) { const loadingComponent = ( 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 58b17a0de9..799ccbd6f3 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 { hasDsNav } from '@/features/project-list/components/use-is-ds-nav' +import { useIsDsNav } from '@/features/project-list/components/use-is-ds-nav' type SidebarFilterProps = { filter: Filter @@ -30,6 +30,7 @@ export function SidebarFilter({ filter, text }: SidebarFilterProps) { export default function SidebarFilters() { const { t } = useTranslation() + const hasDsNav = useIsDsNav() return (
    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 1fd35703aa..b149a6b44c 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 { hasDsNav } from '@/features/project-list/components/use-is-ds-nav' +import { useIsDsNav } from '@/features/project-list/components/use-is-ds-nav' export default function TagsList() { const { t } = useTranslation() @@ -35,6 +35,7 @@ export default function TagsList() { DeleteTagModal, } = useTag() + const isDsNav = useIsDsNav() return ( <>