From 8b8665df6bb18bc8b99eb69f823d1453e86a4272 Mon Sep 17 00:00:00 2001 From: JimmFly Date: Thu, 5 Jan 2023 12:55:15 +0800 Subject: [PATCH] fix: message wrong about favourites (#669) * fix: wrong message * chore: update type --- packages/app/src/components/contact-modal/index.tsx | 5 ++++- .../header/header-right-items/editor-option-menu.tsx | 4 ++-- packages/app/src/components/page-list/index.tsx | 2 +- .../app/src/components/page-list/operation-cell.tsx | 4 ++-- packages/app/src/components/quick-search/config.ts | 9 ++++++++- packages/app/src/components/shortcuts-modal/config.ts | 11 +++++++---- packages/app/src/libs/i18n/resources/en.json | 4 ++-- 7 files changed, 26 insertions(+), 13 deletions(-) diff --git a/packages/app/src/components/contact-modal/index.tsx b/packages/app/src/components/contact-modal/index.tsx index 50c1e1b530..921b34ba65 100644 --- a/packages/app/src/components/contact-modal/index.tsx +++ b/packages/app/src/components/contact-modal/index.tsx @@ -57,7 +57,10 @@ type TransitionsModalProps = { onClose: () => void; }; -export const ContactModal = ({ open, onClose }: TransitionsModalProps) => { +export const ContactModal = ({ + open, + onClose, +}: TransitionsModalProps): JSX.Element => { const { t } = useTranslation(); const rightLinkList = [ { diff --git a/packages/app/src/components/header/header-right-items/editor-option-menu.tsx b/packages/app/src/components/header/header-right-items/editor-option-menu.tsx index 738e344d48..cfd2813de5 100644 --- a/packages/app/src/components/header/header-right-items/editor-option-menu.tsx +++ b/packages/app/src/components/header/header-right-items/editor-option-menu.tsx @@ -37,12 +37,12 @@ const PopoverContent = () => { onClick={() => { toggleFavoritePage(id); toast( - !favorite ? t('Removed to Favourites') : t('Added to Favourites') + favorite ? t('Removed from Favourites') : t('Added to Favourites') ); }} icon={favorite ? : } > - {favorite ? t('Remove to favourites') : t('Add to favourites')} + {favorite ? t('Remove from favourites') : t('Add to favourites')} : } diff --git a/packages/app/src/components/page-list/index.tsx b/packages/app/src/components/page-list/index.tsx index a4c7b8dbde..604d71000f 100644 --- a/packages/app/src/components/page-list/index.tsx +++ b/packages/app/src/components/page-list/index.tsx @@ -45,7 +45,7 @@ const FavoriteTag = ({ e.stopPropagation(); toggleFavoritePage(id); toast( - !favorite ? t('Removed to Favourites') : t('Added to Favourites') + favorite ? t('Removed from Favourites') : t('Added to Favourites') ); }} style={{ diff --git a/packages/app/src/components/page-list/operation-cell.tsx b/packages/app/src/components/page-list/operation-cell.tsx index 3052199c4d..1b4ec7434a 100644 --- a/packages/app/src/components/page-list/operation-cell.tsx +++ b/packages/app/src/components/page-list/operation-cell.tsx @@ -27,12 +27,12 @@ export const OperationCell = ({ pageMeta }: { pageMeta: PageMeta }) => { onClick={() => { toggleFavoritePage(id); toast( - !favorite ? t('Removed to Favourites') : t('Added to Favourites') + favorite ? t('Removed from Favourites') : t('Added to Favourites') ); }} icon={favorite ? : } > - {favorite ? t('Remove to favourites') : t('Add to favourites')} + {favorite ? t('Remove from favourites') : t('Add to favourites')} { diff --git a/packages/app/src/components/quick-search/config.ts b/packages/app/src/components/quick-search/config.ts index c5171f06c7..c35636c3cc 100644 --- a/packages/app/src/components/quick-search/config.ts +++ b/packages/app/src/components/quick-search/config.ts @@ -1,6 +1,13 @@ import { AllPagesIcon, FavouritesIcon, TrashIcon } from '@blocksuite/icons'; import { useTranslation } from 'react-i18next'; -export const useSwitchToConfig = (currentWorkspaceId: string) => { + +export const useSwitchToConfig = ( + currentWorkspaceId: string +): { + title: string; + href: string; + icon: React.FC>; +}[] => { const { t } = useTranslation(); const List = [ { diff --git a/packages/app/src/components/shortcuts-modal/config.ts b/packages/app/src/components/shortcuts-modal/config.ts index b5cf587536..7749209fe9 100644 --- a/packages/app/src/components/shortcuts-modal/config.ts +++ b/packages/app/src/components/shortcuts-modal/config.ts @@ -1,5 +1,8 @@ import { useTranslation } from 'react-i18next'; -export const useMacKeyboardShortcuts = () => { +interface ShortcutTip { + [x: string]: string; +} +export const useMacKeyboardShortcuts = (): ShortcutTip => { const { t } = useTranslation(); return { [t('Undo')]: '⌘+Z', @@ -23,7 +26,7 @@ export const useMacKeyboardShortcuts = () => { }; }; -export const useMacMarkdownShortcuts = () => { +export const useMacMarkdownShortcuts = (): ShortcutTip => { const { t } = useTranslation(); return { [t('Bold')]: '**Text** ', @@ -42,7 +45,7 @@ export const useMacMarkdownShortcuts = () => { }; }; -export const useWindowsKeyboardShortcuts = () => { +export const useWindowsKeyboardShortcuts = (): ShortcutTip => { const { t } = useTranslation(); return { [t('Undo')]: 'Ctrl+Z', @@ -65,7 +68,7 @@ export const useWindowsKeyboardShortcuts = () => { [t('Reduce indent')]: 'Shift+Tab', }; }; -export const useWinMarkdownShortcuts = () => { +export const useWinMarkdownShortcuts = (): ShortcutTip => { const { t } = useTranslation(); return { [t('Bold')]: '**Text** ', diff --git a/packages/app/src/libs/i18n/resources/en.json b/packages/app/src/libs/i18n/resources/en.json index 45822ea009..9ce5282e71 100644 --- a/packages/app/src/libs/i18n/resources/en.json +++ b/packages/app/src/libs/i18n/resources/en.json @@ -11,8 +11,8 @@ "Find results": "Find {{number}} results", "Collapse sidebar": "Collapse sidebar", "Expand sidebar": "Expand sidebar", - "Removed to Favourites": "Removed to Favourites", - "Remove to favourites": "Remove to favourites", + "Removed from Favourites": "Removed from Favourites", + "Remove from favourites": "Remove from favourites", "Added to Favourites": "Added to Favourites", "Add to favourites": "Add to favourites", "Paper": "Paper",