diff --git a/src/bridges/utils.ts b/src/bridges/utils.ts index bf9a71c..05a33fd 100644 --- a/src/bridges/utils.ts +++ b/src/bridges/utils.ts @@ -113,7 +113,7 @@ const utilsBridge = { addTouchBarEventsListener: (callback: (IObjectWithKey) => any) => { ipcRenderer.removeAllListeners("touchbar-event") ipcRenderer.on("touchbar-event", (_, key: string) => { - callback({ key: key} ) + callback({ key: key } ) }) }, initTouchBar: (texts: TouchBarTexts) => { diff --git a/src/components/menu.tsx b/src/components/menu.tsx index 686542c..9170fa5 100644 --- a/src/components/menu.tsx +++ b/src/components/menu.tsx @@ -50,16 +50,16 @@ export class Menu extends React.Component { }, { name: intl.get("menu.subscriptions"), - links: this.props.groups.filter(g => g.sids.length > 0).map((g, i) => { + links: this.props.groups.filter(g => g.sids.length > 0).map(g => { if (g.isMultiple) { let sources = g.sids.map(sid => this.props.sources[sid]) return { name: g.name, ariaLabel: this.countOverflow(sources.map(s => s.unreadCount).reduce((a, b) => a + b, 0)), - key: "g-" + i, + key: "g-" + g.index, url: null, isExpanded: g.expanded, - onClick: () => this.props.selectSourceGroup(g, "g-" + i), + onClick: () => this.props.selectSourceGroup(g, "g-" + g.index), links: sources.map(this.getSource) } } else { diff --git a/src/components/settings.tsx b/src/components/settings.tsx index 2ae5f8d..d2606df 100644 --- a/src/components/settings.tsx +++ b/src/components/settings.tsx @@ -23,8 +23,8 @@ class Settings extends React.Component { super(props) } - componentDidUpdate= (prevProps: SettingsProps) => { - if (this.props.display !== prevProps.display) { + componentDidUpdate = (prevProps: SettingsProps) => { + if (window.utils.platform === "darwin" && this.props.display !== prevProps.display) { if (this.props.display) window.utils.destroyTouchBar() else initTouchBarWithTexts() } diff --git a/src/containers/menu-container.tsx b/src/containers/menu-container.tsx index 8192319..4630dfc 100644 --- a/src/containers/menu-container.tsx +++ b/src/containers/menu-container.tsx @@ -23,7 +23,7 @@ const mapStateToProps = createSelector( display: app.menu, selected: app.menuKey, sources: sources, - groups: groups, + groups: groups.map((g, i) => ({ ...g, index: i })), searchOn: searchOn, itemOn: itemOn, }) @@ -47,7 +47,7 @@ const mapDispatchToProps = dispatch => ({ dispatch(openGroupMenu(sids, event)) }, updateGroupExpansion: (event: React.MouseEvent, key: string, selected: string) => { - if ((event.target as HTMLElement).tagName !== "DIV" || key === selected) { + if ((event.target as HTMLElement).tagName === "I" || key === selected) { let [type, index] = key.split("-") if (type === "g") dispatch(toggleGroupExpansion(parseInt(index))) } diff --git a/src/schema-types.ts b/src/schema-types.ts index 379a12a..9dfb9ba 100644 --- a/src/schema-types.ts +++ b/src/schema-types.ts @@ -3,7 +3,7 @@ export class SourceGroup { sids: number[] name?: string expanded?: boolean - index?: number // available only from groups tab container + index?: number // available only from menu or groups tab container constructor(sids: number[], name: string = null) { name = (name && name.trim()) || "Source group"