Skip to content

Commit

Permalink
navigation_back_button_update
Browse files Browse the repository at this point in the history
  • Loading branch information
Lungsangg committed Feb 4, 2025
1 parent 782b639 commit cb55754
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 47 deletions.
45 changes: 0 additions & 45 deletions static/js/Misc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1347,50 +1347,6 @@ MenuButton.propTypes = {
};


// class NavigateBackButton extends Component {
// onClick(e) {
// e.preventDefault();
// window.history.back();
// }

// render() {
// return (
// <a href="#" className="navigateBackButton" onClick={this.onClick.bind(this)}>
// <i className="fa fa-chevron-left"></i> {/* Font Awesome chevron-left icon */}
// </a>
// );
// }
// }

class NavigateBackButton extends Component {
onClick(e) {
e.preventDefault();
let newCurrentRef = this.props.currentRef;

// Remove trailing numbers from currentRef
currentRef = newCurrentRef.replace(/\d+$/, '');

const currentRef = this.props.currentRef;
if (currentRef) {
window.location.href = `/${currentRef}?tab=contents`;
}
console.log("this is currentRef", currentRef)
}

render() {
return (
<a href="#" className="navigationBackButton" onClick={this.onClick.bind(this)}>
<i className="fa fa-arrow-left"></i>
</a>
);
}
}

NavigateBackButton.propTypes = {
currentRef: PropTypes.string
};


class CloseButton extends Component {
onClick(e) {
e.preventDefault();
Expand Down Expand Up @@ -3404,7 +3360,6 @@ export {
ProfileListing,
ProfilePic,
ReaderMessage,
NavigateBackButton,
CloseButton,
DisplaySettingsButton,
MenuButton,
Expand Down
3 changes: 1 addition & 2 deletions static/js/ReaderPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import PublicCollectionsPage from './PublicCollectionsPage';
import TranslationsPage from './TranslationsPage';
import { TextColumnBannerChooser } from './TextColumnBanner';
import {
NavigateBackButton,
CloseButton,
MenuButton,
DisplaySettingsButton,
Expand Down Expand Up @@ -1442,7 +1441,7 @@ class ReaderControls extends Component {
let leftControls = hideHeader || connectionsHeader ? null :
(<div className="leftButtons">

{this.props.multiPanel ? (<NavigateBackButton currentRef={this.props.currentRef}/>) : null}
{this.props.multiPanel ? (<CloseButton onClick={this.props.closePanel} />) : null}
{this.props.multiPanel ? null : (<MenuButton onClick={this.props.openMobileNavMenu}/>)}
<div className='textStatus'>
{this.setTextCompletionStatus(status)}
Expand Down

0 comments on commit cb55754

Please sign in to comment.