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, { IFile } from '../../state' import { compileCode } from '../../state/actions' import { getSplit, saveSplit } from '../../state/actions/persistSplits' import { styled } from '../../stitches.config' import { getFileExtention } from '../../utils/helpers' 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) const activeFile = snap.files[snap.active] as IFile | undefined const activeFileExt = getFileExtention(activeFile?.name) const canCompile = activeFileExt === 'c' || activeFileExt === 'wat' return ( saveSplit('developVertical', e)} >
{canCompile && ( !snap.compiling && snap.files.length && compileCode(snap.active)} > }> )} {activeFileExt === 'js' && ( !snap.compiling && snap.files.length && compileCode(snap.active)} > )}
(state.logs = [])} logs={snap.logs} /> {activeFileExt === 'js' && ( (state.scriptLogs = [])} /> )}
) } export default Home