chore: update signin button in visitor mode

This commit is contained in:
boojack
2022-07-25 21:50:25 +08:00
parent cfa4151cff
commit 58e68f8f80
9 changed files with 55 additions and 27 deletions

View File

@ -1,5 +1,4 @@
import { userService } from "../services";
import { useAppSelector } from "../store";
import Only from "./common/OnlyWhen";
import showDailyReviewDialog from "./DailyReviewDialog";
import showSettingDialog from "./SettingDialog";
@ -13,8 +12,6 @@ import "../less/siderbar.less";
interface Props {}
const Sidebar: React.FC<Props> = () => {
const user = useAppSelector((state) => state.user.user);
const handleMyAccountBtnClick = () => {
showSettingDialog();
};
@ -44,17 +41,6 @@ const Sidebar: React.FC<Props> = () => {
<button className="btn action-btn" onClick={handleArchivedBtnClick}>
<span className="icon">🗂</span> Archived
</button>
<Only when={userService.isVisitorMode()}>
{user ? (
<button className="btn action-btn" onClick={() => (window.location.href = "/")}>
<span className="icon">🏠</span> Back to Home
</button>
) : (
<button className="btn action-btn" onClick={() => (window.location.href = "/signin")}>
<span className="icon">👉</span> Sign in
</button>
)}
</Only>
</div>
<Only when={!userService.isVisitorMode()}>
<ShortcutList />