X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Ftracker%2FToggleIcon.js;h=d3e3960fa4bd00795561344ddc493e40998e9c32;hb=ac6921da72ff4b0beab9e5f1308788a55aae3ad9;hp=6de9f63632652dea775d0eca42259e5f15d0425d;hpb=1a3d040147c19d24b8d02ec8e594eb06b8efc1ff;p=alttp.git
diff --git a/resources/js/components/tracker/ToggleIcon.js b/resources/js/components/tracker/ToggleIcon.js
index 6de9f63..d3e3960 100644
--- a/resources/js/components/tracker/ToggleIcon.js
+++ b/resources/js/components/tracker/ToggleIcon.js
@@ -8,6 +8,7 @@ import {
getDungeonBoss,
getDungeonRemainingItems,
getDungeonPrize,
+ getGTBoss,
hasDungeonBoss,
hasDungeonPrize,
highestActive,
@@ -18,11 +19,12 @@ import {
} from '../../helpers/tracker';
import { useTracker } from '../../hooks/tracker';
-const ToggleIcon = ({ controller, className, icons, svg }) => {
+const ToggleIcon = ({ controller, className, icons, svg, title, transform }) => {
const { setManualState, state } = useTracker();
const activeController = controller || ToggleIcon.nullController;
const active = activeController.getActive(state, icons);
const defaultIcon = activeController.getDefault(state, icons);
+ const icon = active || defaultIcon || icons[0];
const classNames = ['toggle-icon'];
if (active) {
classNames.push('active');
@@ -35,6 +37,7 @@ const ToggleIcon = ({ controller, className, icons, svg }) => {
if (svg) {
return {
activeController.handlePrimary(state, setManualState, icons);
e.preventDefault();
@@ -45,8 +48,9 @@ const ToggleIcon = ({ controller, className, icons, svg }) => {
e.preventDefault();
e.stopPropagation();
}}
+ transform={transform}
>
-
+
;
}
return {
e.stopPropagation();
}}
>
-
+
;
};
@@ -201,6 +205,13 @@ ToggleIcon.dungeonPrizeController = (dungeon) => ({
handleSecondary: previousString(`${dungeon.id}-prize`),
});
+ToggleIcon.gtBossController = (which) => ({
+ getActive: (state) => getGTBoss(state, which),
+ getDefault: (state) => getGTBoss(state, which),
+ handlePrimary: nextString(`gt-${which}-boss`),
+ handleSecondary: previousString(`gt-${which}-boss`),
+});
+
ToggleIcon.medallionController = {
getActive: highestActive,
getDefault: firstIcon,
@@ -257,6 +268,13 @@ ToggleIcon.nullController = {
handleSecondary: doNothing,
};
+ToggleIcon.pinController = (pin, removePin) => ({
+ getActive: firstIcon,
+ getDefault: firstIcon,
+ handlePrimary: doNothing,
+ handleSecondary: () => removePin(pin),
+});
+
ToggleIcon.simpleController = {
getActive: highestActive,
getDefault: firstIcon,
@@ -287,6 +305,8 @@ ToggleIcon.propTypes = {
}),
icons: PropTypes.arrayOf(PropTypes.string),
svg: PropTypes.bool,
+ title: PropTypes.string,
+ transform: PropTypes.string,
};
export default ToggleIcon;