Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edited code for removing image upload #214

Merged
merged 4 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions client/src/components/AddItemButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ function AddItemButton(props: {
const handleRadioChange = (e: any, { name, value }: any) => {
setState({ ...state, [name]: value === "true" });
};
const handleFileChange = (
e: React.ChangeEvent<HTMLInputElement>,
{ name, value }: any
) => {
setState({ ...state, [name]: value, imageObject: e?.target?.files?.[0] });
};
// const handleFileChange = (
// e: React.ChangeEvent<HTMLInputElement>,
// { name, value }: any
// ) => {
// setState({ ...state, [name]: value, imageObject: e?.target?.files?.[0] });
// };

const uploadImage = (imageFile: File) => {
const imageName = "test";
Expand Down Expand Up @@ -551,13 +551,13 @@ function AddItemButton(props: {
onChange={handleChange}
error={buildingError}
/>
<Form.Input
{/* <Form.Input
label="Image Upload"
name="imagePath"
type="file"
value={state.imagePath}
onChange={handleFileChange}
/>
/> */}
{state.identifiable ? (
<Form.Group widths="equal">
<Form.Input
Expand Down
20 changes: 10 additions & 10 deletions client/src/components/EditItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ function EditItem(props: {
const handleRadioChange = (e: any, { name, value }: any) => {
setState({ ...state, [name]: value === "true" });
};
const handleFileChange = (
e: React.ChangeEvent<HTMLInputElement>,
{ name, value }: any
) => {
console.log("handling file change");
console.log(name + " " + value);
setState({ ...state, [name]: value, imageObject: e?.target?.files?.[0] });
};
// const handleFileChange = (
// e: React.ChangeEvent<HTMLInputElement>,
// { name, value }: any
// ) => {
// console.log("handling file change");
// console.log(name + " " + value);
// setState({ ...state, [name]: value, imageObject: e?.target?.files?.[0] });
// };

const uploadImage = (imageFile: File) => {
console.log("attempting to edit image");
Expand Down Expand Up @@ -404,13 +404,13 @@ function EditItem(props: {
onChange={handleChange}
/>
</Form.Group>
<Form.Input
{/* <Form.Input
label="Image Upload"
name="imagePath"
type="file"
value={state.imagePath}
onChange={handleFileChange}
/>
/> */}
{state.identifiable ? (
<Form.Group widths="equal">
<Form.Input
Expand Down
10 changes: 5 additions & 5 deletions client/src/components/TableWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ApproveSwitch from "./ApproveSwitch";
import AvailableSwitch from "./AvailableSwitch";
import EditButton from "./EditItem";
import HistoryAccordion from "./HistoryAccordion";
import ImageModal from "./ImageModal";
// import ImageModal from "./ImageModal";
import PublicDisplaySwitch from "./PublicDisplaySwitch";
import UnarchiveButton from "./UnarchiveButton";

Expand Down Expand Up @@ -123,14 +123,14 @@ const TableWidget = (props: {
>
Building
</Table.HeaderCell>
<Table.HeaderCell
{/* <Table.HeaderCell
sorted={
props.sort.column === "image" ? props.sort.direction : undefined
}
onClick={() => changeSort("image")}
>
Image
</Table.HeaderCell>
</Table.HeaderCell> */}
{!props.isArchivedItems && props.isUser ? (
<Table.HeaderCell
sorted={
Expand Down Expand Up @@ -230,9 +230,9 @@ const TableWidget = (props: {
<Table.Cell>{item.whereFound}</Table.Cell>
<Table.Cell>{item.description}</Table.Cell>
<Table.Cell>{item.building}</Table.Cell>
<Table.Cell>
{/* <Table.Cell>
<ImageModal image={item.image}></ImageModal>
</Table.Cell>
</Table.Cell> */}
{!props.isArchivedItems && props.isUser ? (
<Table.Cell>
<PublicDisplaySwitch
Expand Down
Loading