Commit 1862abfa by DigHuang Committed by GitHub

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

parent 4066f3c1
......@@ -366,13 +366,14 @@ const List = ({
label: t('common:Delete'),
onClick: () =>
openConfirmDelete({
customContent: (
<Trans
i18nKey={i18nT('skill:confirm_delete_with_refs')}
values={{ count: isFolder ? 0 : relatedAppsCount }}
components={{ bold: <Box as={'span'} fontWeight={'600'} /> }}
/>
),
customContent:
!isFolder && relatedAppsCount > 0 ? (
<Trans
i18nKey={i18nT('skill:confirm_delete_with_refs')}
values={{ count: relatedAppsCount }}
components={{ bold: <Box as={'span'} fontWeight={'600'} /> }}
/>
) : null,
onConfirm: () => onClickDeleteSkill(skill._id),
confirmText: t('skill:confirm_delete_action'),
confirmButtonVariant: 'dangerFill',
......
......@@ -224,13 +224,14 @@ export const LeftHeader = () => {
onClick: () => {
if (!skillDetail) return;
openConfirmDelete({
customContent: (
<Trans
i18nKey={i18nT('skill:confirm_delete_with_refs')}
values={{ count: skillDetail?.appCount ?? 0 }}
components={{ bold: <Box as={'span'} fontWeight={'600'} /> }}
/>
),
customContent:
(skillDetail.appCount ?? 0) > 0 ? (
<Trans
i18nKey={i18nT('skill:confirm_delete_with_refs')}
values={{ count: skillDetail.appCount }}
components={{ bold: <Box as={'span'} fontWeight={'600'} /> }}
/>
) : null,
onConfirm: () => onClickDeleteSkill(skillDetail._id),
confirmText: t('skill:confirm_delete_action'),
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