Skip to content

Commit 3a46855

Browse files
Merge pull request #65 from amosproj/feat/upload-of-pdf-documents
Feat/upload of pdf documents
2 parents af40f5c + bd7e305 commit 3a46855

File tree

8 files changed

+93
-7
lines changed

8 files changed

+93
-7
lines changed

Project/frontend/.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_BACKEND_HOST= 'http://localhost:8000'

Project/frontend/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ dist-ssr
2222
*.njsproj
2323
*.sln
2424
*.sw?
25+
.vite/*
26+

Project/frontend/package-lock.json

Lines changed: 45 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Project/frontend/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "frontend",
2+
"name": "Graph Masters frontend",
33
"private": true,
44
"version": "0.0.0",
55
"type": "module",
@@ -10,10 +10,13 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13+
"filepond-plugin-file-validate-type": "^1.2.9",
1314
"react": "^18.2.0",
14-
"react-dom": "^18.2.0"
15+
"react-dom": "^18.2.0",
16+
"react-filepond": "^7.1.2"
1517
},
1618
"devDependencies": {
19+
"@types/node": "^20.12.12",
1720
"@types/react": "^18.3.2",
1821
"@types/react-dom": "^18.2.22",
1922
"@typescript-eslint/eslint-plugin": "^7.2.0",

Project/frontend/src/components/App/index.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,11 @@ body {
1414
.logo {
1515
height: 300px;
1616
padding: 1.5em;
17+
}
18+
19+
.main_wrapper {
20+
display: flex;
21+
flex-direction: column;
22+
align-items: center;
23+
gap: 20px;
1724
}

Project/frontend/src/components/App/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import logo from "../../assets/team-logo.svg";
2+
import Upload from "../Upload";
3+
24

35
import "./index.css";
46

57
function App() {
68
return (
7-
<>
9+
<main className="main_wrapper">
10+
811
<header>
912
<h2>AMOS Project SS24 - Knowledge Graph Extractor</h2>
1013
</header>
1114
<img className="logo" src={logo} alt="" />
12-
</>
15+
<Upload />
16+
</main>
1317
);
1418
}
1519

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.upload_wrapper {
2+
width: 500px;
3+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
import { FilePond, registerPlugin } from 'react-filepond'
3+
4+
import 'filepond/dist/filepond.min.css'
5+
import "./index.css";
6+
import FilePondPluginFileValidateType from 'filepond-plugin-file-validate-type';
7+
// Register the plugin
8+
registerPlugin(FilePondPluginFileValidateType);
9+
10+
11+
function Upload() {
12+
return <section className="upload_wrapper">
13+
<FilePond
14+
allowMultiple={false}
15+
server={`${import.meta.env.VITE_BACKEND_HOST}/api/upload`}
16+
name="file"
17+
labelIdle='Drag & Drop your files or <span class="filepond--label-action">Browse</span>'
18+
acceptedFileTypes={["application/pdf"]}
19+
credits={false}
20+
/>
21+
</section>
22+
}
23+
24+
export default Upload;

0 commit comments

Comments
 (0)