fix activeFooter state

This commit is contained in:
Felix Roos 2022-11-13 12:25:30 +01:00
parent 21503c0c38
commit aa76419eda
2 changed files with 7 additions and 3 deletions

View File

@ -107,6 +107,7 @@ export const AppContext = createContext();
function App() { function App() {
const [view, setView] = useState(); // codemirror view const [view, setView] = useState(); // codemirror view
const [lastShared, setLastShared] = useState(); const [lastShared, setLastShared] = useState();
const [activeFooter, setActiveFooter] = useState('console');
const { code, setCode, scheduler, evaluate, activateCode, isDirty, activeCode, pattern, started, stop } = useStrudel({ const { code, setCode, scheduler, evaluate, activateCode, isDirty, activeCode, pattern, started, stop } = useStrudel({
initialCode: '// LOADING', initialCode: '// LOADING',
@ -229,6 +230,8 @@ function App() {
isDirty, isDirty,
lastShared, lastShared,
activeCode, activeCode,
activeFooter,
setActiveFooter,
handleChangeCode, handleChangeCode,
handleTogglePlay, handleTogglePlay,
handleUpdate, handleUpdate,

View File

@ -2,11 +2,12 @@ import XMarkIcon from '@heroicons/react/20/solid/XMarkIcon';
import { logger } from '@strudel.cycles/core'; import { logger } from '@strudel.cycles/core';
import { cx } from '@strudel.cycles/react'; import { cx } from '@strudel.cycles/react';
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
import React, { useCallback, useLayoutEffect, useRef, useState } from 'react'; import React, { useContext, useCallback, useLayoutEffect, useRef, useState } from 'react';
import { useEvent, loadedSamples } from './App'; import { useEvent, loadedSamples, AppContext } from './App';
export function Footer() { export function Footer() {
const [activeFooter, setActiveFooter] = useState('console'); // const [activeFooter, setActiveFooter] = useState('console');
const { activeFooter, setActiveFooter } = useContext(AppContext);
const footerContent = useRef(); const footerContent = useRef();
const [log, setLog] = useState([]); const [log, setLog] = useState([]);