import { Label } from "@radix-ui/react-label"; import type { NextPage } from "next"; import dynamic from "next/dynamic"; import { FileJs, Gear, Play } from "phosphor-react"; import Hotkeys from "react-hot-keys"; import Split from "react-split"; import { useSnapshot } from "valtio"; import { ButtonGroup, Flex } from "../../components"; import Box from "../../components/Box"; import Button from "../../components/Button"; import Popover from "../../components/Popover"; import RunScript from "../../components/RunScript"; import state from "../../state"; import { compileCode } from "../../state/actions"; import { getSplit, saveSplit } from "../../state/actions/persistSplits"; import { styled } from "../../stitches.config"; const HooksEditor = dynamic(() => import("../../components/HooksEditor"), { ssr: false, }); const LogBox = dynamic(() => import("../../components/LogBox"), { ssr: false, }); const OptimizationText = () => ( Specify which optimization level to use for compiling. For example -O0 means “no optimization”: this level compiles the fastest and generates the most debuggable code. -O2 means moderate level of optimization which enables most optimizations. Read more about the options from{" "} clang documentation . ); const StyledOptimizationText = styled(OptimizationText, { color: "$mauve12 !important", fontSize: "200px", "span a.link": { color: "red", }, }); const CompilerSettings = () => { const snap = useSnapshot(state); return ( ); }; const Home: NextPage = () => { const snap = useSnapshot(state); return ( saveSplit("developVertical", e)} >
{snap.files[snap.active]?.name?.split(".")?.[1]?.toLowerCase() === "c" && ( !snap.compiling && snap.files.length && compileCode(snap.active) } > }> )} {snap.files[snap.active]?.name?.split(".")?.[1]?.toLowerCase() === "js" && ( !snap.compiling && snap.files.length && compileCode(snap.active) } > )}
(state.logs = [])} logs={snap.logs} /> {snap.files[snap.active]?.name?.split(".")?.[1]?.toLowerCase() === "js" && ( (state.scriptLogs = [])} /> )}
); }; export default Home;