fix: CollectionDeletedPlaceholder

This commit is contained in:
chenos 2024-02-06 15:49:00 +08:00
parent 41de6c0851
commit 40851a6a05

View File

@ -1,8 +1,7 @@
import { App, Button, Result } from 'antd';
import React, { FC, useMemo } from 'react'; import React, { FC, useMemo } from 'react';
import { App } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { CardItem, useDesignable } from '../../../schema-component'; import { CardItem, useDesignable } from '../../../schema-component';
import { Button, Result } from 'antd';
export interface CollectionDeletedPlaceholderProps { export interface CollectionDeletedPlaceholderProps {
type: 'Collection' | 'Field' | 'DataSource'; type: 'Collection' | 'Field' | 'DataSource';
@ -22,7 +21,9 @@ export const CollectionDeletedPlaceholder: FC<CollectionDeletedPlaceholderProps>
return `[nocobase]: ${t(type)} ${'name is required'}`; return `[nocobase]: ${t(type)} ${'name is required'}`;
} }
return t(`${t(type)}: "${name}" ${t('not exists')}`); return (
<div>{t('The collection "{{name}}" might be deleted. If unnecessary, delete the current block.', { name })}</div>
);
}, [message, name, type, t]); }, [message, name, type, t]);
const WrapperComponent = useMemo(() => { const WrapperComponent = useMemo(() => {
@ -36,11 +37,11 @@ export const CollectionDeletedPlaceholder: FC<CollectionDeletedPlaceholderProps>
return ( return (
<WrapperComponent> <WrapperComponent>
<Result <Result
status="warning" status="404"
title={messageValue} subTitle={messageValue}
extra={ extra={
<Button <Button
type="primary" // type="primary"
key="Delete" key="Delete"
onClick={() => onClick={() =>
modal.confirm({ modal.confirm({