@@ -19,7 +19,7 @@ import {
19
19
Tooltip
20
20
} from '@mui/material' ;
21
21
import PropTypes from 'prop-types' ;
22
- import { deleteTeam , updateTeam } from '../../api/team.js' ;
22
+ import { updateTeam } from '../../api/team.js' ;
23
23
import SplitButton from '../split-button/SplitButton' ;
24
24
25
25
const PREFIX = 'TeamSummaryCard' ;
@@ -59,7 +59,6 @@ const displayName = 'TeamSummaryCard';
59
59
const TeamSummaryCard = ( { team, index, onTeamSelect, selectedTeamId } ) => {
60
60
const { state, dispatch } = useContext ( AppContext ) ;
61
61
const { teams, userProfile, csrf } = state ;
62
- const [ openDelete , setOpenDelete ] = useState ( false ) ;
63
62
const [ openKudos , setOpenKudos ] = useState ( false ) ;
64
63
// const [selectedTeam, setSelectedTeam] = useState(null);
65
64
const [ tooltipIsOpen , setTooltipIsOpen ] = useState ( false ) ;
@@ -81,45 +80,16 @@ const TeamSummaryCard = ({ team, index, onTeamSelect, selectedTeamId }) => {
81
80
? false
82
81
: leads . some ( lead => lead . memberId === userProfile . memberProfile . id ) ;
83
82
84
- const handleOpenDeleteConfirmation = ( ) => setOpenDelete ( true ) ;
85
83
const handleOpenKudos = ( ) => setOpenKudos ( true ) ;
86
-
87
- const handleCloseDeleteConfirmation = ( ) => setOpenDelete ( false ) ;
88
84
const handleCloseKudos = ( ) => setOpenKudos ( false ) ;
89
85
90
- const teamId = team ?. id ;
91
- const deleteATeam = useCallback ( async ( ) => {
92
- if ( teamId && csrf ) {
93
- const result = await deleteTeam ( teamId , csrf ) ;
94
- if ( result && result . payload && result . payload . status === 200 ) {
95
- window . snackDispatch ( {
96
- type : UPDATE_TOAST ,
97
- payload : {
98
- severity : 'success' ,
99
- toast : 'Team deleted'
100
- }
101
- } ) ;
102
- let newTeams = teams . filter ( team => {
103
- return team . id !== teamId ;
104
- } ) ;
105
- dispatch ( {
106
- type : UPDATE_TEAMS ,
107
- payload : newTeams
108
- } ) ;
109
- }
110
- }
111
- } , [ teamId , csrf , dispatch , teams ] ) ;
112
-
113
- const options =
114
- isAdmin || isTeamLead ? [ 'Edit Team' , 'Give Kudos' , 'Delete Team' ] : [ 'Edit Team' , 'Give Kudos' ] ;
86
+ const options = [ 'Edit Team' , 'Give Kudos' ] ;
115
87
116
88
const handleAction = ( e , index ) => {
117
89
if ( index === 0 ) {
118
90
onTeamSelect ( team . id ) ;
119
91
} else if ( index === 1 ) {
120
92
handleOpenKudos ( ) ;
121
- } else if ( index === 2 ) {
122
- handleOpenDeleteConfirmation ( ) ;
123
93
}
124
94
} ;
125
95
@@ -195,27 +165,6 @@ const TeamSummaryCard = ({ team, index, onTeamSelect, selectedTeamId }) => {
195
165
{ ( isAdmin || isTeamLead ) && (
196
166
< >
197
167
< SplitButton options = { options } onClick = { handleAction } />
198
- < Dialog
199
- open = { openDelete }
200
- onClose = { handleCloseDeleteConfirmation }
201
- aria-labelledby = "alert-dialog-title"
202
- aria-describedby = "alert-dialog-description"
203
- >
204
- < DialogTitle id = "alert-dialog-title" > Delete team?</ DialogTitle >
205
- < DialogContent >
206
- < DialogContentText id = "alert-dialog-description" >
207
- Are you sure you want to delete the team?
208
- </ DialogContentText >
209
- </ DialogContent >
210
- < DialogActions >
211
- < Button onClick = { handleCloseDeleteConfirmation } color = "primary" >
212
- Cancel
213
- </ Button >
214
- < Button onClick = { deleteATeam } color = "primary" autoFocus >
215
- Yes
216
- </ Button >
217
- </ DialogActions >
218
- </ Dialog >
219
168
< KudosDialog
220
169
open = { openKudos }
221
170
onClose = { handleCloseKudos }
0 commit comments