Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pass highlightedRefsInSheet from SheetsWithRefPage #2246

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions static/js/ReaderPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,10 @@ class ReaderPanel extends Component {
e.preventDefault();
this.conditionalSetState({
mode: "Sheet",
sheetID: sheet.id,
sheetID: typeof sheet === 'object' ? sheet.id : sheet, // latter case is for when 'sheet' passed is ID
highlightedNode,
highlightedRefsInSheet
highlightedRefsInSheet,
menuOpen: null,
});
}
setPreviousSettings(backButtonSettings) {
Expand Down Expand Up @@ -866,7 +867,7 @@ class ReaderPanel extends Component {
updateAppliedOptionSort={this.props.updateSearchOptionSort}
registerAvailableFilters={this.props.registerAvailableFilters}
resetSearchFilters={this.props.resetSearchFilters}
onResultClick={this.props.onSearchResultClick}/>);
onResultClick={this.handleSheetClick}/>);
} else if (this.state.menuOpen === "sheet meta") {
menu = (<SheetMetadata
mode={this.state.menuOpen}
Expand Down
17 changes: 11 additions & 6 deletions static/js/SearchSheetResult.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ import Sefaria from './sefaria/sefaria';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import Component from 'react-class';
import {
ColorBarBox, InterfaceText,
} from './Misc';
import {ProfilePic} from "./ProfilePic";
import { ProfilePic } from "./ProfilePic";


class SearchSheetResult extends Component {
handleSheetClick(e) {
const s = this.props.metadata;
if (this.props.onResultClick) {
e.preventDefault()
stevekaplan123 marked this conversation as resolved.
Show resolved Hide resolved
this.props.onResultClick("Sheet " + s.sheetId);
const queryIsRef = !Sefaria.parseRef(this.props.query)?.error;
if (queryIsRef) {
// called from SheetsWithRefPage which has a ref query. in this case, onResultClick is handleSheetClick in ReaderPanel.jsx
stevekaplan123 marked this conversation as resolved.
Show resolved Hide resolved
this.props.onResultClick(e, s.sheetId, null, [this.props.query]);
}
else {
// called from ElasticSearchQuerier which has a text query. in this case, onResultClick is the panel's onSearchResultClick
e.preventDefault();
this.props.onResultClick(`Sheet ${s.sheetId}`);
}
}
Sefaria.track.event("Search", "Search Result Sheet Click", `${this.props.query} - ${s.sheetId}`);
}
Expand Down
Loading