Skip to content

Commit

Permalink
Merge pull request #1652 from Sefaria/feature/sc-20316/inform-users-t…
Browse files Browse the repository at this point in the history
…hey-can-choose-alternative

fix: open connections in panel on mobile
  • Loading branch information
nsantacruz authored Sep 21, 2023
2 parents a91d5d0 + 0b05b89 commit 4ec507c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions static/js/ReaderPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@ class ReaderPanel extends Component {
if (Sefaria.util.object_equals(this.state.currVersions, newVersions)) { return; }
this.conditionalSetState({ currVersions: newVersions });
}
openConnectionsPanel(ref, additionalState) {
/**
* Decides whether to open a new connections panel or to open connections in the current panel
* depending on whether we're in multi-panel mode
*/
if (this.props.multiPanel) {
this.props.openConnectionsPanel(ref, null, additionalState);
} else {
this.openConnectionsInPanel(ref, additionalState);
}
}
openConnectionsInPanel(ref, additionalState) {
let refs = typeof ref == "string" ? [ref] : ref;
this.replaceHistory = this.state.mode === "TextAndConnections"; // Don't push history for change in Connections focus
Expand Down Expand Up @@ -1112,7 +1123,7 @@ class ReaderPanel extends Component {
openDisplaySettings={this.openDisplaySettings}
currentLayout={this.currentLayout}
onError={this.onError}
openConnectionsPanel={this.props.openConnectionsPanel}
openConnectionsPanel={this.openConnectionsPanel}
connectionsMode={this.state.filter.length && this.state.connectionsMode === "Connections" ? "Connection Text" : this.state.connectionsMode}
connectionsCategory={this.state.connectionsCategory}
closePanel={this.props.closePanel}
Expand Down Expand Up @@ -1261,7 +1272,7 @@ class ReaderControls extends Component {
});
}
openTranslations() {
this.props.openConnectionsPanel([this.props.currentRef], null, {"connectionsMode": "Translations"});
this.props.openConnectionsPanel([this.props.currentRef], {"connectionsMode": "Translations"});
}
componentDidMount() {
const title = this.props.currentRef;
Expand Down

0 comments on commit 4ec507c

Please sign in to comment.