Commit 1862abfa by DigHuang Committed by GitHub

fix: hide skill delete reference text when unused (#7255)

parent 4066f3c1
...@@ -366,13 +366,14 @@ const List = ({ ...@@ -366,13 +366,14 @@ const List = ({
label: t('common:Delete'), label: t('common:Delete'),
onClick: () => onClick: () =>
openConfirmDelete({ openConfirmDelete({
customContent: ( customContent:
!isFolder && relatedAppsCount > 0 ? (
<Trans <Trans
i18nKey={i18nT('skill:confirm_delete_with_refs')} i18nKey={i18nT('skill:confirm_delete_with_refs')}
values={{ count: isFolder ? 0 : relatedAppsCount }} values={{ count: relatedAppsCount }}
components={{ bold: <Box as={'span'} fontWeight={'600'} /> }} components={{ bold: <Box as={'span'} fontWeight={'600'} /> }}
/> />
), ) : null,
onConfirm: () => onClickDeleteSkill(skill._id), onConfirm: () => onClickDeleteSkill(skill._id),
confirmText: t('skill:confirm_delete_action'), confirmText: t('skill:confirm_delete_action'),
confirmButtonVariant: 'dangerFill', confirmButtonVariant: 'dangerFill',
......
...@@ -224,13 +224,14 @@ export const LeftHeader = () => { ...@@ -224,13 +224,14 @@ export const LeftHeader = () => {
onClick: () => { onClick: () => {
if (!skillDetail) return; if (!skillDetail) return;
openConfirmDelete({ openConfirmDelete({
customContent: ( customContent:
(skillDetail.appCount ?? 0) > 0 ? (
<Trans <Trans
i18nKey={i18nT('skill:confirm_delete_with_refs')} i18nKey={i18nT('skill:confirm_delete_with_refs')}
values={{ count: skillDetail?.appCount ?? 0 }} values={{ count: skillDetail.appCount }}
components={{ bold: <Box as={'span'} fontWeight={'600'} /> }} components={{ bold: <Box as={'span'} fontWeight={'600'} /> }}
/> />
), ) : null,
onConfirm: () => onClickDeleteSkill(skillDetail._id), onConfirm: () => onClickDeleteSkill(skillDetail._id),
confirmText: t('skill:confirm_delete_action'), confirmText: t('skill:confirm_delete_action'),
confirmButtonVariant: 'dangerFill', confirmButtonVariant: 'dangerFill',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment