mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 21:59:00 +02:00
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
This commit is contained in:
@@ -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(
|
||||
<T extends keyof ExtraSegmentations>(
|
||||
event: T,
|
||||
payload: ExtraSegmentations[T]
|
||||
) => sendMB(event, payload),
|
||||
[]
|
||||
) =>
|
||||
sendMB(event, { ...payload, 'sidebar-navigation-ui-update': hasDsNav }),
|
||||
[hasDsNav]
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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 = (
|
||||
<LoadingBranded loadProgress={loadProgress} label={t('loading')} />
|
||||
|
||||
+2
-1
@@ -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 (
|
||||
<ul className="list-unstyled project-list-filters">
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<li
|
||||
@@ -42,11 +43,11 @@ export default function TagsList() {
|
||||
aria-hidden="true"
|
||||
data-testid="organize-projects"
|
||||
>
|
||||
{hasDsNav ? t('organize_tags') : t('organize_projects')}
|
||||
{isDsNav ? t('organize_tags') : t('organize_projects')}
|
||||
</li>
|
||||
<li className="tag">
|
||||
<button type="button" className="tag-name" onClick={openCreateTagModal}>
|
||||
{hasDsNav ? (
|
||||
{isDsNav ? (
|
||||
<Plus weight="bold" />
|
||||
) : (
|
||||
<MaterialIcon type="add" className="tag-list-icon" />
|
||||
@@ -73,7 +74,7 @@ export default function TagsList() {
|
||||
color: getTagColor(tag),
|
||||
}}
|
||||
>
|
||||
{hasDsNav ? (
|
||||
{isDsNav ? (
|
||||
<TagSimple weight="fill" className="tag-list-icon" />
|
||||
) : (
|
||||
<MaterialIcon type="label" className="tag-list-icon" />
|
||||
@@ -93,7 +94,7 @@ export default function TagsList() {
|
||||
id={`${tag._id}-dropdown-toggle`}
|
||||
data-testid="tag-dropdown-toggle"
|
||||
>
|
||||
{hasDsNav && <DotsThreeVertical weight="bold" />}
|
||||
{isDsNav && <DotsThreeVertical weight="bold" />}
|
||||
</DropdownToggle>
|
||||
<DropdownMenu className="dropdown-menu-sm-width">
|
||||
<DropdownItem
|
||||
|
||||
@@ -5,7 +5,6 @@ import classnames from 'classnames'
|
||||
import OLButton from '@/features/ui/components/ol/ol-button'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { X } from '@phosphor-icons/react'
|
||||
import { useHideDsSurvey } from '@/features/project-list/components/use-is-ds-nav'
|
||||
|
||||
export function SurveyWidgetDsNav() {
|
||||
const { t } = useTranslation()
|
||||
@@ -14,7 +13,6 @@ export function SurveyWidgetDsNav() {
|
||||
`dismissed-${survey?.name}`,
|
||||
false
|
||||
)
|
||||
const hideDsSurvey = useHideDsSurvey()
|
||||
|
||||
const dismissSurvey = useCallback(() => {
|
||||
setDismissedSurvey(true)
|
||||
@@ -24,12 +22,6 @@ export function SurveyWidgetDsNav() {
|
||||
return null
|
||||
}
|
||||
|
||||
// Hide the survey for users who have sidebar-navigation-ui-update:
|
||||
// They've had it for months. We don't need their feedback anymore
|
||||
if (hideDsSurvey && survey?.name === 'ds-nav') {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={classnames('user-notifications', `survey-${survey.name}`)}>
|
||||
<div className="notification-entry">
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { createContext, type FC, type ReactNode, useContext } from 'react'
|
||||
import { useSplitTestContext } from '@/shared/context/split-test-context'
|
||||
import getMeta from '@/utils/meta'
|
||||
|
||||
export const hasDsNav = getMeta('ol-ExposedSettings')
|
||||
|
||||
/**
|
||||
* This hook returns whether the user has the split-test assignment 'sidebar-navigation-ui-update'
|
||||
*/
|
||||
export const useHideDsSurvey = () => {
|
||||
export const useIsDsNav = () => {
|
||||
const { splitTestVariants } = useSplitTestContext()
|
||||
return splitTestVariants['sidebar-navigation-ui-update'] === 'active'
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ describe('<TagsList />', function () {
|
||||
|
||||
it('displays the tags list', function () {
|
||||
const header = screen.getByTestId('organize-projects')
|
||||
expect(header.textContent).to.equal('Organize Tags')
|
||||
expect(header.textContent).to.equal('Organize Projects')
|
||||
|
||||
screen.getByRole('button', {
|
||||
name: 'New Tag',
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { expect } from 'chai'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { SurveyWidgetDsNav } from '../../../../../frontend/js/features/project-list/components/survey-widget-ds-nav'
|
||||
import { SplitTestProvider } from '@/shared/context/split-test-context'
|
||||
import SurveyWidget from '../../../../../frontend/js/features/project-list/components/survey-widget'
|
||||
|
||||
describe('<SurveyWidgetDsNav />', function () {
|
||||
describe('<SurveyWidget />', function () {
|
||||
beforeEach(function () {
|
||||
this.name = 'my-survey'
|
||||
this.preText = 'To help shape the future of Overleaf'
|
||||
@@ -22,11 +21,7 @@ describe('<SurveyWidgetDsNav />', function () {
|
||||
url: this.url,
|
||||
})
|
||||
|
||||
render(
|
||||
<SplitTestProvider>
|
||||
<SurveyWidgetDsNav />
|
||||
</SplitTestProvider>
|
||||
)
|
||||
render(<SurveyWidget />)
|
||||
})
|
||||
|
||||
it('shows text and link', function () {
|
||||
@@ -34,10 +29,9 @@ describe('<SurveyWidgetDsNav />', function () {
|
||||
expect(dismissed).to.equal(null)
|
||||
|
||||
screen.getByText(this.preText)
|
||||
screen.getByText(this.linkText)
|
||||
|
||||
const link = screen.getByRole('link', {
|
||||
name: 'Take survey',
|
||||
name: this.linkText,
|
||||
}) as HTMLAnchorElement
|
||||
expect(link.href).to.equal(this.url)
|
||||
})
|
||||
@@ -69,11 +63,7 @@ describe('<SurveyWidgetDsNav />', function () {
|
||||
})
|
||||
localStorage.setItem('dismissed-my-survey', 'true')
|
||||
|
||||
render(
|
||||
<SplitTestProvider>
|
||||
<SurveyWidgetDsNav />
|
||||
</SplitTestProvider>
|
||||
)
|
||||
render(<SurveyWidget />)
|
||||
})
|
||||
|
||||
it('nothing is displayed', function () {
|
||||
@@ -87,11 +77,7 @@ describe('<SurveyWidgetDsNav />', function () {
|
||||
|
||||
describe('survey widget is not shown when no survey is configured', function () {
|
||||
beforeEach(function () {
|
||||
render(
|
||||
<SplitTestProvider>
|
||||
<SurveyWidgetDsNav />
|
||||
</SplitTestProvider>
|
||||
)
|
||||
render(<SurveyWidget />)
|
||||
})
|
||||
|
||||
it('nothing is displayed', function () {
|
||||
|
||||
+1
-3
@@ -63,14 +63,12 @@ describe('<ProjectTools />', function () {
|
||||
projects,
|
||||
totalSize: 100,
|
||||
})
|
||||
|
||||
window.metaAttributesCache.set('ol-footer', {
|
||||
showThinFooter: false,
|
||||
translatedLanguages: { en: 'English' },
|
||||
subdomainLang: { en: { lngCode: 'en', url: 'overleaf.com' } },
|
||||
})
|
||||
window.metaAttributesCache.set('ol-navbar', {
|
||||
items: [],
|
||||
})
|
||||
fetchMock.get('/system/messages', [])
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user