floating error message

This commit is contained in:
Felix Roos 2022-11-13 17:11:14 +01:00
parent 45b5b5960f
commit 7ab263b514
3 changed files with 20 additions and 19 deletions

View File

@ -46,6 +46,6 @@ currently broken / buggy:
- [x] scheduler.getPhase is quantized to clock interval
- => draw was choppy + that also caused useHighlighting bugs
- [x] pianoroll keeps rolling when pressing stop
- [ ] find a way to display errors when console is closed / another tab selected
- [x] find a way to display errors when console is closed / another tab selected
- [ ] highlighting out of range error is back (delete large chunk at the top while highlighting below is triggered)
- [ ] idea: interpolate between running and evaluated code!

View File

@ -109,21 +109,22 @@ function App() {
const [isZen, setIsZen] = useState(false);
const [pending, setPending] = useState(false);
const { code, setCode, scheduler, evaluate, activateCode, isDirty, activeCode, pattern, started, stop } = useStrudel({
initialCode: '// LOADING',
defaultOutput: webaudioOutput,
getTime,
autolink: true,
beforeEval: () => {
cleanupUi();
cleanupDraw();
setPending(true);
},
afterEval: () => {
setPending(false);
},
onToggle: (play) => !play && cleanupDraw(false),
});
const { code, setCode, scheduler, evaluate, activateCode, isDirty, activeCode, pattern, started, stop, error } =
useStrudel({
initialCode: '// LOADING',
defaultOutput: webaudioOutput,
getTime,
autolink: true,
beforeEval: () => {
cleanupUi();
cleanupDraw();
setPending(true);
},
afterEval: () => {
setPending(false);
},
onToggle: (play) => !play && cleanupDraw(false),
});
// init code
useEffect(() => {
@ -264,6 +265,9 @@ function App() {
}}
/>
</section>
{error && (
<div className="text-red-500 p-4 bg-lineblack animate-pulse">{error.message || 'Unknown Error :-/'}</div>
)}
<Footer />
</div>
</AppContext.Provider>

View File

@ -30,9 +30,6 @@ export function Footer() {
useLogger(
useCallback((e) => {
const { message, type, data } = e.detail;
if (type === 'error') {
setActiveFooter('console');
}
setLog((l) => {
const lastLog = l.length ? l[l.length - 1] : undefined;
const id = nanoid(12);