import { Bars3Icon, PlayIcon, StopIcon, XMarkIcon } from '@heroicons/react/16/solid';
import cx from '@src/cx.mjs';
import { StrudelIcon } from '@src/repl/components/icons/StrudelIcon';
import { useSettings, setIsZen, setIsPanelOpened, setActiveFooter as setTab } from '../../../settings.mjs';
import '../../Repl.css';
import { useLogger } from '../useLogger';
import { ConsoleTab } from './ConsoleTab';
import ExportTab from './ExportTab';
import { FilesTab } from './FilesTab';
import { PatternsTab } from './PatternsTab';
import { Reference } from './Reference';
import { SettingsTab } from './SettingsTab';
import { SoundsTab } from './SoundsTab';
import { WelcomeTab } from './WelcomeTab';
const TAURI = typeof window !== 'undefined' && window.__TAURI__;
const { BASE_URL } = import.meta.env;
const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL;
export function LogoButton({ context, isEmbedded }) {
const { started } = context;
const { isZen, isCSSAnimationDisabled, fontFamily } = useSettings();
return (
{
if (!isEmbedded) {
setIsZen(!isZen);
}
}}
>
);
}
export function MainPanel({ context, isEmbedded = false, className }) {
const { isZen, isButtonRowHidden, fontFamily } = useSettings();
return (
);
}
export function Footer({ context, isEmbedded = false }) {
return (
);
}
function MainMenu({ context, isEmbedded = false, className }) {
const { started, pending, isDirty, activeCode, handleTogglePlay, handleEvaluate, handleShare } = context;
const { isCSSAnimationDisabled } = useSettings();
return (
{!isEmbedded && (
)}
{!isEmbedded && (
learn
)}
);
}
function PanelCloseButton() {
const { isPanelOpen } = useSettings();
return (
isPanelOpen && (
)
);
}
export function BottomPanel({ context }) {
const { isPanelOpen, activeFooter: tab } = useSettings();
return (
{isPanelOpen && (
)}
);
}
export function RightPanel({ context }) {
const settings = useSettings();
const { activeFooter: tab, isPanelOpen } = settings;
if (!isPanelOpen) {
return;
}
return (
);
}
const tabNames = {
welcome: 'intro',
patterns: 'patterns',
sounds: 'sounds',
reference: 'reference',
export: 'export',
console: 'console',
settings: 'settings',
};
if (TAURI) {
tabNames.files = 'files';
}
function PanelNav({ children, className, ...props }) {
const settings = useSettings();
return (
);
}
function PanelContent({ context, tab }) {
useLogger();
switch (tab) {
case tabNames.patterns:
return ;
case tabNames.console:
return ;
case tabNames.sounds:
return ;
case tabNames.reference:
return ;
case tabNames.export:
return ;
case tabNames.settings:
return ;
case tabNames.files:
return ;
default:
return ;
}
}
function PanelTab({ label, isSelected, onClick }) {
return (
<>
>
);
}
function Tabs({ className }) {
const { isPanelOpen, activeFooter: tab } = useSettings();
return (
{Object.keys(tabNames).map((key) => {
const val = tabNames[key];
return
setTab(val)} />;
})}
);
}
export function PanelToggle({ isEmbedded, isZen }) {
const { panelPosition, isPanelOpen } = useSettings();
return (
!isEmbedded &&
!isZen &&
panelPosition === 'right' && (
)
);
}