Skip to content

Commit

Permalink
Merge branch 'main' into mli6/fix-archive-saving
Browse files Browse the repository at this point in the history
  • Loading branch information
axgu authored Mar 23, 2024
2 parents f194252 + 51361cc commit a7e70e7
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 63 deletions.
66 changes: 33 additions & 33 deletions client/src/components/AddItemButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ function exampleReducer(dispatchState: any, action: any) {
// { key: "tepper", text: "Tepper Building", value: "Tepper Building" },
// ];

const buildings = Object.keys(BuildingType)
.filter((value) => value !== "ALL")
.map((key) => ({
key,
text: key,
value: key,
}));
// const buildings = Object.keys(BuildingType)
// .filter((value) => value !== "ALL")
// .map((key) => ({
// key,
// text: key,
// value: key,
// }));

// const templates = Object.keys(TemplateType)
// .filter((value) => value !== "ALL")
Expand Down Expand Up @@ -117,7 +117,7 @@ function AddItemButton(props: {
description: "",
value: "general",
identifiable: false,
building: buildplace(),
building: "CUC",
image: "",
imagePath: "",
imageObject: null as any,
Expand All @@ -137,8 +137,8 @@ function AddItemButton(props: {
// const[timeError, setTimeError] = useState(false);
// const[locationError, setLocationError] = useState(false);
// const[descriptionError, setDescriptionError] = useState(false);
const [buildingError, setBuildingError] = useState(false);
const [formError, setFormError] = useState(false);
// const [buildingError, setBuildingError] = useState(false);
const [formError, _setFormError] = useState(false);

const history = useHistory();

Expand All @@ -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 @@ -246,21 +246,21 @@ function AddItemButton(props: {
notes,
} = state;

let error = false;
// let error = false;

if (building === "") {
setBuildingError(true);
error = true;
} else {
setBuildingError(false);
}
// if (building === "") {
// setBuildingError(true);
// error = true;
// } else {
// setBuildingError(false);
// }

if (error) {
setFormError(true);
return;
} else {
setFormError(false);
}
// if (error) {
// setFormError(true);
// return;
// } else {
// setFormError(false);
// }

// if user, send notifcation to admins with notifs on
if (!props.isAdmin) {
Expand Down Expand Up @@ -540,7 +540,7 @@ function AddItemButton(props: {
onChange={handleRadioChange}
/>
</Form.Group>
<Form.Select
{/* <Form.Select
fluid
required
label="Building (Lost and Found Desk)"
Expand All @@ -550,14 +550,14 @@ function AddItemButton(props: {
value={state.building}
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
40 changes: 20 additions & 20 deletions client/src/components/EditItem.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// TODO: #126 Replace any annotations with appropriate type
/* eslint-disable @typescript-eslint/no-explicit-any */
import { BuildingType } from "../enums/locationTypes";
// import { BuildingType } from "../enums/locationTypes";
import { PermissionType } from "../enums/permissionType";
import { Item } from "../interface/item";
import { User } from "../interface/user";
Expand Down Expand Up @@ -65,13 +65,13 @@ function exampleReducer(dispatchState: any, action: any) {
// { key: "tepper", text: "Tepper Building", value: "Tepper Building" },
// ];

const buildings = Object.keys(BuildingType)
.filter((value) => value !== "ALL")
.map((key) => ({
key,
text: key,
value: key,
}));
// const buildings = Object.keys(BuildingType)
// .filter((value) => value !== "ALL")
// .map((key) => ({
// key,
// text: key,
// value: key,
// }));

function EditItem(props: {
// TODO: #127 Replace bad Function type with appropriate type
Expand Down 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 @@ -396,7 +396,7 @@ function EditItem(props: {
onChange={handleRadioChange}
/>
</Form.Group>
<Form.Group widths="equal">
{/* <Form.Group widths="equal">
<Form.Select
fluid
required
Expand All @@ -407,14 +407,14 @@ function EditItem(props: {
value={state.building}
onChange={handleChange}
/>
</Form.Group>
<Form.Input
</Form.Group> */}
{/* <Form.Input
label="Image Upload"
name="imagePath"
type="file"
value={state.imagePath}
onChange={handleFileChange}
/>
/> */}
{state.identifiable ? (
<Form.Group widths="equal">
<Form.Input
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/ItemCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ const ItemCard = (props: { item: Item }) => {
<Card.Content className="bottom-content">
<b>Found: </b>
{props.item.whereFound} <br />
<b>Retrieve From: </b>
{props.item.whereToRetrieve.retrieveLocation}
{/* <b>Retrieve From: </b>
{props.item.whereToRetrieve.retrieveLocation} */}
</Card.Content>
</Card>
</div>
Expand Down
16 changes: 8 additions & 8 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 @@ -113,7 +113,7 @@ const TableWidget = (props: {
>
Description
</Table.HeaderCell>
<Table.HeaderCell
{/* <Table.HeaderCell
sorted={
props.sort.column === "building"
? props.sort.direction
Expand All @@ -122,15 +122,15 @@ const TableWidget = (props: {
onClick={() => changeSort("building")}
>
Building
</Table.HeaderCell>
<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 @@ -229,10 +229,10 @@ const TableWidget = (props: {
<Table.Cell>{item.name}</Table.Cell>
<Table.Cell>{item.whereFound}</Table.Cell>
<Table.Cell>{item.description}</Table.Cell>
<Table.Cell>{item.building}</Table.Cell>
<Table.Cell>
{/* <Table.Cell>{item.building}</Table.Cell> */}
{/* <Table.Cell>
<ImageModal image={item.image}></ImageModal>
</Table.Cell>
</Table.Cell> */}
{!props.isArchivedItems && props.isUser ? (
<Table.Cell>
<PublicDisplaySwitch
Expand Down

0 comments on commit a7e70e7

Please sign in to comment.