chore: add demo banner (#1739)

This commit is contained in:
boojack
2023-05-25 19:29:30 +08:00
committed by GitHub
parent e69f7c735b
commit 43819b021e
5 changed files with 69 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
import { useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { useUserStore } from "@/store/module";
import { useGlobalStore, useUserStore } from "@/store/module";
import Icon from "./Icon";
import { generateDialog } from "./Dialog";
@@ -10,11 +10,16 @@ type Props = DialogProps;
const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => {
const { t } = useTranslation();
const userStore = useUserStore();
const globalStore = useGlobalStore();
const profile = globalStore.state.systemStatus.profile;
const [newPassword, setNewPassword] = useState("");
const [newPasswordAgain, setNewPasswordAgain] = useState("");
useEffect(() => {
// do nth
if (profile.mode === "demo" && userStore.state.user?.id === userStore.state.host?.id) {
toast.error("Demo mode does not support this operation.");
destroy();
}
}, []);
const handleCloseBtnClick = () => {