LoginAlert.tsx 610 B

123456789101112131415161718192021222324252627
  1. import { useIntl } from "react-intl";
  2. import { _Link } from "react-router";
  3. import { Alert } from "antd";
  4. import { useAppSelector } from "../../hooks";
  5. import { isGuest } from "../../reducers/current-user";
  6. import LoginButton from "./LoginButton";
  7. const LoginAlertWidget = () => {
  8. const intl = useIntl();
  9. const guest = useAppSelector(isGuest);
  10. return guest === true ? (
  11. <Alert
  12. message={intl.formatMessage({
  13. id: "message.auth.guest.alert",
  14. })}
  15. type="warning"
  16. closable
  17. action={<LoginButton />}
  18. />
  19. ) : (
  20. <></>
  21. );
  22. };
  23. export default LoginAlertWidget;