@@ -10,31 +10,32 @@ import {
1010} from '@material-ui/core' ;
1111import DeleteForeverOutlinedIcon from '@material-ui/icons/DeleteForeverOutlined' ;
1212import { makeStyles } from '@material-ui/core/styles' ;
13- import { DashboardContext } from '../context/DashboardContext' ;
1413
14+ import { DashboardContext } from '../context/DashboardContext' ;
1515import ServicesModal from '../modals/ServicesModal' ;
1616import '../stylesheets/Applications.css' ;
1717
18+ type ClickEvent = React . MouseEvent < HTMLElement > ;
19+
1820const Applications = ( ) => {
1921 const { applications, getApplications, deleteApp } = useContext ( DashboardContext ) ;
2022 const [ open , setOpen ] = useState < boolean > ( false ) ;
2123 const [ index , setIndex ] = useState < number > ( 0 ) ;
2224 const [ app , setApp ] = useState < string > ( '' ) ;
2325 const delRef = useRef < any > ( null ) ;
24- const appRef = useRef < any > ( null ) ;
2526
2627 useEffect ( ( ) => {
2728 getApplications ( ) ;
2829 } , [ ] ) ;
2930
3031 // Ask user for deletetion confirmation
31- const confirmDelete = ( event : React . MouseEvent < HTMLElement > , app : string , i : number ) => {
32+ const confirmDelete = ( event : ClickEvent , app : string , i : number ) => {
3233 const message = `The application '${ app } ' will be permanently deleted. Continue?` ;
3334 if ( confirm ( message ) ) deleteApp ( i ) ;
3435 } ;
3536
3637 // Handle clicks on Application cards
37- const handleClick = ( event : React . MouseEvent < HTMLElement > , selectedApp : string , i : number ) => {
38+ const handleClick = ( event : ClickEvent , selectedApp : string , i : number ) => {
3839 if ( ! delRef . current . contains ( event . target ) ) {
3940 setIndex ( i ) ;
4041 setApp ( selectedApp ) ;
@@ -83,7 +84,6 @@ const Applications = () => {
8384 < Grid item lg = { 4 } md = { 6 } sm = { 12 } key = { i } >
8485 < div id = "card-hover" >
8586 < Card
86- ref = { appRef }
8787 className = { classes . paper }
8888 variant = "outlined"
8989 onClick = { event => handleClick ( event , app [ 0 ] , i ) }
0 commit comments