From 481e603a0ca94bb068d1939c7feccfb07264b5a0 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Sat, 20 Apr 2024 13:57:30 +0200 Subject: [PATCH] compact keysanity tracker --- resources/js/components/tracker/Canvas.js | 4 +- .../js/components/tracker/ConfigDialog.js | 12 ++++++ resources/js/components/tracker/Dungeons.js | 16 +++++--- resources/js/components/tracker/ToggleIcon.js | 7 ++-- resources/js/components/tracker/Toolbar.js | 40 +++++++++++++++---- resources/js/helpers/tracker.js | 10 +++++ resources/js/i18n/de.js | 6 +++ resources/js/i18n/en.js | 6 +++ resources/sass/tracker.scss | 5 ++- 9 files changed, 88 insertions(+), 18 deletions(-) diff --git a/resources/js/components/tracker/Canvas.js b/resources/js/components/tracker/Canvas.js index 89339ab..62dafe1 100644 --- a/resources/js/components/tracker/Canvas.js +++ b/resources/js/components/tracker/Canvas.js @@ -56,7 +56,9 @@ const Canvas = () => { if (shouldShowDungeonItem(config, 'Big')) { ++count; } - return count > 2 ? LAYOUTS.manyDungeonItemsVertical : LAYOUTS.defaultVertical; + const compact = config.compactKeysanity && count === 4; + return !compact && count > 2 + ? LAYOUTS.manyDungeonItemsVertical : LAYOUTS.defaultVertical; } else { return LAYOUTS.defaultHorizontal; } diff --git a/resources/js/components/tracker/ConfigDialog.js b/resources/js/components/tracker/ConfigDialog.js index db6df71..9d6b5be 100644 --- a/resources/js/components/tracker/ConfigDialog.js +++ b/resources/js/components/tracker/ConfigDialog.js @@ -300,6 +300,18 @@ const ConfigDialog = ({ )} + + {t('tracker.config.compactKeysanity')} + +

{t('tracker.config.calculation')}

diff --git a/resources/js/components/tracker/Dungeons.js b/resources/js/components/tracker/Dungeons.js index c6ed5c2..8a7e4d0 100644 --- a/resources/js/components/tracker/Dungeons.js +++ b/resources/js/components/tracker/Dungeons.js @@ -7,6 +7,7 @@ import { BOSSES, getDungeonAcquiredSKs, getDungeonRemainingItems, + shouldCompactKeysanity, shouldShowDungeonItem, } from '../../helpers/tracker'; import { useTracker } from '../../hooks/tracker'; @@ -15,11 +16,12 @@ const Dungeons = ({ columns }) => { const { config, dungeons, state } = useTracker(); const layout = React.useMemo(() => { + const compact = shouldCompactKeysanity(config); const mapX = 1; const compassX = shouldShowDungeonItem(config, 'Map') ? mapX + 1 : mapX; const smallX = shouldShowDungeonItem(config, 'Compass') ? compassX + 1 : compassX; const bigX = shouldShowDungeonItem(config, 'Small') ? smallX + 1 : smallX; - const countX = shouldShowDungeonItem(config, 'Big') ? bigX + 1 : bigX; + const countX = compact ? 2 : shouldShowDungeonItem(config, 'Big') ? bigX + 1 : bigX; const bossX = countX + 1; const prizeX = bossX + 1; const dungeonWidth = Math.max(5, prizeX + 1); @@ -33,10 +35,14 @@ const Dungeons = ({ columns }) => { const transforms = { tag: null, - map: `translate(${mapX} 0) scale(0.9)`, - compass: `translate(${compassX} 0) scale(0.9)`, - small: `translate(${smallX} 0) scale(0.9)`, - big: `translate(${bigX} 0) scale(0.9)`, + map: compact + ? 'translate(0.75 -0.25) scale(0.45)' : `translate(${mapX} 0) scale(0.9)`, + compass: compact + ? 'translate(1.25 -0.25) scale(0.45)' : `translate(${compassX} 0) scale(0.9)`, + small: compact + ? 'translate(0.75 0.25) scale(0.45)' : `translate(${smallX} 0) scale(0.9)`, + big: compact + ? 'translate(1.25 0.25) scale(0.45)' : `translate(${bigX} 0) scale(0.9)`, checks: `translate(${countX} 0) scale(0.9)`, boss: `translate(${bossX} 0)`, prize: `translate(${prizeX} 0)`, diff --git a/resources/js/components/tracker/ToggleIcon.js b/resources/js/components/tracker/ToggleIcon.js index 6dee818..d3e3960 100644 --- a/resources/js/components/tracker/ToggleIcon.js +++ b/resources/js/components/tracker/ToggleIcon.js @@ -19,7 +19,7 @@ import { } from '../../helpers/tracker'; import { useTracker } from '../../hooks/tracker'; -const ToggleIcon = ({ controller, className, icons, svg, transform }) => { +const ToggleIcon = ({ controller, className, icons, svg, title, transform }) => { const { setManualState, state } = useTracker(); const activeController = controller || ToggleIcon.nullController; const active = activeController.getActive(state, icons); @@ -50,7 +50,7 @@ const ToggleIcon = ({ controller, className, icons, svg, transform }) => { }} transform={transform} > - + ; } return { e.stopPropagation(); }} > - + ; }; @@ -305,6 +305,7 @@ ToggleIcon.propTypes = { }), icons: PropTypes.arrayOf(PropTypes.string), svg: PropTypes.bool, + title: PropTypes.string, transform: PropTypes.string, }; diff --git a/resources/js/components/tracker/Toolbar.js b/resources/js/components/tracker/Toolbar.js index 85e0f04..f9d488a 100644 --- a/resources/js/components/tracker/Toolbar.js +++ b/resources/js/components/tracker/Toolbar.js @@ -60,16 +60,42 @@ const Toolbar = () => { - - - - - - + + + + + +
{ } }; +export const showsFullKeysanity = (config) => + shouldShowDungeonItem(config, 'Map') && + shouldShowDungeonItem(config, 'Compass') && + shouldShowDungeonItem(config, 'Small') && + shouldShowDungeonItem(config, 'Big'); + +export const shouldCompactKeysanity = (config) => + config.compactKeysanity && showsFullKeysanity(config); + export const toggleBoolean = name => state => ({ ...state, [name]: !state[name], diff --git a/resources/js/i18n/de.js b/resources/js/i18n/de.js index 21275f0..dcf4d21 100644 --- a/resources/js/i18n/de.js +++ b/resources/js/i18n/de.js @@ -527,6 +527,7 @@ export default { inventory: 'Inventar (Doors)', 'room-data': 'Raumdaten (Glitched)', }, + compactKeysanity: 'Kompaktes Keysanity', ganonCrystals: 'Ganon Crystals', glitches: 'Glitches', glitchRules: { @@ -547,6 +548,7 @@ export default { trinity: 'Trinity', }, gtCrystals: 'GT Crystals', + inverted: 'Inverted', layout: 'Layout', logic: 'Logik', mapLayout: 'Karte', @@ -564,6 +566,10 @@ export default { showItems: 'Zeige Dungeon Items', showMap: 'Maps', showSmall: 'Small Keys', + shuffleBig: 'Big Key Shuffle', + shuffleCompass: 'Kompass Shuffle', + shuffleMap: 'Map Shuffle', + shuffleSmall: 'Small Key Shuffle', title: 'Konfiguration', wildBig: 'Big Keys', wildCompass: 'Kompanden', diff --git a/resources/js/i18n/en.js b/resources/js/i18n/en.js index 2645cc9..dfa33f4 100644 --- a/resources/js/i18n/en.js +++ b/resources/js/i18n/en.js @@ -527,6 +527,7 @@ export default { inventory: 'Inventory (Doors)', 'room-data': 'Room data (glitched)', }, + compactKeysanity: 'Compact Keysanity', ganonCrystals: 'Ganon Crystals', glitches: 'Glitches', glitchRules: { @@ -547,6 +548,7 @@ export default { trinity: 'Trinity', }, gtCrystals: 'GT Crystals', + inverted: 'Inverted', layout: 'Layout', logic: 'Logic', mapLayout: 'Map', @@ -564,6 +566,10 @@ export default { showItems: 'Show Dungeon Items', showMap: 'Maps', showSmall: 'Small Keys', + shuffleBig: 'Big Key Shuffle', + shuffleCompass: 'Compass Shuffle', + shuffleMap: 'Map Shuffle', + shuffleSmall: 'Small Key Shuffle', title: 'Configuration', wildBig: 'Big Keys', wildCompass: 'Compasses', diff --git a/resources/sass/tracker.scss b/resources/sass/tracker.scss index cf6cb6d..ab1faab 100644 --- a/resources/sass/tracker.scss +++ b/resources/sass/tracker.scss @@ -18,11 +18,11 @@ .dungeons { .count-display, .dungeon-tag { - font-size: 0.5px; + font-size: 0.45px; font-weight: bold; fill: white; stroke: black; - stroke-width: 0.25px; + stroke-width: 0.2px; stroke-linejoin: round; paint-order: stroke fill; dominant-baseline: middle; @@ -38,6 +38,7 @@ } .count-display { font-size: 0.65px; + stroke-width: 0.3px; } } .items { -- 2.39.2