diff --git a/webapp/src/views/projects/BaseProjectView.tsx b/webapp/src/views/projects/BaseProjectView.tsx index b012967019..b441cede03 100644 --- a/webapp/src/views/projects/BaseProjectView.tsx +++ b/webapp/src/views/projects/BaseProjectView.tsx @@ -42,7 +42,7 @@ export const BaseProjectView: React.FC = ({ {...otherProps} navigation={[...prefixNavigation, ...(navigation || [])]} navigationRight={ - + diff --git a/webapp/src/views/projects/translations/BatchOperations/OperationsSummary/BatchOperationDialog.tsx b/webapp/src/views/projects/translations/BatchOperations/OperationsSummary/BatchOperationDialog.tsx index 2d1579fbd1..af76476b5a 100644 --- a/webapp/src/views/projects/translations/BatchOperations/OperationsSummary/BatchOperationDialog.tsx +++ b/webapp/src/views/projects/translations/BatchOperations/OperationsSummary/BatchOperationDialog.tsx @@ -22,6 +22,7 @@ import { useBatchOperationTypeTranslate } from 'tg.translationTools/useBatchOper import { useOperationCancel } from './useOperationCancel'; import LoadingButton from 'tg.component/common/form/LoadingButton'; import { useLoadingRegister } from 'tg.component/GlobalLoading'; +import { useGlobalActions } from 'tg.globalContext/GlobalContext'; type Props = { operation: BatchJobModel; @@ -36,6 +37,7 @@ export const BatchOperationDialog = ({ }: Props) => { const { t } = useTranslate(); const project = useProject(); + const { incrementPlanLimitErrors } = useGlobalActions(); const liveBatch = useProjectContext((c) => c.batchOperations?.find((o) => o.id === operation.id) @@ -72,6 +74,12 @@ export const BatchOperationDialog = ({ } }, [isFinished]); + useEffect(() => { + if (data.errorMessage === 'out_of_credits') { + incrementPlanLimitErrors(); + } + }, [data.errorMessage]); + return ( {typeLabel} diff --git a/webapp/src/views/projects/translations/ToolsPanel/panels/MachineTranslation/MachineTranslation.tsx b/webapp/src/views/projects/translations/ToolsPanel/panels/MachineTranslation/MachineTranslation.tsx index 736c76bb27..2281ffcecc 100644 --- a/webapp/src/views/projects/translations/ToolsPanel/panels/MachineTranslation/MachineTranslation.tsx +++ b/webapp/src/views/projects/translations/ToolsPanel/panels/MachineTranslation/MachineTranslation.tsx @@ -9,6 +9,7 @@ import { useMTStreamed } from './useMTStreamed'; import { TabMessage } from '../../common/TabMessage'; import { PanelContentProps } from '../../common/types'; import { MachineTranslationItem } from './MachineTranslationItem'; +import { useGlobalActions } from 'tg.globalContext/GlobalContext'; const StyledContainer = styled('div')` display: flex; @@ -41,6 +42,7 @@ export const MachineTranslation: React.FC = ({ activeVariant, }) => { const { t } = useTranslate(); + const { incrementPlanLimitErrors } = useGlobalActions(); const deps = { keyId: keyData.keyId, @@ -81,6 +83,12 @@ export const MachineTranslation: React.FC = ({ Boolean(arrayResults.length); const contextPresent = keyData.contextPresent; + useEffect(() => { + if (outOfCredit) { + incrementPlanLimitErrors(); + } + }, [outOfCredit]); + useEffect(() => { setItemsCount(arrayResults.length); }, [arrayResults.length]);