import React from "react"; import { Flex, Group, Select, Text } from "@mantine/core"; import toast from "react-hot-toast"; import { AiOutlineFullscreen } from "react-icons/ai"; import { AiFillGift } from "react-icons/ai"; import { FiDownload } from "react-icons/fi"; import { SearchInput } from "src/components/SearchInput"; import { FileFormat } from "src/enums/file.enum"; import { JSONCrackLogo } from "src/layout/JsonCrackLogo"; import useFile from "src/store/useFile"; import useJson from "src/store/useJson"; import useModal from "src/store/useModal"; import useUser from "src/store/useUser"; import { AccountMenu } from "./AccountMenu"; import { Logo } from "./Logo"; import { OptionsMenu } from "./OptionsMenu"; import { ToolsMenu } from "./ToolsMenu"; import { ViewMenu } from "./ViewMenu"; import { ViewModeMenu } from "./ViewModeMenu"; import { ZoomMenu } from "./ZoomMenu"; import * as Styles from "./styles"; function fullscreenBrowser() { if (!document.fullscreenElement) { document.documentElement.requestFullscreen().catch(() => { toast.error("Unable to enter fullscreen mode."); }); } else if (document.exitFullscreen) { document.exitFullscreen(); } } export const Toolbar: React.FC<{ isWidget?: boolean }> = ({ isWidget = false }) => { const getJson = useJson(state => state.getJson); const setVisible = useModal(state => state.setVisible); const setFormat = useFile(state => state.setFormat); const format = useFile(state => state.format); const premium = useUser(state => state.premium); const handleSave = () => { const a = document.createElement("a"); const file = new Blob([getJson()], { type: "text/plain" }); a.href = window.URL.createObjectURL(file); a.download = "jsoncrack.json"; a.click(); }; return ( {isWidget && } {!isWidget && (