import PublicIcon from "@mui/icons-material/Public";
import PublicOffIcon from "@mui/icons-material/PublicOff";
import { IconButton, Tooltip } from "@mui/material";
import { usePublicMode } from "../hooks/context_providers/PublicModeProvider";

export function PublicModeButton(): React.ReactElement {
  const publicMode = usePublicMode();

  return (
    <Tooltip title={`${publicMode.enabled ? "Disable" : "Enable"} public mode`}>
      <IconButton
        onClick={() => {
          publicMode.setEnabled(!publicMode.enabled);
        }}
        style={{ color: "inherit" }}
      >
        {!publicMode.enabled ? <PublicOffIcon /> : <PublicIcon />}
      </IconButton>
    </Tooltip>
  );
}
