diff --git a/components/buttons/fullscreenbutton.tsx b/components/buttons/fullscreenbutton.tsx index 45b6882f..08615f90 100644 --- a/components/buttons/fullscreenbutton.tsx +++ b/components/buttons/fullscreenbutton.tsx @@ -12,10 +12,12 @@ export default function FullscreenButton() { return ( diff --git a/components/buttons/scalebutton.tsx b/components/buttons/resolutionbutton.tsx similarity index 55% rename from components/buttons/scalebutton.tsx rename to components/buttons/resolutionbutton.tsx index d6414434..19d1958c 100644 --- a/components/buttons/scalebutton.tsx +++ b/components/buttons/resolutionbutton.tsx @@ -3,6 +3,7 @@ import Hd from '@mui/icons-material/Hd'; import Sd from '@mui/icons-material/Sd'; import Button from '@mui/material/Button'; import { useTheme } from '@mui/material/styles'; +import Resolution from 'components/resolution'; import { useAtom, useAtomValue } from 'jotai'; import { halfResolutionAtom } from 'lib/atoms/atoms'; @@ -11,18 +12,27 @@ const ScaleIcon = () => { return halfResolution ? : ; }; -export default function ScaleButton() { +export default function ResolutionButton() { const [halfResolution, setHalfResolution] = useAtom(halfResolutionAtom); const theme = useTheme(); + + // Define styles outside the return for better readability + const buttonStyles = { + padding: '2px', + minWidth: 0, + color: halfResolution ? theme.palette.primary.contrastText : theme.palette.primary.light, + '&:hover': { + backgroundColor: 'rgba(255, 255, 255, 0.08)' + } + }; + return ( ); diff --git a/components/editor/editor.tsx b/components/editor/editor.tsx index 2a7c8205..1e7f92a4 100644 --- a/components/editor/editor.tsx +++ b/components/editor/editor.tsx @@ -6,6 +6,7 @@ import Giscus from '@giscus/react'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Grid from '@mui/material/Grid'; +import Stack from '@mui/material/Stack'; import { useTheme } from '@mui/material/styles'; import useMediaQuery from '@mui/material/useMediaQuery'; import { User } from '@supabase/supabase-js'; @@ -15,7 +16,7 @@ import PlayPauseButton from 'components/buttons/playpausebutton'; import RecordButton from 'components/buttons/recordbutton'; import ReloadButton from 'components/buttons/reloadbutton'; import ResetButton from 'components/buttons/resetbutton'; -import ScaleButton from 'components/buttons/scalebutton'; +import ResolutionButton from 'components/buttons/resolutionbutton'; import VimButton from 'components/buttons/vimbutton'; import EntryPointDisplay from 'components/editor/entrypointdisplay'; import { MetadataEditor } from 'components/editor/metadataeditor'; @@ -31,6 +32,7 @@ import { createClient } from 'lib/supabase/client'; import dynamic from 'next/dynamic'; import { useCallback } from 'react'; import { ItemWithTransitionSignal } from 'theme/itemwithtransition'; +import { MonacoTheme } from 'theme/monacotheme'; import { Frame } from 'theme/theme'; import ConfigurationPicker from './configurationpicker'; import Explainer from './explainer'; @@ -43,21 +45,23 @@ interface EditorProps { function Comments() { return ( - + + + ); } @@ -74,9 +78,6 @@ export default function Editor(props: EditorProps) { }, []); const Timer = dynamic(() => import('components/timer'), { ssr: false }); - const Resolution = dynamic(() => import('components/resolution'), { - ssr: false - }); let metadataEditor: JSX.Element | null = null; if (supabase && !props.standalone) { @@ -102,6 +103,43 @@ export default function Editor(props: EditorProps) { }; } + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down('md')); + + const monacoOptions = (isMobile: boolean) => ({ + stopRenderingLineAfter: isMobile ? 500 : 1000, + fontSize: isMobile ? 12 : 12, + lineHeight: isMobile ? 16 : 18, + fontFamily: "'Fira Code', monospace", + 'bracketPairColorization.enabled': true, + mouseWheelZoom: true, + minimap: { enabled: !isMobile }, + scrollBeyondLastLine: !isMobile, + automaticLayout: true, + lineNumbersMinChars: isMobile ? 3 : 4, + useShadowDOM: false // https://github.com/microsoft/monaco-editor/issues/3602 + }); + + const monacoEditorWithButtons = ( + +
+ + + + + +