File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed
components/confirm-delete-dialog Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ interface IProps {
1919 open : boolean ;
2020 titleKey ?: string ;
2121 descriptionKey ?: string ;
22- targetName : string ;
22+ targetName ? : string ;
2323 itemTitle : string ;
2424 deleteUrl : string ;
2525 restoreUrl ?: string ;
@@ -35,7 +35,6 @@ export default function ConfirmDeleteDialog(props: IProps) {
3535 const {
3636 open,
3737 titleKey,
38- targetName,
3938 descriptionKey,
4039 itemTitle,
4140 deleteUrl,
@@ -47,6 +46,7 @@ export default function ConfirmDeleteDialog(props: IProps) {
4746 onRestoreSuccess,
4847 onError,
4948 } = props ;
49+
5050 const { t } = useTranslation ( ) ;
5151 const [ loading , setLoading ] = useState ( false ) ;
5252
@@ -96,20 +96,24 @@ export default function ConfirmDeleteDialog(props: IProps) {
9696 } ) ;
9797 } ;
9898
99+ const targetTitle = ( itemTitle : string ) => {
100+ if ( itemTitle . length > 50 ) {
101+ return itemTitle . slice ( 0 , 10 ) + '...' + itemTitle . slice ( - 10 ) ;
102+ }
103+ return itemTitle ;
104+ } ;
105+
99106 return (
100107 < AlertDialog open = { open } onOpenChange = { onOpenChange } >
101108 < AlertDialogContent >
102109 < AlertDialogHeader >
103110 < AlertDialogTitle >
104- < Trans
105- i18nKey = { titleKey || 'common.dialog.delete.title' }
106- values = { { target_name : targetName } }
107- />
111+ < Trans i18nKey = { titleKey || 'common.dialog.delete.title' } />
108112 </ AlertDialogTitle >
109113 < AlertDialogDescription >
110114 < Trans
111115 i18nKey = { descriptionKey || 'common.dialog.delete.description' }
112- values = { { title : itemTitle } }
116+ values = { { title : targetTitle ( itemTitle ) } }
113117 components = { {
114118 strong : < strong className = "font-bold" /> ,
115119 } }
Original file line number Diff line number Diff line change 537537 "next" : " Next" ,
538538 "dialog" : {
539539 "delete" : {
540- "title" : " Delete {{target_name}}? " ,
540+ "title" : " Delete? " ,
541541 "description" : " You are going to delete <strong>{{title}}</strong>"
542542 }
543543 }
Original file line number Diff line number Diff line change 537537 "next" : " 下一页" ,
538538 "dialog" : {
539539 "delete" : {
540- "title" : " 删除{{target_name}} ?" ,
540+ "title" : " 确认删除 ?" ,
541541 "description" : " 您将要删除 <strong>{{title}}</strong>"
542542 }
543543 }
You can’t perform that action at this time.
0 commit comments