forked from pavol-brunclik-m2ms/fragalysis-frontend
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/origin/allfunctionality' into p…
…erfMerge1
- Loading branch information
Showing
14 changed files
with
865 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[1125/154339.498:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1126/072635.367:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1126/101414.775:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1127/094210.853:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1130/073934.972:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1130/095727.044:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1130/113242.179:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1130/121144.917:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1130/122645.010:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1130/164350.825:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1201/093245.416:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1201/094839.161:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1201/100204.943:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1202/122926.150:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1202/131956.775:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1203/082340.317:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) | ||
[1208/082200.400:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React, { useState, useRef, useEffect } from 'react'; | ||
import { makeStyles, TextField, IconButton, Tooltip, Grid } from '@material-ui/core'; | ||
import { Edit } from '@material-ui/icons'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
search: { | ||
width: '100%' | ||
}, | ||
fontSizeSmall: { | ||
fontSize: '0.82rem' | ||
} | ||
})); | ||
|
||
const EditableInput = ({ dataText, index, updateText }) => { | ||
const inputRef = useRef(null); | ||
const [inputVisible, setInputVisible] = useState(false); | ||
const [text, setText] = useState(dataText); | ||
const classes = useStyles(); | ||
|
||
const onClickOutSide = e => { | ||
if (inputRef.current && !inputRef.current.contains(e.target)) { | ||
setInputVisible(false); | ||
if (updateText && text !== dataText) { | ||
updateText(text); | ||
} | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
// Handle outside clicks on mounted state | ||
if (inputVisible) { | ||
document.addEventListener('mousedown', onClickOutSide); | ||
} | ||
|
||
// This is a necessary step to "dismount" unnecessary events when we destroy the component | ||
return () => { | ||
document.removeEventListener('mousedown', onClickOutSide); | ||
}; | ||
}); | ||
|
||
return ( | ||
<React.Fragment> | ||
{inputVisible ? ( | ||
<TextField | ||
className={classes.search} | ||
ref={inputRef} | ||
value={text} | ||
onChange={e => { | ||
setText(e.target.value); | ||
}} | ||
/> | ||
) : ( | ||
<Grid item key={index}> | ||
{<span onClick={() => setInputVisible(true)}>{text}</span>} | ||
{ | ||
<IconButton color={'primary'} size="small" onClick={() => setInputVisible(true)}> | ||
<Tooltip title="Edit"> | ||
<Edit className={classes.fontSizeSmall} /> | ||
</Tooltip> | ||
</IconButton> | ||
} | ||
</Grid> | ||
)} | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
export default EditableInput; |
Oops, something went wrong.