From b7edaab3872f689919ce5ae5a03b88662947e6e4 Mon Sep 17 00:00:00 2001 From: EYHN Date: Wed, 8 Nov 2023 13:51:08 +0800 Subject: [PATCH] chore: fix code style issues (#4857) --- .../common/infra/src/__internal__/react.ts | 0 packages/common/infra/vite.config.ts | 1 - .../notification-center/index.jotai.ts | 2 +- .../components/notification-center/index.tsx | 10 +- .../page-list/operation-menu-items/export.tsx | 2 +- .../__tests__/provider-composer.spec.tsx | 2 +- .../src/components/share-menu/share-page.tsx | 43 ++-- .../src/components/workspace-list/index.tsx | 2 +- .../component/src/ui/popper/popper.tsx | 196 +++++++++--------- .../src/ui/tree-view/tree-node-inner.tsx | 22 +- .../frontend/core/src/adapters/cloud/ui.tsx | 14 +- .../core/src/adapters/local/index.tsx | 14 +- .../core/src/adapters/public-cloud/ui.tsx | 14 +- .../components/affine/auth/use-captcha.tsx | 2 +- .../affine/auth/user-plan-button.tsx | 4 +- .../new-workspace-setting-detail/export.tsx | 20 +- .../setting-modal/account-setting/index.tsx | 80 ++++--- .../general-setting/plans/index.tsx | 8 +- .../general-setting/plans/plan-card.tsx | 20 +- .../operation-menu.tsx | 22 +- .../core/src/components/cloud/provider.tsx | 6 +- .../src/components/page-detail-editor.tsx | 8 +- .../core/src/components/pure/footer/index.tsx | 90 ++++---- .../src/components/root-app-sidebar/index.tsx | 196 +++++++++--------- .../core/src/layouts/workspace-layout.tsx | 6 +- .../core/src/pages/workspace/all-page.tsx | 46 ++-- .../core/src/pages/workspace/trash-page.tsx | 46 ++-- .../frontend/workspace/src/affine/worker.ts | 0 .../src/stories/app-sidebar.stories.tsx | 10 +- .../quick-search-modal.stories.tsx | 8 +- 30 files changed, 423 insertions(+), 471 deletions(-) delete mode 100644 packages/common/infra/src/__internal__/react.ts delete mode 100644 packages/frontend/workspace/src/affine/worker.ts diff --git a/packages/common/infra/src/__internal__/react.ts b/packages/common/infra/src/__internal__/react.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/common/infra/vite.config.ts b/packages/common/infra/vite.config.ts index a59c8ed098..ca5dc954e7 100644 --- a/packages/common/infra/vite.config.ts +++ b/packages/common/infra/vite.config.ts @@ -22,7 +22,6 @@ export default defineConfig({ root, 'src/__internal__/workspace.ts' ), - '__internal__/react': resolve(root, 'src/__internal__/react.ts'), '__internal__/plugin': resolve(root, 'src/__internal__/plugin.ts'), }, formats: ['es', 'cjs'], diff --git a/packages/frontend/component/src/components/notification-center/index.jotai.ts b/packages/frontend/component/src/components/notification-center/index.jotai.ts index 89dfb934ca..c793112cdc 100644 --- a/packages/frontend/component/src/components/notification-center/index.jotai.ts +++ b/packages/frontend/component/src/components/notification-center/index.jotai.ts @@ -9,7 +9,7 @@ export type Notification = { theme?: 'light' | 'dark' | 'default'; timeout?: number; progressingBar?: boolean; - multimedia?: React.ReactNode | JSX.Element | HTMLElement; + multimedia?: React.ReactNode | JSX.Element; // actions undo?: () => Promise; }; diff --git a/packages/frontend/component/src/components/notification-center/index.tsx b/packages/frontend/component/src/components/notification-center/index.tsx index b83903c02c..5574b82a80 100644 --- a/packages/frontend/component/src/components/notification-center/index.tsx +++ b/packages/frontend/component/src/components/notification-center/index.tsx @@ -7,7 +7,7 @@ import * as Toast from '@radix-ui/react-toast'; import { IconButton } from '@toeverything/components/button'; import clsx from 'clsx'; import { useAtom, useAtomValue, useSetAtom } from 'jotai'; -import type { ReactElement } from 'react'; +import type { ReactNode } from 'react'; import { useCallback, useEffect, @@ -70,7 +70,7 @@ const typeColorMap = { }, }; -function NotificationCard(props: NotificationCardProps): ReactElement { +function NotificationCard(props: NotificationCardProps): ReactNode { const removeNotification = useSetAtom(removeNotificationAtom); const { notification, notifications, setHeights, heights, index } = props; @@ -270,7 +270,7 @@ function NotificationCard(props: NotificationCardProps): ReactElement { > {notification.multimedia ? (
- <>{notification.multimedia} + {notification.multimedia} @@ -373,7 +373,7 @@ function NotificationCard(props: NotificationCardProps): ReactElement { ); } -export function NotificationCenter(): ReactElement { +export function NotificationCenter(): ReactNode { const notifications = useAtomValue(notificationsAtom); const [expand, setExpand] = useAtom(expandNotificationCenterAtom); @@ -390,7 +390,7 @@ export function NotificationCenter(): ReactElement { } }, [notifications, setExpand]); - if (!notifications.length) return <>; + if (!notifications.length) return null; return ( {notifications.map((notification, index) => diff --git a/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx b/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx index 998ee77382..a924f71e58 100644 --- a/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx +++ b/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx @@ -97,7 +97,7 @@ export const ExportMenuItems = ({ const items = itemMap.map(({ component: Component, props }) => ( )); - return <>{items}; + return items; }; export const Export = ({ exportHandler, className }: ExportProps) => { diff --git a/packages/frontend/component/src/components/provider-composer/__tests__/provider-composer.spec.tsx b/packages/frontend/component/src/components/provider-composer/__tests__/provider-composer.spec.tsx index 9e91843d26..d20a27400e 100644 --- a/packages/frontend/component/src/components/provider-composer/__tests__/provider-composer.spec.tsx +++ b/packages/frontend/component/src/components/provider-composer/__tests__/provider-composer.spec.tsx @@ -15,7 +15,7 @@ test('ProviderComposer', async () => { }; const ConsumerComponent = () => { const value = useContext(Context); - return <>{value}; + return value; }; const Component = () => { return ( diff --git a/packages/frontend/component/src/components/share-menu/share-page.tsx b/packages/frontend/component/src/components/share-menu/share-page.tsx index 5b17c1a030..f16f6938f7 100644 --- a/packages/frontend/component/src/components/share-menu/share-page.tsx +++ b/packages/frontend/component/src/components/share-menu/share-page.tsx @@ -38,30 +38,25 @@ export const LocalSharePage = (props: ShareMenuProps) => { const t = useAFFiNEI18N(); return ( - <> -
-
-
- {t['com.affine.share-menu.EnableCloudDescription']()} -
-
- -
+
+
+
+ {t['com.affine.share-menu.EnableCloudDescription']()}
-
- +
+
- +
+ +
+
); }; @@ -218,11 +213,7 @@ export const SharePage = (props: ShareMenuProps) => { if (props.workspace.flavour === WorkspaceFlavour.LOCAL) { return ; } else if (props.workspace.flavour === WorkspaceFlavour.AFFINE_CLOUD) { - return ( - <> - - - ); + return ; } throw new Error('Unreachable'); }; diff --git a/packages/frontend/component/src/components/workspace-list/index.tsx b/packages/frontend/component/src/components/workspace-list/index.tsx index 3ec35c8674..5557616370 100644 --- a/packages/frontend/component/src/components/workspace-list/index.tsx +++ b/packages/frontend/component/src/components/workspace-list/index.tsx @@ -121,7 +121,7 @@ export const WorkspaceList = (props: WorkspaceListProps) => { {optimisticList.map(item => ( } key={item.id}> - + ))} diff --git a/packages/frontend/component/src/ui/popper/popper.tsx b/packages/frontend/component/src/ui/popper/popper.tsx index 2d69365ff0..f54f1aae71 100644 --- a/packages/frontend/component/src/ui/popper/popper.tsx +++ b/packages/frontend/component/src/ui/popper/popper.tsx @@ -171,109 +171,107 @@ export const Popper = ({ }} > {showArrow ? ( - <> - {placement.indexOf('bottom') === 0 ? ( -
+ - - - - {content} -
- ) : placement.indexOf('top') === 0 ? ( -
- {content} - - - -
- ) : placement.indexOf('left') === 0 ? ( - <> - {content} - - - - - ) : placement.indexOf('right') === 0 ? ( - <> - - - - {content} - - ) : ( -
+ + {content} +
+ ) : placement.indexOf('top') === 0 ? ( +
+ {content} + - {content} - - - -
- )} - + + +
+ ) : placement.indexOf('left') === 0 ? ( + <> + {content} + + + + + ) : placement.indexOf('right') === 0 ? ( + <> + + + + {content} + + ) : ( +
+ {content} + + + +
+ ) ) : ( - <>{content} + content )}
diff --git a/packages/frontend/component/src/ui/tree-view/tree-node-inner.tsx b/packages/frontend/component/src/ui/tree-view/tree-node-inner.tsx index e3797956ec..ef24330083 100644 --- a/packages/frontend/component/src/ui/tree-view/tree-node-inner.tsx +++ b/packages/frontend/component/src/ui/tree-view/tree-node-inner.tsx @@ -76,17 +76,13 @@ export const TreeNodeItem = ({ disableCollapse, allowDrop = true, }: TreeNodeItemProps) => { - return ( - <> - {node.render?.(node, { - isOver: isOver && allowDrop, - onAdd: () => onAdd?.(node.id), - onDelete: () => onDelete?.(node.id), - collapsed, - setCollapsed, - isSelected: selectedId === node.id, - disableCollapse, - })} - - ); + return node.render?.(node, { + isOver: isOver && allowDrop, + onAdd: () => onAdd?.(node.id), + onDelete: () => onDelete?.(node.id), + collapsed, + setCollapsed, + isSelected: selectedId === node.id, + disableCollapse, + }); }; diff --git a/packages/frontend/core/src/adapters/cloud/ui.tsx b/packages/frontend/core/src/adapters/cloud/ui.tsx index 7c4f60dd59..f129c020eb 100644 --- a/packages/frontend/core/src/adapters/cloud/ui.tsx +++ b/packages/frontend/core/src/adapters/cloud/ui.tsx @@ -48,14 +48,12 @@ export const UI = { ); return ( - <> - initEmptyPage(page), [])} - onLoad={onLoad} - workspace={workspace.blockSuiteWorkspace} - /> - + initEmptyPage(page), [])} + onLoad={onLoad} + workspace={workspace.blockSuiteWorkspace} + /> ); }, NewSettingsDetail: ({ diff --git a/packages/frontend/core/src/adapters/local/index.tsx b/packages/frontend/core/src/adapters/local/index.tsx index ab334e57ed..ca87fb7ff8 100644 --- a/packages/frontend/core/src/adapters/local/index.tsx +++ b/packages/frontend/core/src/adapters/local/index.tsx @@ -92,14 +92,12 @@ export const LocalAdapter: WorkspaceAdapter = { throw new PageNotFoundError(workspace, currentPageId); } return ( - <> - initEmptyPage(page), [])} - onLoad={onLoadEditor} - workspace={workspace} - /> - + initEmptyPage(page), [])} + onLoad={onLoadEditor} + workspace={workspace} + /> ); }, NewSettingsDetail: ({ diff --git a/packages/frontend/core/src/adapters/public-cloud/ui.tsx b/packages/frontend/core/src/adapters/public-cloud/ui.tsx index f8d6b9b459..4d32298cec 100644 --- a/packages/frontend/core/src/adapters/public-cloud/ui.tsx +++ b/packages/frontend/core/src/adapters/public-cloud/ui.tsx @@ -16,14 +16,12 @@ export const UI = { throw new PageNotFoundError(workspace.blockSuiteWorkspace, currentPageId); } return ( - <> - initEmptyPage(page), [])} - onLoad={onLoadEditor} - workspace={workspace.blockSuiteWorkspace} - /> - + initEmptyPage(page), [])} + onLoad={onLoadEditor} + workspace={workspace.blockSuiteWorkspace} + /> ); }, NewSettingsDetail: () => { diff --git a/packages/frontend/core/src/components/affine/auth/use-captcha.tsx b/packages/frontend/core/src/components/affine/auth/use-captcha.tsx index e00ce53259..28a7649015 100644 --- a/packages/frontend/core/src/components/affine/auth/use-captcha.tsx +++ b/packages/frontend/core/src/components/affine/auth/use-captcha.tsx @@ -43,7 +43,7 @@ export const Captcha = () => { const [response] = useAtom(responseAtom); if (!runtimeConfig.enableCaptcha) { - return <>; + return null; } if (environment.isDesktop) { diff --git a/packages/frontend/core/src/components/affine/auth/user-plan-button.tsx b/packages/frontend/core/src/components/affine/auth/user-plan-button.tsx index b9b9ab1f16..aa0b417c6f 100644 --- a/packages/frontend/core/src/components/affine/auth/user-plan-button.tsx +++ b/packages/frontend/core/src/components/affine/auth/user-plan-button.tsx @@ -2,7 +2,7 @@ import { SubscriptionPlan } from '@affine/graphql'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import Tooltip from '@toeverything/components/tooltip'; import { useSetAtom } from 'jotai'; -import React, { useCallback } from 'react'; +import { useCallback } from 'react'; import { withErrorBoundary } from 'react-error-boundary'; import { openSettingModalAtom } from '../../../atoms'; @@ -39,5 +39,5 @@ const UserPlanButtonWithData = () => { // If fetch user data failed, just render empty. export const UserPlanButton = withErrorBoundary(UserPlanButtonWithData, { - fallbackRender: () => , + fallbackRender: () => null, }); diff --git a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/export.tsx b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/export.tsx index 0a659d7c44..79e92c9047 100644 --- a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/export.tsx +++ b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/export.tsx @@ -86,16 +86,14 @@ export const ExportPanel = ({ workspace }: ExportPanelProps) => { }, [pushNotification, syncing, t, workspace, workspaceId]); return ( - <> - - - - + + + ); }; diff --git a/packages/frontend/core/src/components/affine/setting-modal/account-setting/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/account-setting/index.tsx index ed4321a27e..3f887cdefb 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/account-setting/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/account-setting/index.tsx @@ -121,48 +121,46 @@ export const AvatarAndName = () => { }, [allowUpdate, input, user]); return ( - <> - - - - - + + + + + -
- - - - {allowUpdate ? ( - - ) : null} - -
-
-
- +
+ + + + {allowUpdate ? ( + + ) : null} + +
+
+
); }; diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/index.tsx index 724d4f0fbd..c7cda5e661 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/index.tsx @@ -9,7 +9,7 @@ import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useQuery } from '@affine/workspace/affine/gql'; import { useSetAtom } from 'jotai'; -import React, { Suspense, useEffect, useRef, useState } from 'react'; +import { Suspense, useEffect, useRef, useState } from 'react'; import type { FallbackProps } from 'react-error-boundary'; import { SWRErrorBoundary } from '../../../../../components/pure/swr-error-bundary'; @@ -205,9 +205,9 @@ const PlansErrorBoundary = ({ resetErrorBoundary }: FallbackProps) => { const t = useAFFiNEI18N(); const title = t['com.affine.payment.title'](); - const subtitle = ; - const tabs = ; - const footer = ; + const subtitle = ''; + const tabs = ''; + const footer = ''; const scroll = (
diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/plan-card.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/plan-card.tsx index 359aeb3da5..98dbc7ced6 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/plan-card.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/plan-card.tsx @@ -406,17 +406,15 @@ const Upgrade = ({ }, [onClose]); return ( - <> - - + ); }; diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx index 1cd2e671ad..4a5976724f 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx +++ b/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx @@ -218,17 +218,15 @@ export const PageMenu = ({ rename, pageId }: PageMenuProps) => { return null; } return ( - <> - - - - - - + + + + + ); }; diff --git a/packages/frontend/core/src/components/cloud/provider.tsx b/packages/frontend/core/src/components/cloud/provider.tsx index fe01c9ac36..6b9daf4d24 100644 --- a/packages/frontend/core/src/components/cloud/provider.tsx +++ b/packages/frontend/core/src/components/cloud/provider.tsx @@ -2,7 +2,7 @@ import { pushNotificationAtom } from '@affine/component/notification-center'; import { assertExists } from '@blocksuite/global/utils'; import { GraphQLError } from 'graphql'; import { useSetAtom } from 'jotai'; -import type { PropsWithChildren, ReactElement } from 'react'; +import type { PropsWithChildren, ReactNode } from 'react'; import { useCallback } from 'react'; import type { SWRConfiguration } from 'swr'; import { SWRConfig } from 'swr'; @@ -49,9 +49,9 @@ const cloudConfig: SWRConfiguration = { ], }; -export const Provider = (props: PropsWithChildren): ReactElement => { +export const Provider = (props: PropsWithChildren): ReactNode => { if (!runtimeConfig.enableCloud) { - return <>{props.children}; + return props.children; } return {props.children}; diff --git a/packages/frontend/core/src/components/page-detail-editor.tsx b/packages/frontend/core/src/components/page-detail-editor.tsx index 4102327d6f..8050890d11 100644 --- a/packages/frontend/core/src/components/page-detail-editor.tsx +++ b/packages/frontend/core/src/components/page-detail-editor.tsx @@ -328,10 +328,8 @@ export const PageDetailEditor = (props: PageDetailEditorProps) => { } return ( - <> - - - - + + + ); }; diff --git a/packages/frontend/core/src/components/pure/footer/index.tsx b/packages/frontend/core/src/components/pure/footer/index.tsx index 83b0a84a5c..a8a0af8d0f 100644 --- a/packages/frontend/core/src/components/pure/footer/index.tsx +++ b/packages/frontend/core/src/components/pure/footer/index.tsx @@ -49,53 +49,49 @@ export const WorkspaceAvatar = forwardRef( const size = props.size || 20; const sizeStr = size + 'px'; - return ( - <> - {props.avatar ? ( -
- - - -
- ) : ( -
- {(props.name || 'AFFiNE').substring(0, 1)} -
- )} - + return props.avatar ? ( +
+ + + +
+ ) : ( +
+ {(props.name || 'AFFiNE').substring(0, 1)} +
); } ); diff --git a/packages/frontend/core/src/components/root-app-sidebar/index.tsx b/packages/frontend/core/src/components/root-app-sidebar/index.tsx index a31c3a8899..1fd0d46d64 100644 --- a/packages/frontend/core/src/components/root-app-sidebar/index.tsx +++ b/packages/frontend/core/src/components/root-app-sidebar/index.tsx @@ -170,109 +170,105 @@ export const RootAppSidebar = ({ useRegisterBlocksuiteEditorCommands(router.back, router.forward); const userInfo = useDeleteCollectionInfo(); return ( - <> - - - - - } - contentOptions={{ - // hide trigger - sideOffset: -58, - onInteractOutside: closeUserWorkspaceList, - onEscapeKeyDown: closeUserWorkspaceList, - style: { - width: '300px', - }, - }} - > - { - setOpenUserWorkspaceList(true); - }, [setOpenUserWorkspaceList])} - /> - - + + + } + contentOptions={{ + // hide trigger + sideOffset: -58, + onInteractOutside: closeUserWorkspaceList, + onEscapeKeyDown: closeUserWorkspaceList, + style: { + width: '300px', + }, + }} + > + { + setOpenUserWorkspaceList(true); + }, [setOpenUserWorkspaceList])} /> - } - currentPath={currentPath} - path={paths.all(currentWorkspaceId)} - onClick={backToAll} + + + } + currentPath={currentPath} + path={paths.all(currentWorkspaceId)} + onClick={backToAll} + > + + {t['com.affine.workspaceSubPath.all']()} + + + {runtimeConfig.enableNewSettingModal ? ( + } + onClick={onOpenSettingModal} > - - {t['com.affine.workspaceSubPath.all']()} + + {t['com.affine.settingSidebar.title']()} - - {runtimeConfig.enableNewSettingModal ? ( - } - onClick={onOpenSettingModal} - > - - {t['com.affine.settingSidebar.title']()} - - - ) : null} - + + ) : null} + - - - - - - - - - - - {/* fixme: remove the following spacer */} -
- } - currentPath={currentPath} - path={paths.trash(currentWorkspaceId)} - > - - {t['com.affine.workspaceSubPath.trash']()} - - - {blockSuiteWorkspace && ( - - )} - - - {environment.isDesktop && } -
- - - - + + + + + + + + + + + {/* fixme: remove the following spacer */} +
+ } + currentPath={currentPath} + path={paths.trash(currentWorkspaceId)} + > + + {t['com.affine.workspaceSubPath.trash']()} + + + {blockSuiteWorkspace && ( + + )} + + + {environment.isDesktop && } +
+ + + ); }; diff --git a/packages/frontend/core/src/layouts/workspace-layout.tsx b/packages/frontend/core/src/layouts/workspace-layout.tsx index a1686f89f0..34a48057cd 100644 --- a/packages/frontend/core/src/layouts/workspace-layout.tsx +++ b/packages/frontend/core/src/layouts/workspace-layout.tsx @@ -34,7 +34,7 @@ import { loadPage } from '@toeverything/hooks/use-block-suite-workspace-page'; import { currentWorkspaceIdAtom } from '@toeverything/infra/atom'; import { useAtom, useAtomValue, useSetAtom } from 'jotai'; import { nanoid } from 'nanoid'; -import type { PropsWithChildren, ReactElement } from 'react'; +import type { PropsWithChildren, ReactNode } from 'react'; import { lazy, Suspense, useCallback, useEffect } from 'react'; import { useLocation, useParams } from 'react-router-dom'; import { Map as YMap } from 'yjs'; @@ -101,7 +101,7 @@ const showList: IslandItemNames[] = environment.isDesktop export const CurrentWorkspaceContext = ({ children, -}: PropsWithChildren): ReactElement => { +}: PropsWithChildren): ReactNode => { const workspaceId = useAtomValue(currentWorkspaceIdAtom); const metadata = useAtomValue(rootWorkspacesMetadataAtom); const exist = metadata.find(m => m.id === workspaceId); @@ -114,7 +114,7 @@ export const CurrentWorkspaceContext = ({ if (!exist) { return ; } - return <>{children}; + return children; }; type WorkspaceLayoutProps = { diff --git a/packages/frontend/core/src/pages/workspace/all-page.tsx b/packages/frontend/core/src/pages/workspace/all-page.tsx index 8daf9e6093..7679202613 100644 --- a/packages/frontend/core/src/pages/workspace/all-page.tsx +++ b/packages/frontend/core/src/pages/workspace/all-page.tsx @@ -108,30 +108,28 @@ const usePageOperationsRenderer = () => { }); }; return ( - <> - - setTrashModal({ - open: true, - pageIds: [page.id], - pageTitles: [page.title], - }) - } - onToggleFavoritePage={() => { - const status = page.favorite; - toggleFavorite(page.id); - toast( - status - ? t['com.affine.toastMessage.removedFavorites']() - : t['com.affine.toastMessage.addedFavorites']() - ); - }} - /> - + + setTrashModal({ + open: true, + pageIds: [page.id], + pageTitles: [page.title], + }) + } + onToggleFavoritePage={() => { + const status = page.favorite; + toggleFavorite(page.id); + toast( + status + ? t['com.affine.toastMessage.removedFavorites']() + : t['com.affine.toastMessage.addedFavorites']() + ); + }} + /> ); }, [currentWorkspace.id, setTrashModal, t, toggleFavorite] diff --git a/packages/frontend/core/src/pages/workspace/trash-page.tsx b/packages/frontend/core/src/pages/workspace/trash-page.tsx index 7e66cc7cd9..26345cc5aa 100644 --- a/packages/frontend/core/src/pages/workspace/trash-page.tsx +++ b/packages/frontend/core/src/pages/workspace/trash-page.tsx @@ -59,31 +59,29 @@ export const TrashPage = () => { [permanentlyDeletePage, restoreFromTrash, t] ); return ( - <> -
- + + {filteredPageMetas.length > 0 ? ( + - {filteredPageMetas.length > 0 ? ( - - ) : ( - - )} -
- + ) : ( + + )} +
); }; diff --git a/packages/frontend/workspace/src/affine/worker.ts b/packages/frontend/workspace/src/affine/worker.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/storybook/src/stories/app-sidebar.stories.tsx b/tests/storybook/src/stories/app-sidebar.stories.tsx index 88264b6195..c65e4e4218 100644 --- a/tests/storybook/src/stories/app-sidebar.stories.tsx +++ b/tests/storybook/src/stories/app-sidebar.stories.tsx @@ -53,12 +53,10 @@ const Main = () => { export const Default: StoryFn = () => { return ( - <> - - -
- - + + +
+ ); }; diff --git a/tests/storybook/src/stories/quick-search/quick-search-modal.stories.tsx b/tests/storybook/src/stories/quick-search/quick-search-modal.stories.tsx index 469760e95b..2b026b617d 100644 --- a/tests/storybook/src/stories/quick-search/quick-search-modal.stories.tsx +++ b/tests/storybook/src/stories/quick-search/quick-search-modal.stories.tsx @@ -28,10 +28,8 @@ export const CMDKModalStory: StoryFn = () => { export const CMDKPanelStory: StoryFn = () => { const [query, setQuery] = useState(''); return ( - <> - - - - + + + ); };