Skip to content

Commit

Permalink
Merge pull request #562 from bounswe/feature/frontend-imageannotate
Browse files Browse the repository at this point in the history
Implementation - First Draft of - Customer Request - Add Components as Images To be Annotated to Resources
  • Loading branch information
kubraaksux authored Dec 19, 2023
2 parents b5dc1e4 + 8ddc7c7 commit 571c73c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
5 changes: 4 additions & 1 deletion resq/frontend/src/components/Resource/ResourceCreation.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import axios from 'axios';
import {ResourceContext, ResourceProvider, useResource} from './ResourceContext';
import ResourceDetail1 from "./ResourceDetail1";
import ResourceDetail2 from "./ResourceDetail2";
import ResourceDetail3 from "./ResourceDetail3";
import ResourceAddress from "./ResourceAddress";
import {createResource} from "../../AppService";

Expand All @@ -43,7 +44,7 @@ const customTheme = createTheme({
},
});

const steps = ['Resource delivery address', 'Type of Resource', 'Resource Details'];
const steps = ['Resource delivery address', 'Type of Resource', 'Resource Details', 'Add Image'];

export default function Resource() {
const [activeStep, setActiveStep] = React.useState(0);
Expand All @@ -60,6 +61,8 @@ export default function Resource() {
return <ResourceDetail1 resourceData={resourceData} setResourceData={setResourceData}/>;
case 2:
return <ResourceDetail2 resourceData={resourceData} setResourceData={setResourceData}/>;
case 3:
return <ResourceDetail3 resourceData={resourceData} setResourceData={setResourceData}/>;
default:
throw new Error('Unknown step');
}
Expand Down
24 changes: 24 additions & 0 deletions resq/frontend/src/components/Resource/ResourceDetail3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// ResourceDetail3.jsx
import React from 'react';

const ResourceDetail3 = ({ resourceData, setResourceData }) => {
const handlePhotoChange = (event) => {
const file = event.target.files[0];

if (file) {
setResourceData((prevData) => ({
...prevData,
photo: file,
}));
}
};

return (
<div>
<h3>Upload a Photo</h3>
<input type="file" accept="image/*" onChange={handlePhotoChange} />
</div>
);
};

export default ResourceDetail3;

0 comments on commit 571c73c

Please sign in to comment.