+ {state.operation === 'pending' && (
+ <>
+
+
Processing...
+ >
+ )}
+
+ {state.operation === 'success' && (
+ <>
+
+
Completed
+ >
+ )}
+
+ {state.operation === 'error' && (
+ <>
+
+
Failed
+ >
+ )}
+
+ );
+}
\ No newline at end of file
diff --git a/frontend/src/contexts/DeleteOperationContext.tsx b/frontend/src/contexts/DeleteOperationContext.tsx
new file mode 100644
index 00000000..cde3146e
--- /dev/null
+++ b/frontend/src/contexts/DeleteOperationContext.tsx
@@ -0,0 +1,195 @@
+import React, { createContext, useContext, useReducer, useEffect, useRef } from 'react';
+
+type DeleteState = {
+ isDeleting: boolean;
+ targetId: string | null;
+ isActive: boolean;
+ operation: 'none' | 'pending' | 'success' | 'error';
+};
+
+type DeleteAction =
+ | { type: 'START_DELETE'; id: string; isActive: boolean }
+ | { type: 'DELETE_SUCCESS' }
+ | { type: 'DELETE_ERROR' }
+ | { type: 'RESET' };
+
+const initialState: DeleteState = {
+ isDeleting: false,
+ targetId: null,
+ isActive: false,
+ operation: 'none'
+};
+
+function deleteReducer(state: DeleteState, action: DeleteAction): DeleteState {
+ switch (action.type) {
+ case 'START_DELETE':
+ return {
+ ...state,
+ isDeleting: true,
+ targetId: action.id,
+ isActive: action.isActive,
+ operation: 'pending'
+ };
+ case 'DELETE_SUCCESS':
+ return {
+ ...state,
+ operation: 'success'
+ };
+ case 'DELETE_ERROR':
+ return {
+ ...state,
+ isDeleting: false,
+ operation: 'error'
+ };
+ case 'RESET':
+ return initialState;
+ default:
+ return state;
+ }
+}
+
+type DeleteOperationContextType = {
+ state: DeleteState;
+ dispatch: React.Dispatch