Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel task confirmation changes #32575

Merged
merged 10 commits into from
Jan 29, 2024
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,8 @@ export default {
markAsIncomplete: 'Mark as incomplete',
assigneeError: 'There was an error assigning this task, please try another assignee.',
genericCreateTaskFailureMessage: 'Unexpected error create task, please try again later.',
deleteTask: 'Delete task',
deleteConfirmation: 'Are you sure that you want to delete this task?',
},
statementPage: {
title: (year, monthName) => `${monthName} ${year} statement`,
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1795,6 +1795,8 @@ export default {
markAsIncomplete: 'Marcar como incompleta',
assigneeError: 'Hubo un error al asignar esta tarea, inténtalo con otro usuario.',
genericCreateTaskFailureMessage: 'Error inesperado al crear el tarea, por favor, inténtalo más tarde.',
deleteTask: 'Eliminar tarea',
deleteConfirmation: '¿Estás seguro de que quieres eliminar esta tarea?',
},
statementPage: {
title: (year, monthName) => `Estado de cuenta de ${monthName} ${year}`,
Expand Down
17 changes: 16 additions & 1 deletion src/pages/home/HeaderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import _ from 'underscore';
import GoogleMeetIcon from '@assets/images/google-meet.svg';
import ZoomIcon from '@assets/images/zoom-icon.svg';
import Button from '@components/Button';
import ConfirmModal from '@components/ConfirmModal';
import DisplayNames from '@components/DisplayNames';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
Expand Down Expand Up @@ -91,6 +92,7 @@ const defaultProps = {
};

function HeaderView(props) {
const [isDeleteTaskConfirmModalVisible, setIsDeleteTaskConfirmModalVisible] = React.useState(false);
const {isSmallScreenWidth, windowWidth} = useWindowDimensions();
const {translate} = useLocalize();
const theme = useTheme();
Expand Down Expand Up @@ -138,7 +140,7 @@ function HeaderView(props) {
threeDotMenuItems.push({
icon: Expensicons.Trashcan,
text: translate('common.delete'),
onSelected: Session.checkIfActionIsAllowed(() => Task.deleteTask(props.reportID, props.report.reportName, props.report.stateNum, props.report.statusNum)),
onSelected: () => setIsDeleteTaskConfirmModalVisible(true),
});
}
}
Expand Down Expand Up @@ -317,6 +319,19 @@ function HeaderView(props) {
)}
</View>
</View>
<ConfirmModal
isVisible={isDeleteTaskConfirmModalVisible}
onConfirm={() => {
setIsDeleteTaskConfirmModalVisible(false);
Session.checkIfActionIsAllowed(Task.deleteTask(props.reportID, props.report.reportName, props.report.stateNum, props.report.statusNum));
}}
onCancel={() => setIsDeleteTaskConfirmModalVisible(false)}
title={translate('task.deleteTask')}
prompt={translate('task.deleteConfirmation')}
confirmText={translate('common.delete')}
cancelText={translate('common.cancel')}
danger
/>
</>
)}
</View>
Expand Down
Loading