diff --git a/services/web/frontend/js/features/source-editor/extensions/spelling/spelling-suggestions-feedback.tsx b/services/web/frontend/js/features/source-editor/extensions/spelling/spelling-suggestions-feedback.tsx
new file mode 100644
index 0000000000..fa2dd9768e
--- /dev/null
+++ b/services/web/frontend/js/features/source-editor/extensions/spelling/spelling-suggestions-feedback.tsx
@@ -0,0 +1,56 @@
+import { FC, memo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSplitTest } from '@/shared/context/split-test-context'
+import { chooseBadgeClass } from '@/shared/components/beta-badge'
+import OLTooltip from '@/features/ui/components/ol/ol-tooltip'
+import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
+import classnames from 'classnames'
+import MaterialIcon from '@/shared/components/material-icon'
+
+const SpellingSuggestionsFeedback: FC = () => {
+ const { t } = useTranslation()
+ const { info } = useSplitTest('spell-check-client')
+
+ if (!info) {
+ return null
+ }
+
+ const { tooltipText, url } = info.badgeInfo ?? {}
+ const badgeClass = chooseBadgeClass(info.phase)
+
+ return (
+
+ We are testing an updated spellchecker.
+
+ Click to give feedback
+ >
+ )
+ }
+ tooltipProps={{ className: 'split-test-badge-tooltip' }}
+ overlayProps={{ placement: 'bottom', delay: 100 }}
+ >
+
+ }
+ bs5={
+
+ }
+ />
+ {t('give_feedback')}
+
+
+ )
+}
+
+export default memo(SpellingSuggestionsFeedback)
diff --git a/services/web/frontend/js/features/source-editor/extensions/spelling/spelling-suggestions.tsx b/services/web/frontend/js/features/source-editor/extensions/spelling/spelling-suggestions.tsx
index d3ab0644f7..de53d815f0 100644
--- a/services/web/frontend/js/features/source-editor/extensions/spelling/spelling-suggestions.tsx
+++ b/services/web/frontend/js/features/source-editor/extensions/spelling/spelling-suggestions.tsx
@@ -8,19 +8,14 @@ import {
} from 'react'
import { SpellChecker, Word } from './spellchecker'
import { useTranslation } from 'react-i18next'
-import SplitTestBadge from '@/shared/components/split-test-badge'
import getMeta from '@/utils/meta'
import classnames from 'classnames'
-import { SpellCheckLanguage } from '../../../../../../types/project-settings'
-import Icon from '@/shared/components/icon'
import { useFeatureFlag } from '@/shared/context/split-test-context'
import { sendMB } from '@/infrastructure/event-tracking'
+import SpellingSuggestionsFeedback from './spelling-suggestions-feedback'
const ITEMS_TO_SHOW = 8
-// TODO: messaging below the spelling suggestions
-const SHOW_FOOTER = false
-
// (index % length) that works for negative index
const wrapArrayIndex = (index: number, length: number) =>
((index % length) + length) % length
@@ -76,6 +71,8 @@ export const SpellingSuggestions: FC<{
}
}, [spellCheckLanguage])
+ const spellCheckClientEnabled = useFeatureFlag('spell-check-client')
+
return (
- {SHOW_FOOTER && language && (
+ {spellCheckClientEnabled && language?.dic && (
<>
-
+
>
)}
@@ -137,28 +134,6 @@ export const SpellingSuggestions: FC<{
)
}
-const Footer: FC<{ language: SpellCheckLanguage }> = ({ language }) => {
- const spellCheckClientEnabled = useFeatureFlag('spell-check-client')
-
- if (!spellCheckClientEnabled) {
- return null
- }
-
- return language.dic ? (
-
- {' '}
- {language?.name}
-
- ) : (
-
- {language?.name}
-
- )
-}
-
const ListItem: FC<{
content: string
selected: boolean
diff --git a/services/web/frontend/js/shared/components/beta-badge.tsx b/services/web/frontend/js/shared/components/beta-badge.tsx
index 907d53d1e7..5679f0a1a1 100644
--- a/services/web/frontend/js/shared/components/beta-badge.tsx
+++ b/services/web/frontend/js/shared/components/beta-badge.tsx
@@ -18,19 +18,7 @@ const BetaBadge: FC<{
url?: string
phase?: string
}> = ({ tooltip, url = '/beta/participate', phase = 'beta' }) => {
- let badgeClass: 'info-badge' | 'alpha-badge' | 'beta-badge'
- switch (phase) {
- case 'release':
- badgeClass = 'info-badge'
- break
- case 'alpha':
- badgeClass = 'alpha-badge'
- break
- case 'beta':
- default:
- badgeClass = 'beta-badge'
- }
-
+ const badgeClass = chooseBadgeClass(phase)
return (
{
+ switch (phase) {
+ case 'release':
+ return 'info-badge'
+ case 'alpha':
+ return 'alpha-badge'
+ case 'beta':
+ default:
+ return 'beta-badge'
+ }
+}
+
export default BetaBadge
diff --git a/services/web/frontend/js/shared/context/split-test-context.tsx b/services/web/frontend/js/shared/context/split-test-context.tsx
index 8d78534d68..4902dadcde 100644
--- a/services/web/frontend/js/shared/context/split-test-context.tsx
+++ b/services/web/frontend/js/shared/context/split-test-context.tsx
@@ -1,13 +1,11 @@
import { createContext, FC, useContext, useMemo } from 'react'
import getMeta from '../../utils/meta'
-
-type SplitTestVariants = Record
-type SplitTestInfo = Record
+import { SplitTestInfo } from '../../../../types/split-test'
export const SplitTestContext = createContext<
| {
- splitTestVariants: SplitTestVariants
- splitTestInfo: SplitTestInfo
+ splitTestVariants: Record
+ splitTestInfo: Record
}
| undefined
>(undefined)
@@ -44,3 +42,15 @@ export function useFeatureFlag(name: string) {
const { splitTestVariants } = useSplitTestContext()
return splitTestVariants[name] === 'enabled'
}
+
+export function useSplitTest(name: string): {
+ variant: string | undefined
+ info: SplitTestInfo | undefined
+} {
+ const { splitTestVariants, splitTestInfo } = useSplitTestContext()
+
+ return {
+ variant: splitTestVariants[name],
+ info: splitTestInfo[name],
+ }
+}
diff --git a/services/web/test/frontend/features/source-editor/components/codemirror-editor-spellchecker-client.spec.tsx b/services/web/test/frontend/features/source-editor/components/codemirror-editor-spellchecker-client.spec.tsx
index 20ed94f322..754881fafa 100644
--- a/services/web/test/frontend/features/source-editor/components/codemirror-editor-spellchecker-client.spec.tsx
+++ b/services/web/test/frontend/features/source-editor/components/codemirror-editor-spellchecker-client.spec.tsx
@@ -43,7 +43,11 @@ forEach(Object.keys(suggestions)).describe(
win.metaAttributesCache.set('ol-splitTestVariants', {
'spell-check-client': 'enabled',
})
- win.metaAttributesCache.set('ol-splitTestInfo', {})
+ win.metaAttributesCache.set('ol-splitTestInfo', {
+ 'spell-check-client': {
+ phase: 'release',
+ },
+ })
win.metaAttributesCache.set('ol-learnedWords', ['baz'])
win.metaAttributesCache.set(
'ol-dictionariesRoot',
diff --git a/services/web/types/split-test.ts b/services/web/types/split-test.ts
index feb2c98e45..9002ff00f1 100644
--- a/services/web/types/split-test.ts
+++ b/services/web/types/split-test.ts
@@ -8,4 +8,8 @@ export type SplitTestInfo = {
rolloutPercent: number
}[]
hasOverride?: boolean
+ badgeInfo?: {
+ url?: string
+ tooltipText?: string
+ }
}