From dfa43a14fca2641310778e6ecabc161bcfffd916 Mon Sep 17 00:00:00 2001 From: yanas Date: Wed, 11 Mar 2026 15:24:22 -0500 Subject: [PATCH 1/2] docs: document toolbar button state shape in reducer Add a JSDoc comment describing each field on the toolbar button objects in initialState, making the data structure self-explanatory for future contributors. Co-Authored-By: Claude Sonnet 4.6 --- src/toolbar/reducer.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/toolbar/reducer.js b/src/toolbar/reducer.js index 05804c0..2934f3a 100644 --- a/src/toolbar/reducer.js +++ b/src/toolbar/reducer.js @@ -1,5 +1,17 @@ import * as t from './actionTypes'; +/** + * Each toolbar button in the state has the following shape: + * id {string} - unique identifier (e.g. "toolbar_button_mute") + * buttonClassName {string} - CSS classes for the default (un-toggled) state + * toggledClassName{string} - CSS classes when the button is toggled on (optional) + * buttonShortcut {string} - keyboard shortcut popover key (optional) + * i18nTextKey {string} - i18n key used to set the button's accessible text + * tooltipText {string} - human-readable tooltip + * toggled {boolean} - current toggle state; absence means non-toggleable + * disabled {boolean} - whether the button is currently disabled (optional) + * unreadMessages {number} - unread count badge, used by the chat button (optional) + */ const initialState = [ { id: "toolbar_button_mute", From 63cc94aad7b3d9be8b209b5787f585fa6df97866 Mon Sep 17 00:00:00 2001 From: yanas Date: Wed, 11 Mar 2026 15:31:31 -0500 Subject: [PATCH 2/2] docs: add JSDoc comment to toolbarButtonReducer Document parameters, toggle behavior, and return value for the per-button sub-reducer to make its logic easier to follow. Co-Authored-By: Claude Sonnet 4.6 --- src/toolbar/reducer.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/toolbar/reducer.js b/src/toolbar/reducer.js index 2934f3a..aafaab3 100644 --- a/src/toolbar/reducer.js +++ b/src/toolbar/reducer.js @@ -85,6 +85,15 @@ const initialState = [ } ]; +/** + * Sub-reducer for a single toolbar button. On CLICK_BUTTON, toggles the + * `toggled` flag if the action targets this button and the button supports + * toggling (i.e. `toggled` is defined). Returns the button unchanged otherwise. + * + * @param {Object} toolbarButton - A single button entry from the state array. + * @param {Object} action - The dispatched Redux action. + * @returns {Object} The next state for this button. + */ const toolbarButtonReducer = (toolbarButton, action) => { switch (action.type) { case t.CLICK_BUTTON: