diff --git a/components/analyzer/EditableBuilds.tsx b/components/analyzer/EditableBuilds.tsx index fab4fc24f..273867907 100644 --- a/components/analyzer/EditableBuilds.tsx +++ b/components/analyzer/EditableBuilds.tsx @@ -2,7 +2,7 @@ import { Box, Button, Flex, IconButton } from "@chakra-ui/react"; import { t } from "@lingui/macro"; import ViewSlots, { ViewSlotsAbilities } from "components/builds/ViewSlots"; import AbilitiesSelector from "components/u/AbilitiesSelector"; -import { FiCopy, FiEdit, FiSquare } from "react-icons/fi"; +import { FiCopy, FiEdit, FiSquare, FiRotateCw } from "react-icons/fi"; import { AbilityOrUnknown } from "utils/types"; import HeadOnlyToggle from "./HeadOnlyToggle"; import LdeSlider from "./LdeSlider"; @@ -29,6 +29,8 @@ interface EditableBuildsProps { otherLde: number; setLde: React.Dispatch>; setOtherLde: React.Dispatch>; + resetBuild: () => void; + resetOtherBuild: () => void; } const EditableBuilds: React.FC = ({ @@ -47,6 +49,8 @@ const EditableBuilds: React.FC = ({ otherLde, setLde, setOtherLde, + resetBuild, + resetOtherBuild, }) => { const buildToEdit = otherFocused ? otherBuild : build; const handleChange = (value: Object) => @@ -92,17 +96,26 @@ const EditableBuilds: React.FC = ({ - {showOther && ( + + {showOther && ( + changeFocus()} + icon={} + isRound + /> + )} changeFocus()} - icon={} + aria-label={showOther ? "Reset orange build" : "Reset build"} + colorScheme="gray" + onClick={() => resetBuild()} + icon={} + ml="1em" isRound - mx="auto" /> - )} + = ({ {showOther && ( - changeFocus()} - icon={} - isRound - mx="auto" - /> + + changeFocus()} + icon={} + isRound + /> + resetOtherBuild()} + icon={} + ml="1em" + isRound + /> + { setLde={setLde} otherLde={otherLde} setOtherLde={setOtherLde} + resetBuild={resetBuild} + resetOtherBuild={resetOtherBuild} /> )} @@ -206,6 +208,14 @@ const BuildAnalyzerPage = () => { shoesAbilities: shoesAbilities as AbilityOrUnknown[], }); } + + function resetBuild() { + setBuild({ ...defaultBuild }); + } + + function resetOtherBuild() { + setOtherBuild({ ...defaultBuild }); + } }; BuildAnalyzerPage.header = (