Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrubajyotifounderofDSoft authored Feb 24, 2024
1 parent 74450cd commit 5e7cf19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions web-app/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ function App() {
setInfoDisplay('none')
setBgOpacityDisplay('none')
}

const triggerOpenFile = () => {
setWelcomePageDisplay('none');
setMonacoEditorDisplay('flex');
}

const handleFileChange = (event) => {
if (event.target.files) {
setFile(event.target.files[0]);
Expand All @@ -313,6 +319,7 @@ function App() {

useEffect(() => {
if (file) {
triggerOpenFile()
var reader = new FileReader();
reader.onload = async (e) => {
setCode(e.target.result);
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/components/MenuBar/MenuBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function MenuBar(props) {
<li aria-label="">New Tab</li>
<hr className="dropdowncontent-hr" />
<p className="form">
<label className="add-photo-btn">Open File<input type="file" id="myfile" name="myfile" onChange={props.handleFileChange}/>
<label className="add-photo-btn">Open File<input type="file" id="myfile" name="myfile" onChange={props.handleFileChange} />
</label>
</p>
<li aria-label="">Open Folder</li>
Expand Down

0 comments on commit 5e7cf19

Please sign in to comment.