ToStudio.tsx 950 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { useIntl } from "react-intl";
  2. import { Button } from "antd";
  3. import { Link } from "react-router";
  4. import { useAppSelector } from "../../hooks";
  5. import { currentUser as _currentUser } from "../../reducers/current-user";
  6. interface IWidget {
  7. style?: React.CSSProperties;
  8. }
  9. const ToStudioWidget = ({ style }: IWidget) => {
  10. const intl = useIntl();
  11. const user = useAppSelector(_currentUser);
  12. if (typeof user !== "undefined") {
  13. return (
  14. <span style={style}>
  15. <Button
  16. type="primary"
  17. style={{
  18. paddingLeft: 18,
  19. paddingRight: 18,
  20. backgroundColor: "#52974e",
  21. }}
  22. >
  23. <Link to={`/studio/${user.realName}/home`} target="_blank">
  24. {intl.formatMessage({
  25. id: "columns.studio.title",
  26. })}
  27. </Link>
  28. </Button>
  29. </span>
  30. );
  31. } else {
  32. return <></>;
  33. }
  34. };
  35. export default ToStudioWidget;