diff --git a/www/server/app.js b/www/server/app.js index 94a40af69..1e2d2dfdd 100644 --- a/www/server/app.js +++ b/www/server/app.js @@ -390,7 +390,6 @@ app.get('/api/getProfileOptions', (req, res) => { alternativePinMappings: [ createPinMappings({ profileLabel: 'Profile 2' }), createPinMappings({ profileLabel: 'Profile 3' }), - createPinMappings({ profileLabel: 'Profile 4' }), ], }); }); diff --git a/www/src/Locales/en/PinMapping.jsx b/www/src/Locales/en/PinMapping.jsx index bd8450d93..4d0bef4d3 100644 --- a/www/src/Locales/en/PinMapping.jsx +++ b/www/src/Locales/en/PinMapping.jsx @@ -12,6 +12,10 @@ export default { 'Max 16 characters. Letters, numbers, and spaces allowed.', 'profile-pin-mapping-title': '{{profileLabel}} - Pin Mapping', 'profile-label-default': 'Profile {{profileNumber}}', + 'profile-add-button': '+ Add Profile', + 'profile-disabled': 'Disabled', + 'profile-enabled-tooltip': + 'Disabled profiles will not be available when using hotkeys to change profile.', 'profile-pins-warning': 'Try to avoid changing the buttons and/or directions used for the switch profile hotkeys. Otherwise, it will be difficult to understand what profile is being selected!', 'profile-copy-base': 'Copy base profile', diff --git a/www/src/Pages/PinMapping.tsx b/www/src/Pages/PinMapping.tsx index 3b088090a..82419fd9b 100644 --- a/www/src/Pages/PinMapping.tsx +++ b/www/src/Pages/PinMapping.tsx @@ -7,13 +7,24 @@ import React, { } from 'react'; import { NavLink } from 'react-router-dom'; import { useShallow } from 'zustand/react/shallow'; -import { Alert, Button, Col, Form, Nav, Row, Tab } from 'react-bootstrap'; +import { + Alert, + Button, + Col, + Form, + FormCheck, + Nav, + OverlayTrigger, + Row, + Tab, + Tooltip, +} from 'react-bootstrap'; import { Trans, useTranslation } from 'react-i18next'; import invert from 'lodash/invert'; import omit from 'lodash/omit'; import { AppContext } from '../Contexts/AppContext'; -import useProfilesStore from '../Store/useProfilesStore'; +import useProfilesStore, { MAX_PROFILES } from '../Store/useProfilesStore'; import Section from '../Components/Section'; import CustomSelect from '../Components/CustomSelect'; @@ -23,6 +34,7 @@ import { BUTTON_MASKS, DPAD_MASKS, getButtonLabels } from '../Data/Buttons'; import { BUTTON_ACTIONS, PinActionValues } from '../Data/Pins'; import './PinMapping.scss'; import { MultiValue, SingleValue } from 'react-select'; +import InfoCircle from '../Icons/InfoCircle'; type OptionType = { label: string; @@ -141,8 +153,11 @@ const PinSelectList = memo(function PinSelectList({ profileIndex: number; }) { const setProfilePin = useProfilesStore((state) => state.setProfilePin); + const pins = useProfilesStore( - useShallow((state) => omit(state.profiles[profileIndex], 'profileLabel')), + useShallow((state) => + omit(state.profiles[profileIndex], ['profileLabel', 'enabled']), + ), ); const { t } = useTranslation(''); const { buttonLabels } = useContext(AppContext); @@ -242,11 +257,18 @@ const PinSection = memo(function PinSection({ const copyBaseProfile = useProfilesStore((state) => state.copyBaseProfile); const setProfilePin = useProfilesStore((state) => state.setProfilePin); const saveProfiles = useProfilesStore((state) => state.saveProfiles); + const toggleProfileEnabled = useProfilesStore( + (state) => state.toggleProfileEnabled, + ); + const enabled = useProfilesStore( + (state) => state.profiles[profileIndex].enabled, + ); const profileLabel = useProfilesStore((state) => state.profiles[profileIndex].profileLabel) || t('PinMapping:profile-label-default', { profileNumber: profileIndex + 1, }); + const { updateUsedPins, buttonLabels } = useContext(AppContext); const { buttonLabelType, swapTpShareLabels } = buttonLabels; const CURRENT_BUTTONS = getButtonLabels(buttonLabelType, swapTpShareLabels); @@ -285,7 +307,36 @@ const PinSection = memo(function PinSection({ })} >