From 81cd7484e0c780e8ce14701facfbe85900ee90b7 Mon Sep 17 00:00:00 2001 From: Tommy Petty Date: Mon, 29 Apr 2024 14:46:06 -0400 Subject: [PATCH 1/2] chore(i18n): fix imports for `useTranslation` --- .../components/list/CommentsListItemReferencedValue.tsx | 2 +- .../comments/plugin/input/components/FloatingButtonPopover.tsx | 2 +- packages/sanity/src/core/components/StatusButton.tsx | 1 + .../src/core/form/inputs/PortableText/toolbar/ActionMenu.tsx | 2 +- .../studio/components/navbar/free-trial/FreeTrialButton.tsx | 2 +- .../src/core/studio/components/navbar/search/SearchButton.tsx | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/sanity/src/core/comments/components/list/CommentsListItemReferencedValue.tsx b/packages/sanity/src/core/comments/components/list/CommentsListItemReferencedValue.tsx index 821f79768c5..1abbd9d98aa 100644 --- a/packages/sanity/src/core/comments/components/list/CommentsListItemReferencedValue.tsx +++ b/packages/sanity/src/core/comments/components/list/CommentsListItemReferencedValue.tsx @@ -4,10 +4,10 @@ import {LinkRemovedIcon} from '@sanity/icons' import {isPortableTextTextBlock} from '@sanity/types' import {Box, Flex, Stack, Text, type Theme} from '@sanity/ui' import {useMemo} from 'react' -import {useTranslation} from 'react-i18next' import {css, styled} from 'styled-components' import {Tooltip} from '../../../../ui-components' +import {useTranslation} from '../../../i18n' import {COMMENTS_HIGHLIGHT_HUE_KEY} from '../../constants' import {commentsLocaleNamespace} from '../../i18n' import {type CommentDocument} from '../../types' diff --git a/packages/sanity/src/core/comments/plugin/input/components/FloatingButtonPopover.tsx b/packages/sanity/src/core/comments/plugin/input/components/FloatingButtonPopover.tsx index acfa291c892..640761065b2 100644 --- a/packages/sanity/src/core/comments/plugin/input/components/FloatingButtonPopover.tsx +++ b/packages/sanity/src/core/comments/plugin/input/components/FloatingButtonPopover.tsx @@ -2,10 +2,10 @@ import {AddCommentIcon} from '@sanity/icons' import {useClickOutside} from '@sanity/ui' import {motion, type Variants} from 'framer-motion' import {useState} from 'react' -import {useTranslation} from 'react-i18next' import {styled} from 'styled-components' import {Button, Popover, type PopoverProps} from '../../../../../ui-components' +import {useTranslation} from '../../../../i18n' import {CommentDisabledIcon} from '../../../components' import {commentsLocaleNamespace} from '../../../i18n' diff --git a/packages/sanity/src/core/components/StatusButton.tsx b/packages/sanity/src/core/components/StatusButton.tsx index 427fd34ef82..1d2a3b0c651 100644 --- a/packages/sanity/src/core/components/StatusButton.tsx +++ b/packages/sanity/src/core/components/StatusButton.tsx @@ -3,6 +3,7 @@ import {type ForwardedRef, forwardRef, type HTMLProps, type ReactNode, useMemo} import {styled} from 'styled-components' import {Button, type ButtonProps} from '../../ui-components' +import {useTranslation} from '../i18n' /** @hidden @beta */ export type StatusButtonProps = ButtonProps & { diff --git a/packages/sanity/src/core/form/inputs/PortableText/toolbar/ActionMenu.tsx b/packages/sanity/src/core/form/inputs/PortableText/toolbar/ActionMenu.tsx index 54ec1e30b92..603fefdbebd 100644 --- a/packages/sanity/src/core/form/inputs/PortableText/toolbar/ActionMenu.tsx +++ b/packages/sanity/src/core/form/inputs/PortableText/toolbar/ActionMenu.tsx @@ -5,11 +5,11 @@ import { } from '@sanity/portable-text-editor' import {isKeySegment} from '@sanity/types' import {memo, useCallback, useMemo} from 'react' -import {useTranslation} from 'react-i18next' import {type PopoverProps} from '../../../../../ui-components' import {CollapseMenu, CollapseMenuButton} from '../../../../components/collapseMenu' import {ContextMenuButton} from '../../../../components/contextMenuButton' +import {useTranslation} from '../../../../i18n' import {getActionIcon} from './helpers' import {useActiveActionKeys, useFocusBlock} from './hooks' import {type PTEToolbarAction, type PTEToolbarActionGroup} from './types' diff --git a/packages/sanity/src/core/studio/components/navbar/free-trial/FreeTrialButton.tsx b/packages/sanity/src/core/studio/components/navbar/free-trial/FreeTrialButton.tsx index fdfad5fb471..e03fc3ec031 100644 --- a/packages/sanity/src/core/studio/components/navbar/free-trial/FreeTrialButton.tsx +++ b/packages/sanity/src/core/studio/components/navbar/free-trial/FreeTrialButton.tsx @@ -2,10 +2,10 @@ import {purple, yellow} from '@sanity/color' import {BoltIcon} from '@sanity/icons' import {Card, Text} from '@sanity/ui' import {forwardRef, type Ref} from 'react' -import {useTranslation} from 'react-i18next' import {styled} from 'styled-components' import {Button} from '../../../../../ui-components' +import {useTranslation} from '../../../../i18n' const CenteredStroke = styled.div` position: absolute; diff --git a/packages/sanity/src/core/studio/components/navbar/search/SearchButton.tsx b/packages/sanity/src/core/studio/components/navbar/search/SearchButton.tsx index 035756ad3ed..6e45fa661f3 100644 --- a/packages/sanity/src/core/studio/components/navbar/search/SearchButton.tsx +++ b/packages/sanity/src/core/studio/components/navbar/search/SearchButton.tsx @@ -1,8 +1,8 @@ import {SearchIcon} from '@sanity/icons' import {type ForwardedRef, forwardRef} from 'react' -import {useTranslation} from 'react-i18next' import {Button} from '../../../../../ui-components' +import {useTranslation} from '../../../../i18n' import {GLOBAL_SEARCH_KEY, GLOBAL_SEARCH_KEY_MODIFIER} from './constants' interface SearchButtonProps { From e5fce52576409a38d395bf5753a56864e265ef75 Mon Sep 17 00:00:00 2001 From: Tommy Petty Date: Mon, 29 Apr 2024 15:08:02 -0400 Subject: [PATCH 2/2] chore(i18n): fix imports for `useTranslation`, rebased --- packages/sanity/src/core/components/StatusButton.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/sanity/src/core/components/StatusButton.tsx b/packages/sanity/src/core/components/StatusButton.tsx index 1d2a3b0c651..427fd34ef82 100644 --- a/packages/sanity/src/core/components/StatusButton.tsx +++ b/packages/sanity/src/core/components/StatusButton.tsx @@ -3,7 +3,6 @@ import {type ForwardedRef, forwardRef, type HTMLProps, type ReactNode, useMemo} import {styled} from 'styled-components' import {Button, type ButtonProps} from '../../ui-components' -import {useTranslation} from '../i18n' /** @hidden @beta */ export type StatusButtonProps = ButtonProps & {