-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb21f0c
commit 0301650
Showing
12 changed files
with
159 additions
and
307 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,40 +1,39 @@ | ||
/* App.css */ | ||
html, body { | ||
margin: 0px; | ||
padding: 0px; | ||
margin: 0; | ||
padding: 0; | ||
width: 100%; | ||
height: 100%; | ||
overflow-x: hidden; | ||
box-sizing: border-box; | ||
background-color: #d3d1d3; | ||
} | ||
|
||
.container-fluid { | ||
width: 100%; | ||
margin: 0px; | ||
padding: 0px; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.App { | ||
background-color: #d3d1d3; /* Light grey background */ | ||
min-height: 100vh; /* Full viewport height */ | ||
padding: 20px; | ||
background-color: #d3d1d3; | ||
min-height: 100vh; | ||
box-sizing: border-box; /* Optional padding */ | ||
padding: 20px; | ||
box-sizing: border-box; | ||
} | ||
|
||
.App-header { | ||
background-color: #d3d1d3; /* Dark grey background */ | ||
color: white; /* White text */ | ||
background-color: #d3d1d3; | ||
color: white; | ||
text-align: center; | ||
} | ||
|
||
.text-center { | ||
text-align: center; | ||
} | ||
|
||
.App-logo { | ||
width: 400px; /* Adjust as needed */ | ||
width: 400px; | ||
height: auto; | ||
display: block; | ||
margin: auto; | ||
|
||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,68 +1,68 @@ | ||
import React, { useState, useEffect, useCallback } from 'react'; | ||
import axios from 'axios'; | ||
import FileUpload from './components/FileUpload'; | ||
import FileList from './components/FileList'; | ||
import { Container, Row, Col, Spinner } from 'react-bootstrap'; | ||
import './App.css'; | ||
import React, { useState, useEffect, useCallback } from "react"; | ||
import axios from "axios"; | ||
import FileUpload from "./components/FileUpload"; | ||
import FileList from "./components/FileList"; | ||
import { Container, Row, Col, Spinner } from "react-bootstrap"; | ||
import "./App.css"; | ||
|
||
const App = () => { | ||
const [files, setFiles] = useState([]); | ||
const [loadingFiles, setLoadingFiles] = useState(false); | ||
const apiUrl = process.env.REACT_APP_API_GATEWAY_URL; | ||
const [files, setFiles] = useState([]); | ||
const [loadingFiles, setLoadingFiles] = useState(false); | ||
const apiUrl = process.env.REACT_APP_API_GATEWAY_URL; | ||
|
||
const fetchFiles = useCallback(async () => { | ||
setLoadingFiles(true); | ||
try { | ||
const response = await axios.get(`${apiUrl}listFiles`); | ||
if (response.status === 200) { | ||
setFiles(response.data); | ||
} else { | ||
console.error('Unexpected status code:', response.status); | ||
} | ||
} catch (error) { | ||
console.error('Error fetching files:', error); | ||
} finally { | ||
setLoadingFiles(false); | ||
} | ||
}, [apiUrl]); | ||
const fetchFiles = useCallback(async () => { | ||
setLoadingFiles(true); | ||
try { | ||
const response = await axios.get(`${apiUrl}listFiles`); | ||
if (response.status === 200) { | ||
setFiles(response.data); | ||
} else { | ||
console.error("Unexpected status code:", response.status); | ||
} | ||
} catch (error) { | ||
console.error("Error fetching files:", error); | ||
} finally { | ||
setLoadingFiles(false); | ||
} | ||
}, [apiUrl]); | ||
|
||
useEffect(() => { | ||
fetchFiles(); | ||
}, [fetchFiles]); | ||
useEffect(() => { | ||
fetchFiles(); | ||
}, [fetchFiles]); | ||
|
||
const handleFileUploadSuccess = () => { | ||
fetchFiles(); // Reload the file list | ||
}; | ||
const handleFileUploadSuccess = () => { | ||
fetchFiles(); // Reload the file list | ||
}; | ||
|
||
return ( | ||
<Container className="App"> | ||
<Row className="mb-4"> | ||
<Col> | ||
<img src="/logo.gif" alt="Animated Logo" className="App-logo" /> | ||
</Col> | ||
</Row> | ||
<Row className="mb-4"> | ||
<Col> | ||
<FileUpload apiUrl={apiUrl} onUploadSuccess={handleFileUploadSuccess} /> | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col> | ||
{loadingFiles ? ( | ||
<div className="text-center"> | ||
<Spinner animation="border" /> | ||
<p>Loading files...</p> | ||
</div> | ||
) : ( | ||
<FileList files={files} apiUrl={apiUrl} /> | ||
)} | ||
</Col> | ||
</Row> | ||
</Container> | ||
); | ||
return ( | ||
<Container className="App"> | ||
<Row className="mb-4"> | ||
<Col> | ||
<img src="/logo.gif" alt="Animated Logo" className="App-logo" /> | ||
</Col> | ||
</Row> | ||
<Row className="mb-4"> | ||
<Col> | ||
<FileUpload | ||
apiUrl={apiUrl} | ||
onUploadSuccess={handleFileUploadSuccess} | ||
/> | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col> | ||
{loadingFiles ? ( | ||
<div className="text-center"> | ||
<Spinner animation="border" /> | ||
<p>Loading files...</p> | ||
</div> | ||
) : ( | ||
<FileList files={files} apiUrl={apiUrl} /> | ||
)} | ||
</Col> | ||
</Row> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default App; |
Oops, something went wrong.