fix: fix tour disabled state (#2264)

* fix: distinguish between pages that can tour or not

* Update OpenTour.js

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
This commit is contained in:
Baihhh 2023-08-27 23:18:14 +08:00 committed by GitHub
parent 7e349c1768
commit 7a85b74573
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,13 +26,23 @@ class OpenTour extends React.Component {
}; };
} }
canTour = () => {
const path = window.location.pathname.replace("/", "");
return TourConfig.TourUrlList.indexOf(path) !== -1 || path === "";
};
render() { render() {
return ( return (
<Tooltip title="Click to enable the help wizard"> this.canTour() ?
<div className="select-box" style={{display: Setting.isMobile() ? "none" : null, ...this.props.style}} onClick={() => TourConfig.setIsTourVisible(true)} > <Tooltip title="Click to enable the help wizard.">
<QuestionCircleOutlined style={{fontSize: "24px", color: "#4d4d4d"}} /> <div className="select-box" style={{display: Setting.isMobile() ? "none" : null, ...this.props.style}} onClick={() => TourConfig.setIsTourVisible(true)} >
<QuestionCircleOutlined style={{fontSize: "24px", color: "#4d4d4d"}} />
</div>
</Tooltip>
:
<div className="select-box" style={{display: Setting.isMobile() ? "none" : null, cursor: "not-allowed", ...this.props.style}} >
<QuestionCircleOutlined style={{fontSize: "24px", color: "#adadad"}} />
</div> </div>
</Tooltip>
); );
} }
} }