Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

refactor(component): adjust confirm modal api (#7589)

EYHN98281a63940e
diff --git a/packages/frontend/component/src/components/disable-public-link/index.tsx b/packages/frontend/component/src/components/disable-public-link/index.tsx
index b0b25b1f59..a22f109396 100644
--- a/packages/frontend/component/src/components/disable-public-link/index.tsx
+++ b/packages/frontend/component/src/components/disable-public-link/index.tsx
@@ -11,10 +11,10 @@ export const PublicLinkDisableModal = (props: ConfirmModalProps) => {
title={t['com.affine.publicLinkDisableModal.title']()}
description={t['com.affine.publicLinkDisableModal.description']()}
cancelText={t['com.affine.publicLinkDisableModal.button.cancel']()}
+ confirmText={t['com.affine.publicLinkDisableModal.button.disable']()}
confirmButtonOptions={{
type: 'error',
['data-testid' as string]: 'confirm-enable-affine-cloud-button',
- children: t['com.affine.publicLinkDisableModal.button.disable'](),
}}
{...props}
/>
diff --git a/packages/frontend/component/src/components/member-components/invite-modal.tsx b/packages/frontend/component/src/components/member-components/invite-modal.tsx
index 9d3a460093..2d4d950611 100644
--- a/packages/frontend/component/src/components/member-components/invite-modal.tsx
+++ b/packages/frontend/component/src/components/member-components/invite-modal.tsx
@@ -57,11 +57,11 @@ export const InviteModal = ({
padding: '20px 26px',
},
}}
+ confirmText={t['Invite']()}
confirmButtonOptions={{
loading: isMutating,
type: 'primary',
['data-testid' as string]: 'confirm-enable-affine-cloud-button',
- children: t['Invite'](),
}}
onConfirm={handleConfirm}
>
diff --git a/packages/frontend/component/src/components/member-components/member-limit-modal.tsx b/packages/frontend/component/src/components/member-components/member-limit-modal.tsx
index b902352920..f38a9e05e3 100644
--- a/packages/frontend/component/src/components/member-components/member-limit-modal.tsx
+++ b/packages/frontend/component/src/components/member-components/member-limit-modal.tsx
@@ -38,14 +38,13 @@ export const MemberLimitModal = ({
: 'com.affine.payment.member-limit.pro.description'
]({ planName: plan, quota: quota })}
cancelButtonOptions={{ style: { display: isFreePlan ? '' : 'none' } }}
+ confirmText={t[
+ isFreePlan
+ ? 'com.affine.payment.member-limit.free.confirm'
+ : 'com.affine.payment.member-limit.pro.confirm'
+ ]()}
confirmButtonOptions={{
type: 'primary',
- children:
- t[
- isFreePlan
- ? 'com.affine.payment.member-limit.free.confirm'
- : 'com.affine.payment.member-limit.pro.confirm'
- ](),
}}
onConfirm={handleConfirm}
></ConfirmModal>
diff --git a/packages/frontend/component/src/ui/modal/confirm-modal.stories.tsx b/packages/frontend/component/src/ui/modal/confirm-modal.stories.tsx
index 80ce8b2333..efbcf3fe25 100644
--- a/packages/frontend/component/src/ui/modal/confirm-modal.stories.tsx
+++ b/packages/frontend/component/src/ui/modal/confirm-modal.stories.tsx
@@ -22,9 +22,7 @@ export const UsingHook = () => {
const showConfirm = () => {
openConfirmModal({
cancelText: 'Cancel',
- confirmButtonOptions: {
- children: 'Confirm',
- },
+ confirmText: 'Confirm',
title: 'Confirm Modal',
children: 'Are you sure you want to confirm?',
onConfirm,
@@ -43,9 +41,7 @@ export const AutoClose = () => {
const onConfirm = () => {
openConfirmModal({
cancelText: 'Cancel',
- confirmButtonOptions: {
- children: 'Confirm',
- },
+ confirmText: 'Confirm',
title: 'Confirm Modal',
children: 'Are you sure you want to confirm?',
onConfirm: () => console.log('Confirmed'),
diff --git a/packages/frontend/component/src/ui/modal/confirm-modal.tsx b/packages/frontend/component/src/ui/modal/confirm-modal.tsx
index 3ffe0b2598..20d4432dd8 100644
--- a/packages/frontend/component/src/ui/modal/confirm-modal.tsx
+++ b/packages/frontend/component/src/ui/modal/confirm-modal.tsx
@@ -10,11 +10,12 @@ import { Modal } from './modal';
import * as styles from './styles.css';
export interface ConfirmModalProps extends ModalProps {
- confirmButtonOptions?: ButtonProps;
+ confirmButtonOptions?: Omit<ButtonProps, 'children'>;
onConfirm?: (() => void) | (() => Promise<void>);
onCancel?: () => void;
- cancelText?: string;
- cancelButtonOptions?: ButtonProps;
+ confirmText?: React.ReactNode;
+ cancelText?: React.ReactNode;
+ cancelButtonOptions?: Omit<ButtonProps, 'children'>;
reverseFooter?: boolean;
}
@@ -22,6 +23,7 @@ export const ConfirmModal = ({
children,
confirmButtonOptions,
// FIXME: we need i18n
+ confirmText,
cancelText = 'Cancel',
cancelButtonOptions,
reverseFooter,
@@ -64,7 +66,9 @@ export const ConfirmModal = ({
{cancelText}
</Button>
</DialogTrigger>
- <Button onClick={onConfirmClick} {...confirmButtonOptions}></Button>
+ <Button onClick={onConfirmClick} {...confirmButtonOptions}>
+ {confirmText}
+ </Button>
</div>
</Modal>
);
diff --git a/packages/frontend/component/src/ui/modal/modal.stories.tsx b/packages/frontend/component/src/ui/modal/modal.stories.tsx
index 994abb90c5..86738ca24d 100644
--- a/packages/frontend/component/src/ui/modal/modal.stories.tsx
+++ b/packages/frontend/component/src/ui/modal/modal.stories.tsx
@@ -58,10 +58,10 @@ const ConfirmModalTemplate: StoryFn<ConfirmModalProps> = () => {
onConfirm={handleConfirm}
title="Modal Title"
description="Modal description"
+ confirmText="Confirm"
confirmButtonOptions={{
loading: loading,
type: 'primary',
- children: 'Confirm',
}}
>
<Input placeholder="input someting" status={inputStatus} />
diff --git a/packages/frontend/core/src/components/admin-panel/admin-panel-header.tsx b/packages/frontend/core/src/components/admin-panel/admin-panel-header.tsx
index dcd1c6f66f..0c03b29de6 100644
--- a/packages/frontend/core/src/components/admin-panel/admin-panel-header.tsx
+++ b/packages/frontend/core/src/components/admin-panel/admin-panel-header.tsx
@@ -39,8 +39,8 @@ export const AdminPanelHeader = ({
title: 'Save Runtime Configurations ?',
description:
'Are you sure you want to save the following changes?',
+ confirmText: 'Save',
confirmButtonOptions: {
- children: 'Save',
type: 'primary',
},
onConfirm: onConfirm,
diff --git a/packages/frontend/core/src/components/affine/auth/ai-login-required.tsx b/packages/frontend/core/src/components/affine/auth/ai-login-required.tsx
index 532587f4db..a707d4cbbc 100644
--- a/packages/frontend/core/src/components/affine/auth/ai-login-required.tsx
+++ b/packages/frontend/core/src/components/affine/auth/ai-login-required.tsx
@@ -25,8 +25,8 @@ export const AiLoginRequiredModal = () => {
setOpen(false);
openSignIn();
},
+ confirmText: t['com.affine.ai.login-required.dialog-confirm'](),
confirmButtonOptions: {
- children: t['com.affine.ai.login-required.dialog-confirm'](),
type: 'primary',
},
cancelText: t['com.affine.ai.login-required.dialog-cancel'](),
diff --git a/packages/frontend/core/src/components/affine/create-workspace-modal/index.tsx b/packages/frontend/core/src/components/affine/create-workspace-modal/index.tsx
index c5af1bf2df..d5572b1ae1 100644
--- a/packages/frontend/core/src/components/affine/create-workspace-modal/index.tsx
+++ b/packages/frontend/core/src/components/affine/create-workspace-modal/index.tsx
@@ -104,11 +104,11 @@ const NameWorkspaceContent = ({
title={t['com.affine.nameWorkspace.title']()}
description={t['com.affine.nameWorkspace.description']()}
cancelText={t['com.affine.nameWorkspace.button.cancel']()}
+ confirmText={t['com.affine.nameWorkspace.button.create']()}
confirmButtonOptions={{
type: 'primary',
disabled: !workspaceName || loading,
['data-testid' as string]: 'create-workspace-create-button',
- children: t['com.affine.nameWorkspace.button.create'](),
}}
closeButtonOptions={{
['data-testid' as string]: 'create-workspace-close-button',
diff --git a/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx b/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx
index a4929c1e3f..49cf528ec4 100644
--- a/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx
+++ b/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx
@@ -478,10 +478,10 @@ const PageHistoryManager = ({
['data-testid' as string]: 'confirm-restore-history-modal',
style: { padding: '20px 26px' },
},
+ confirmText: t['com.affine.history.confirm-restore-modal.restore'](),
confirmButtonOptions: {
type: 'primary',
['data-testid' as string]: 'confirm-restore-history-button',
- children: t['com.affine.history.confirm-restore-modal.restore'](),
},
onConfirm: handleRestore,
});
diff --git a/packages/frontend/core/src/components/affine/page-properties/confirm-delete-property-modal.tsx b/packages/frontend/core/src/components/affine/page-properties/confirm-delete-property-modal.tsx
index 1508bb3782..8806feb314 100644
--- a/packages/frontend/core/src/components/affine/page-properties/confirm-delete-property-modal.tsx
+++ b/packages/frontend/core/src/components/affine/page-properties/confirm-delete-property-modal.tsx
@@ -44,13 +44,13 @@ export const ConfirmDeletePropertyModal = ({
removed from count doc(s). This action cannot be undone.
</Trans>
}
+ confirmText={t['Confirm']()}
onConfirm={onConfirm}
cancelButtonOptions={{
onClick: onCancel,
}}
confirmButtonOptions={{
type: 'error',
- children: t['Confirm'](),
}}
/>
);
diff --git a/packages/frontend/core/src/components/affine/quota-reached-modal/cloud-quota-modal.tsx b/packages/frontend/core/src/components/affine/quota-reached-modal/cloud-quota-modal.tsx
index cd8f4211c9..7f7a6e74ff 100644
--- a/packages/frontend/core/src/components/affine/quota-reached-modal/cloud-quota-modal.tsx
+++ b/packages/frontend/core/src/components/affine/quota-reached-modal/cloud-quota-modal.tsx
@@ -108,11 +108,11 @@ export const CloudQuotaModal = () => {
hidden: !isFreePlanOwner,
}}
onConfirm={handleUpgradeConfirm}
+ confirmText={
+ isFreePlanOwner ? t['com.affine.payment.upgrade']() : t['Got it']()
+ }
confirmButtonOptions={{
type: 'primary',
- children: isFreePlanOwner
- ? t['com.affine.payment.upgrade']()
- : t['Got it'](),
}}
/>
);
diff --git a/packages/frontend/core/src/components/affine/quota-reached-modal/local-quota-modal.tsx b/packages/frontend/core/src/components/affine/quota-reached-modal/local-quota-modal.tsx
index cee4b9460e..1348eacaea 100644
--- a/packages/frontend/core/src/components/affine/quota-reached-modal/local-quota-modal.tsx
+++ b/packages/frontend/core/src/components/affine/quota-reached-modal/local-quota-modal.tsx
@@ -35,9 +35,9 @@ export const LocalQuotaModal = () => {
hidden: true,
}}
onConfirm={onConfirm}
+ confirmText={t['Got it']()}
confirmButtonOptions={{
type: 'primary',
- children: t['Got it'](),
}}
/>
);
diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/actions/cancel.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/actions/cancel.tsx
index 87bc77f946..bb3ee1b80e 100644
--- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/actions/cancel.tsx
+++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/actions/cancel.tsx
@@ -33,9 +33,9 @@ export const AICancel = ({ ...btnProps }: AICancelProps) => {
description:
t['com.affine.payment.ai.action.cancel.confirm.description'](),
reverseFooter: true,
+ confirmText:
+ t['com.affine.payment.ai.action.cancel.confirm.confirm-text'](),
confirmButtonOptions: {
- children:
- t['com.affine.payment.ai.action.cancel.confirm.confirm-text'](),
type: 'default',
},
cancelText:
diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/actions/resume.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/actions/resume.tsx
index bb15a1c3ba..ce5ecbd8bc 100644
--- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/actions/resume.tsx
+++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/actions/resume.tsx
@@ -38,9 +38,9 @@ export const AIResume = ({ ...btnProps }: AIResumeProps) => {
title: t['com.affine.payment.ai.action.resume.confirm.title'](),
description:
t['com.affine.payment.ai.action.resume.confirm.description'](),
+ confirmText:
+ t['com.affine.payment.ai.action.resume.confirm.confirm-text'](),
confirmButtonOptions: {
- children:
- t['com.affine.payment.ai.action.resume.confirm.confirm-text'](),
type: 'primary',
},
cancelText:
diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/modals.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/modals.tsx
index fcaec053ea..1c3e72b50c 100644
--- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/modals.tsx
+++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/modals.tsx
@@ -46,9 +46,9 @@ export const ConfirmLoadingModal = ({
<ConfirmModal
title={title}
cancelText={cancelText}
+ confirmText={confirmText}
confirmButtonOptions={{
type: 'primary',
- children: confirmText,
loading,
}}
open={open}
diff --git a/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/delete-leave-workspace/delete/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/delete-leave-workspace/delete/index.tsx
index 0766ef8e09..6bd7bc96d9 100644
--- a/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/delete-leave-workspace/delete/index.tsx
+++ b/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/delete-leave-workspace/delete/index.tsx
@@ -36,11 +36,11 @@ export const WorkspaceDeleteModal = ({
<ConfirmModal
title={`${t['com.affine.workspaceDelete.title']()}?`}
cancelText={t['com.affine.workspaceDelete.button.cancel']()}
+ confirmText={t['com.affine.workspaceDelete.button.delete']()}
confirmButtonOptions={{
type: 'error',
disabled: !allowDelete,
['data-testid' as string]: 'delete-workspace-confirm-button',
- children: t['com.affine.workspaceDelete.button.delete'](),
}}
{...props}
>
diff --git a/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/delete-leave-workspace/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/delete-leave-workspace/index.tsx
index 4ca9785218..90915ff9ea 100644
--- a/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/delete-leave-workspace/index.tsx
+++ b/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/delete-leave-workspace/index.tsx
@@ -134,9 +134,9 @@ export const DeleteLeaveWorkspace = () => {
onOpenChange={setShowLeave}
title={`${t['com.affine.deleteLeaveWorkspace.leave']()}?`}
description={t['com.affine.deleteLeaveWorkspace.leaveDescription']()}
+ confirmText={t['Leave']()}
confirmButtonOptions={{
type: 'warning',
- children: t['Leave'](),
}}
/>
)}
diff --git a/packages/frontend/core/src/components/affine/sign-out-modal/index.tsx b/packages/frontend/core/src/components/affine/sign-out-modal/index.tsx
index f2359202c5..5e927d9151 100644
--- a/packages/frontend/core/src/components/affine/sign-out-modal/index.tsx
+++ b/packages/frontend/core/src/components/affine/sign-out-modal/index.tsx
@@ -10,7 +10,7 @@ type SignOutConfirmModalI18NKeys =
| 'confirm';
export const SignOutModal = ({ ...props }: ConfirmModalProps) => {
- const { title, description, cancelText, confirmButtonOptions = {} } = props;
+ const { title, description, cancelText, confirmText } = props;
const t = useI18n();
const defaultTexts = useMemo(() => {
@@ -30,10 +30,10 @@ export const SignOutModal = ({ ...props }: ConfirmModalProps) => {
title={title ?? defaultTexts.title}
description={description ?? defaultTexts.description}
cancelText={cancelText ?? defaultTexts.cancelText}
+ confirmText={confirmText ?? defaultTexts.children}
confirmButtonOptions={{
type: 'error',
['data-testid' as string]: 'confirm-sign-out-button',
- children: confirmButtonOptions.children ?? defaultTexts.children,
}}
contentOptions={{
['data-testid' as string]: 'confirm-sign-out-modal',
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx
index 7473ffc1d8..d090dd97b1 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx
@@ -130,8 +130,8 @@ export function patchNotificationService(
openConfirmModal({
title: toReactNode(title),
description: toReactNode(message),
+ confirmText,
confirmButtonOptions: {
- children: confirmText,
type: 'primary',
},
cancelText,
@@ -173,13 +173,11 @@ export function patchNotificationService(
openConfirmModal({
title: toReactNode(title),
description: description,
+ confirmText: confirmText ?? 'Confirm',
confirmButtonOptions: {
- children: confirmText ?? 'Confirm',
type: 'primary',
},
- cancelButtonOptions: {
- children: cancelText ?? 'Cancel',
- },
+ cancelText: cancelText ?? 'Cancel',
onConfirm: () => {
resolve(value);
},
diff --git a/packages/frontend/core/src/components/page-list/docs/page-list-header.tsx b/packages/frontend/core/src/components/page-list/docs/page-list-header.tsx
index e42bd3382c..5b3cb3f52d 100644
--- a/packages/frontend/core/src/components/page-list/docs/page-list-header.tsx
+++ b/packages/frontend/core/src/components/page-list/docs/page-list-header.tsx
@@ -123,9 +123,9 @@ export const CollectionPageListHeader = ({
title: t['com.affine.collection.add-doc.confirm.title'](),
description: t['com.affine.collection.add-doc.confirm.description'](),
cancelText: t['Cancel'](),
+ confirmText: t['Confirm'](),
confirmButtonOptions: {
type: 'primary',
- children: t['Confirm'](),
},
onConfirm: () => createAndAddDocument(createDocumentFn),
});
diff --git a/packages/frontend/core/src/components/page-list/operation-cell.tsx b/packages/frontend/core/src/components/page-list/operation-cell.tsx
index 5343aebdfb..fd4e6797f9 100644
--- a/packages/frontend/core/src/components/page-list/operation-cell.tsx
+++ b/packages/frontend/core/src/components/page-list/operation-cell.tsx
@@ -269,9 +269,9 @@ export const TrashOperationCell = ({
title: `${t['com.affine.trashOperation.deletePermanently']()}?`,
description: t['com.affine.trashOperation.deleteDescription'](),
cancelText: t['Cancel'](),
+ confirmText: t['com.affine.trashOperation.delete'](),
confirmButtonOptions: {
type: 'error',
- children: t['com.affine.trashOperation.delete'](),
},
onConfirm: onPermanentlyDeletePage,
});
@@ -384,9 +384,9 @@ export const CollectionOperationCell = ({
title: t['com.affine.collection.add-doc.confirm.title'](),
description: t['com.affine.collection.add-doc.confirm.description'](),
cancelText: t['Cancel'](),
+ confirmText: t['Confirm'](),
confirmButtonOptions: {
type: 'primary',
- children: t['Confirm'](),
},
onConfirm: createAndAddDocument,
});
diff --git a/packages/frontend/core/src/components/page-list/operation-menu-items/move-to-trash.tsx b/packages/frontend/core/src/components/page-list/operation-menu-items/move-to-trash.tsx
index a449ba6afa..3280f9bd85 100644
--- a/packages/frontend/core/src/components/page-list/operation-menu-items/move-to-trash.tsx
+++ b/packages/frontend/core/src/components/page-list/operation-menu-items/move-to-trash.tsx
@@ -46,10 +46,10 @@ const MoveToTrashConfirm = ({
title={title}
description={description}
cancelText={t['com.affine.confirmModal.button.cancel']()}
+ confirmText={t.Delete()}
confirmButtonOptions={{
['data-testid' as string]: 'confirm-delete-page',
type: 'error',
- children: t.Delete(),
}}
{...confirmModalProps}
/>
diff --git a/packages/frontend/core/src/components/page-list/virtualized-trash-list.tsx b/packages/frontend/core/src/components/page-list/virtualized-trash-list.tsx
index f711f1ef25..667eb0eba9 100644
--- a/packages/frontend/core/src/components/page-list/virtualized-trash-list.tsx
+++ b/packages/frontend/core/src/components/page-list/virtualized-trash-list.tsx
@@ -73,9 +73,9 @@ export const VirtualizedTrashList = () => {
title: `${t['com.affine.trashOperation.deletePermanently']()}?`,
description: t['com.affine.trashOperation.deleteDescription'](),
cancelText: t['Cancel'](),
+ confirmText: t['com.affine.trashOperation.delete'](),
confirmButtonOptions: {
type: 'error',
- children: t['com.affine.trashOperation.delete'](),
},
onConfirm: handleMultiDelete,
});
diff --git a/packages/frontend/core/src/components/pure/trash-page-footer/index.tsx b/packages/frontend/core/src/components/pure/trash-page-footer/index.tsx
index e2c9235b53..55707166ee 100644
--- a/packages/frontend/core/src/components/pure/trash-page-footer/index.tsx
+++ b/packages/frontend/core/src/components/pure/trash-page-footer/index.tsx
@@ -79,9 +79,9 @@ export const TrashPageFooter = () => {
title={t['com.affine.trashOperation.delete.title']()}
cancelText={t['com.affine.confirmModal.button.cancel']()}
description={t['com.affine.trashOperation.delete.description']()}
+ confirmText={t['com.affine.trashOperation.delete']()}
confirmButtonOptions={{
type: 'error',
- children: t['com.affine.trashOperation.delete'](),
}}
open={open}
onConfirm={onConfirmDelete}
diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/collections-list.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/collections-list.tsx
index cc4be9cf56..785a7c82ad 100644
--- a/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/collections-list.tsx
+++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/collections-list.tsx
@@ -129,9 +129,9 @@ export const CollectionSidebarNavItem = ({
title: t['com.affine.collection.add-doc.confirm.title'](),
description: t['com.affine.collection.add-doc.confirm.description'](),
cancelText: t['Cancel'](),
+ confirmText: t['Confirm'](),
confirmButtonOptions: {
type: 'primary',
- children: t['Confirm'](),
},
onConfirm: createAndAddDocument,
});
diff --git a/packages/frontend/core/src/hooks/affine/use-enable-cloud.tsx b/packages/frontend/core/src/hooks/affine/use-enable-cloud.tsx
index 3c0f2825a3..e01f160383 100644
--- a/packages/frontend/core/src/hooks/affine/use-enable-cloud.tsx
+++ b/packages/frontend/core/src/hooks/affine/use-enable-cloud.tsx
@@ -84,13 +84,13 @@ export const useEnableCloud = () => {
title: t['Enable AFFiNE Cloud'](),
description: t['Enable AFFiNE Cloud Description'](),
cancelText: t['com.affine.enableAffineCloudModal.button.cancel'](),
+ confirmText:
+ loginStatus === 'authenticated'
+ ? t['Enable']()
+ : t['Sign in and Enable'](),
confirmButtonOptions: {
type: 'primary',
['data-testid' as string]: 'confirm-enable-affine-cloud-button',
- children:
- loginStatus === 'authenticated'
- ? t['Enable']()
- : t['Sign in and Enable'](),
},
onConfirm: async () =>
await signInOrEnableCloud(ws, {
diff --git a/packages/frontend/core/src/modules/tag/view/delete-tag-modal.tsx b/packages/frontend/core/src/modules/tag/view/delete-tag-modal.tsx
index d855f1c0d7..2fed54a989 100644
--- a/packages/frontend/core/src/modules/tag/view/delete-tag-modal.tsx
+++ b/packages/frontend/core/src/modules/tag/view/delete-tag-modal.tsx
@@ -54,9 +54,9 @@ export const DeleteTagConfirmModal = ({
})
)
}
+ confirmText={t['Delete']()}
confirmButtonOptions={{
type: 'warning',
- children: t['Delete'](),
}}
onConfirm={handleDelete}
/>