Skip to content

Commit

Permalink
complete PR (forgot to add lint changes)
Browse files Browse the repository at this point in the history
  • Loading branch information
shree-venkatesh committed Feb 28, 2024
1 parent e4f1eb2 commit 2d13936
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions houston/src/pages/Report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ interface ImageProps {
item: IdentifiedTarget;
matchedItems: MatchedTarget[];
foundItemIndex: number;
matched?: boolean;
updateMatched: UpdateItemFunction;
setFoundItemArray?: React.Dispatch<React.SetStateAction<IdentifiedTarget[]>>;
setItemArray?: React.Dispatch<React.SetStateAction<MatchedTarget[]>>;
}

interface BottleProps {
Expand All @@ -30,9 +27,13 @@ const button_colors = [red[300], blue[300], green[500], yellow[700], purple[300]
* @param props props
* @param props.item image to be displayed
* @param props.matchedItems array of items that we are comparing against
* @param props.updateMatched function to update matched items
* @returns image container
*/
function Image({item, matchedItems, updateMatched}: ImageProps) {
/**
* @returns reassigns the target to a different bottle
*/
async function reassignHandler() {
const value = prompt('Enter new Bottle ID');
let bottleIndex = "null";
Expand Down Expand Up @@ -108,6 +109,12 @@ function Image({item, matchedItems, updateMatched}: ImageProps) {
</div>
}

/**
* @param props props
* @param props.item bottle to be displayed
* @param props.matchedItems array of items that we are comparing against
* @returns bottle container
*/
function BottleImage({item, matchedItems} : BottleProps) {
const matchIndex = matchedItems.findIndex((itemX) => itemX.Bottle ? itemX.Bottle.Index === item.Index : null);
let backgroundColor = {backgroundColor: "grey"};
Expand Down Expand Up @@ -221,7 +228,7 @@ function Report() {
<div className="left-container">
<div className="gallery-container">
<div className="unmatched-gallery">
{foundItemArray.map((item, i) => <Image key={i} item={item} matchedItems={itemArray} foundItemIndex={foundItemArray.indexOf(item)} setFoundItemArray={setfoundItemArray} setItemArray={setItemArray} updateMatched={updateMatched}/>)}
{foundItemArray.map((item, i) => <Image key={i} item={item} matchedItems={itemArray} foundItemIndex={foundItemArray.indexOf(item)} updateMatched={updateMatched}/>)}
</div>
<div className="matched-gallery">
{itemArray.map((item, i) => item.Bottle ? <BottleImage key={i} item={item.Bottle} matchedItems={itemArray}/> : null)}
Expand Down

0 comments on commit 2d13936

Please sign in to comment.