diff --git a/website/src/repl/components/Header.jsx b/website/src/repl/components/Header.jsx index 4ff8bb0d6..19e7b8fad 100644 --- a/website/src/repl/components/Header.jsx +++ b/website/src/repl/components/Header.jsx @@ -1,19 +1,16 @@ import PlayCircleIcon from '@heroicons/react/20/solid/PlayCircleIcon'; import StopCircleIcon from '@heroicons/react/20/solid/StopCircleIcon'; import cx from '@src/cx.mjs'; -import { useSettings, setIsZen, setIsPanelOpened } from '../../settings.mjs'; +import { useSettings, setIsZen } from '../../settings.mjs'; import { StrudelIcon } from '@src/repl/components/icons/StrudelIcon'; import '../Repl.css'; -import { Bars3Icon } from '@heroicons/react/16/solid'; const { BASE_URL } = import.meta.env; const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL; -export function Header({ context, embedded = false }) { - const { started, pending, isDirty, activeCode, handleTogglePlay, handleEvaluate, handleShuffle, handleShare } = - context; - const isEmbedded = typeof window !== 'undefined' && (embedded || window.location !== window.parent.location); - const { isZen, isButtonRowHidden, isCSSAnimationDisabled, fontFamily, isPanelOpen, panelPosition } = useSettings(); +export function Header({ context, isEmbedded = false }) { + const { started, pending, isDirty, activeCode, handleTogglePlay, handleEvaluate, handleShare } = context; + const { isZen, isButtonRowHidden, isCSSAnimationDisabled, fontFamily } = useSettings(); return (
)} -
- {!isEmbedded && !isZen && panelPosition === 'right' && ( - - )} -
); } diff --git a/website/src/repl/components/ReplEditor.jsx b/website/src/repl/components/ReplEditor.jsx index 23ceb122b..03cf89f14 100644 --- a/website/src/repl/components/ReplEditor.jsx +++ b/website/src/repl/components/ReplEditor.jsx @@ -1,5 +1,5 @@ import Loader from '@src/repl/components/Loader'; -import { HorizontalPanel, VerticalPanel } from '@src/repl/components/panel/Panel'; +import { HorizontalPanel, VerticalPanel, PanelToggle } from '@src/repl/components/panel/Panel'; import { Code } from '@src/repl/components/Code'; import UserFacingErrorMessage from '@src/repl/components/UserFacingErrorMessage'; import { Header } from './Header'; @@ -14,14 +14,17 @@ export default function ReplEditor(Props) { const { containerRef, editorRef, error, init, pending } = context; const settings = useSettings(); const { panelPosition, isZen } = settings; + const isEmbedded = typeof window !== 'undefined' && window.location !== window.parent.location; return (
-
+
+
{!isZen && panelPosition === 'right' && } +
{!isZen && panelPosition === 'bottom' && } diff --git a/website/src/repl/components/panel/Panel.jsx b/website/src/repl/components/panel/Panel.jsx index dcec29bec..fb41c3306 100644 --- a/website/src/repl/components/panel/Panel.jsx +++ b/website/src/repl/components/panel/Panel.jsx @@ -8,7 +8,7 @@ import { SoundsTab } from './SoundsTab'; import { useLogger } from '../useLogger'; import { WelcomeTab } from './WelcomeTab'; import { PatternsTab } from './PatternsTab'; -import { ChevronLeftIcon, XMarkIcon } from '@heroicons/react/16/solid'; +import { Bars3Icon, XMarkIcon } from '@heroicons/react/16/solid'; import ExportTab from './ExportTab'; const TAURI = typeof window !== 'undefined' && window.__TAURI__; @@ -17,7 +17,11 @@ function PanelCloseButton() { const { isPanelOpen } = useSettings(); return ( isPanelOpen && ( - ) @@ -142,7 +146,7 @@ function PanelTab({ label, isSelected, onClick }) { function Tabs({ className }) { const { isPanelOpen, activeFooter: tab } = useSettings(); return ( -
+
{Object.keys(tabNames).map((key) => { const val = tabNames[key]; return setTab(val)} />; @@ -150,3 +154,23 @@ function Tabs({ className }) {
); } + +export function PanelToggle({ isEmbedded, isZen }) { + const { panelPosition, isPanelOpen } = useSettings(); + return ( + !isEmbedded && + !isZen && + panelPosition === 'right' && ( + + ) + ); +}