Skip to content

Commit

Permalink
Merge branch 'feat-robotpictures' of https://github.com/team4099/Falc…
Browse files Browse the repository at this point in the history
…onScout into feat-robotpictures
  • Loading branch information
Shilab66 committed Jul 22, 2024
2 parents 9b1015c + b5a06cf commit 9c1cec2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
24 changes: 18 additions & 6 deletions scoutingapp/src/components/img/RobotImage.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
import React from "react"
import { ComponentSetup } from "../interface"

interface RobotImageProps extends ComponentSetup {
robotNumber?: string;
}
export const emptyImage = <img
style={{width: "80%", height: "80%", alignItems: 'center', justifyContent: 'center'}}
src='../img/gray.png'
alt={`Picture of robot`}
/>

export function RobotImage(props: ComponentSetup) {
const robotNumber = props.getValue["TeamNumber"]

const makeAltText = (robotNumber: string) => {
if (robotNumber) {
return `Picture of robot ${robotNumber}`
} else {
return 'Insert robot number above'
}
}

export function RobotImage({ robotNumber = "4099", ...props }: RobotImageProps) {
return (
<img
style={{ width: "60%", height: "60%", alignItems: 'center', justifyContent: 'center', margin: "auto"}}
style={{ width: "60%", height: "60%", alignItems: 'center', justifyContent: 'center', margin: "auto" }}
src={`./src/components/img/${robotNumber}.png`}
alt={`Picture of robot ${robotNumber}`}
alt={makeAltText(robotNumber)}
/>
)
}
File renamed without changes
11 changes: 2 additions & 9 deletions scoutingapp/src/components/pages/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ComponentSetup, PageSetup } from "../interface"
import { GenericCheckboxSelect, GenericDropdown, GenericRadioSelect, GenericToggle, ChargedUpGridSelect } from "../selects"
import { GenericHeaderOne, GenericHeaderTwo, QRCodeModal, Timer } from "../texts"
import { CycleCounter } from "../monitor"
import { RobotImage } from "../img/RobotImage"
import { RobotImage, emptyImage } from "../img/RobotImage"
import ChargedUpStartingPosition from "../selects/ChargedUpStartingPosition"

interface ImportedComponentSetup extends ComponentSetup {
Expand All @@ -33,14 +33,7 @@ export function Page(props: PageSetup) {
"ChargedUpGridSelect": [ChargedUpGridSelect, []],
"ChargedUpStartingPosition": [ChargedUpStartingPosition, ""],
"ConeCubeIncrementInput": [ConeCubeIncrementInput, []],
"RobotImage": [
RobotImage,
<img
style={{width: "80%", height: "80%", alignItems: 'center', justifyContent: 'center'}}
src='../img/gray.png'
alt={`Picture of robot`}
/>
]
"RobotImage": [RobotImage, emptyImage]
}

let componentSetup: any = {}
Expand Down

0 comments on commit 9c1cec2

Please sign in to comment.