@@ -3,10 +3,9 @@ import { memo } from 'preact/compat'
3
3
import config from '../config'
4
4
import withStyles from '../components/jss'
5
5
6
- import { privateProfile , publicProfile , deleteAccount , updateAccount , updateEmail , deleteEmail } from '../api/profile'
6
+ import { privateProfile , publicProfile , updateAccount , updateEmail , deleteEmail } from '../api/profile'
7
7
import { useToast } from '../components/toast'
8
8
import Form from '../components/form'
9
- import Modal from '../components/modal'
10
9
import MembersCard from '../components/profile/memberscard'
11
10
import TokenPreview from '../components/tokenPreview'
12
11
import * as util from '../util'
@@ -23,66 +22,6 @@ for (const division of Object.entries(config.divisions)) {
23
22
divisionMap . set ( division [ 1 ] , division [ 0 ] )
24
23
}
25
24
26
- const DeleteModal = withStyles ( {
27
- modalBody : {
28
- paddingTop : '0em !important' // reduce space between header and body
29
- } ,
30
- controls : {
31
- display : 'flex' ,
32
- justifyContent : 'center' ,
33
- '& :first-child' : {
34
- marginLeft : '0em'
35
- } ,
36
- '& :last-child' : {
37
- marginRight : '0em'
38
- }
39
- }
40
- } , ( { open, onClose, onSuccess, teamName, classes } ) => {
41
- const [ inputName , setInputName ] = useState ( '' )
42
- const handleInputNameChange = useCallback ( ( e ) => setInputName ( e . target . value ) , [ ] )
43
- const isNameValid = inputName === teamName
44
- const verifyName = useCallback ( ( e ) => {
45
- e . preventDefault ( )
46
- if ( isNameValid ) {
47
- onSuccess ( )
48
- }
49
- } , [ isNameValid , onSuccess ] )
50
- const wrappedOnClose = useCallback ( ( e ) => {
51
- e . preventDefault ( )
52
- onClose ( )
53
- } , [ onClose ] )
54
-
55
- useEffect ( ( ) => {
56
- if ( ! open ) {
57
- setInputName ( '' )
58
- }
59
- } , [ open ] )
60
-
61
- return (
62
- < Modal { ...{ open, onClose } } >
63
- < div class = 'modal-header' >
64
- < div class = 'modal-title' > Delete Account</ div >
65
- </ div >
66
- { /* Put buttons in the body because otherwise there is too much padding */ }
67
- < form class = { `modal-body ${ classes . modalBody } ` } onSubmit = { verifyName } >
68
- < div > Are you sure you want to delete your team? This action is permanent.</ div >
69
- < div class = 'form-section' >
70
- < label > Type your team name to confirm:</ label >
71
- < input placeholder = { teamName } value = { inputName } onInput = { handleInputNameChange } />
72
- </ div >
73
- < div class = { `${ classes . controls } ` } >
74
- < div class = 'btn-container u-inline-block' >
75
- < button class = 'btn-small' onClick = { wrappedOnClose } > Cancel</ button >
76
- </ div >
77
- < div class = 'btn-container u-inline-block' >
78
- < input type = 'submit' class = 'btn-small btn-danger outline' disabled = { ! isNameValid } value = 'Delete Team' />
79
- </ div >
80
- </ div >
81
- </ form >
82
- </ Modal >
83
- )
84
- } )
85
-
86
25
const SummaryCard = memo ( withStyles ( {
87
26
icon : {
88
27
'& svg' : {
@@ -208,10 +147,6 @@ const UpdateCard = withStyles({
208
147
} , ( { name : oldName , email : oldEmail , onUpdate, classes } ) => {
209
148
const { toast } = useToast ( )
210
149
211
- const [ deleteModalVisible , setDeleteModalVisible ] = useState ( false )
212
- const dismissDeleteModal = useCallback ( ( ) => setDeleteModalVisible ( false ) , [ ] )
213
- const handleDelete = useCallback ( ( ) => setDeleteModalVisible ( true ) , [ ] )
214
-
215
150
const [ name , setName ] = useState ( oldName )
216
151
const handleSetName = useCallback ( ( e ) => setName ( e . target . value ) , [ ] )
217
152
@@ -293,10 +228,6 @@ const UpdateCard = withStyles({
293
228
< input required icon = { < EnvelopeOpen /> } name = 'email' placeholder = 'Email' type = 'email' value = { email } onChange = { handleSetEmail } />
294
229
</ Form >
295
230
</ div >
296
- < div class = 'u-center action-bar' style = 'margin: 0.5rem; padding: 1rem' >
297
- < button class = 'btn-small btn-danger outline' style = 'border-color: var(--btn-color)' onClick = { handleDelete } > Delete Account</ button >
298
- < DeleteModal open = { deleteModalVisible } onClose = { dismissDeleteModal } onSuccess = { deleteAccount } teamName = { name } />
299
- </ div >
300
231
</ div >
301
232
</ div >
302
233
)
0 commit comments