diff --git a/website/src/components/Header/Header.astro b/website/src/components/Header/Header.astro index c3b1b9c3..e9626677 100644 --- a/website/src/components/Header/Header.astro +++ b/website/src/components/Header/Header.astro @@ -28,11 +28,10 @@ const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL

- 🌀 +
strudel - DOCS - REPL + DOCS

diff --git a/website/src/repl/components/Header.jsx b/website/src/repl/components/Header.jsx index 2789e4a1..2e8b3094 100644 --- a/website/src/repl/components/Header.jsx +++ b/website/src/repl/components/Header.jsx @@ -1,8 +1,4 @@ -import AcademicCapIcon from '@heroicons/react/20/solid/AcademicCapIcon'; -import ArrowPathIcon from '@heroicons/react/20/solid/ArrowPathIcon'; -import LinkIcon from '@heroicons/react/20/solid/LinkIcon'; import PlayCircleIcon from '@heroicons/react/20/solid/PlayCircleIcon'; -import SparklesIcon from '@heroicons/react/20/solid/SparklesIcon'; import StopCircleIcon from '@heroicons/react/20/solid/StopCircleIcon'; import cx from '@src/cx.mjs'; import { useSettings, setIsZen } from '../../settings.mjs'; @@ -21,7 +17,7 @@ export function Header({ context, embedded = false }) {
{!isZen && ( -
+
strudel - REPL - {!isEmbedded && ( - + REPL + {!isEmbedded && isButtonRowHidden && ( + DOCS )} @@ -66,7 +62,7 @@ export function Header({ context, embedded = false }) {
{!isZen && !isButtonRowHidden && ( -
+
{!isEmbedded && ( @@ -104,7 +98,6 @@ export function Header({ context, embedded = false }) { className="hover:opacity-50 p-2 flex items-center space-x-1" onClick={handleShuffle} > - shuffle )} @@ -117,7 +110,6 @@ export function Header({ context, embedded = false }) { )} onClick={handleShare} > - share )} @@ -127,7 +119,6 @@ export function Header({ context, embedded = false }) { href={`${baseNoTrailing}/workshop/getting-started/`} className={cx('hover:opacity-50 flex items-center space-x-1', !isEmbedded ? 'p-2' : 'px-2')} > - learn )} diff --git a/website/src/repl/components/panel/ConsoleTab.jsx b/website/src/repl/components/panel/ConsoleTab.jsx index f0fca584..b02227b9 100644 --- a/website/src/repl/components/panel/ConsoleTab.jsx +++ b/website/src/repl/components/panel/ConsoleTab.jsx @@ -1,18 +1,48 @@ +import { logger } from '@strudel/core'; +import useEvent from '@src/useEvent.mjs'; import cx from '@src/cx.mjs'; +import { nanoid } from 'nanoid'; +import { useCallback, useState } from 'react'; +import { useSettings } from '../../../settings.mjs'; -export function ConsoleTab({ log }) { +export function ConsoleTab() { + const [log, setLog] = useState([]); + const { fontFamily, fontSize } = useSettings(); + useLogger( + useCallback((e) => { + const { message, type, data } = e.detail; + setLog((l) => { + const lastLog = l.length ? l[l.length - 1] : undefined; + const id = nanoid(12); + // if (type === 'loaded-sample' && lastLog.type === 'load-sample' && lastLog.url === data.url) { + if (type === 'loaded-sample') { + // const loadIndex = l.length - 1; + const loadIndex = l.findIndex(({ data: { url }, type }) => type === 'load-sample' && url === data.url); + l[loadIndex] = { message, type, id, data }; + } else if (lastLog && lastLog.message === message) { + l = l.slice(0, -1).concat([{ message, type, count: (lastLog.count ?? 1) + 1, id, data }]); + } else { + l = l.concat([{ message, type, id, data }]); + } + return l.slice(-20); + }); + }, []), + ); return ( -
- +
{log.map((l, i) => { const message = linkify(l.message); + const color = l.data?.hap?.value?.color; return ( -
+
{l.count ? ` (${l.count})` : ''}
@@ -42,3 +72,7 @@ function linkify(inputText) { return replacedText; } + +function useLogger(onTrigger) { + useEvent(logger.key, onTrigger); +} diff --git a/website/src/repl/components/panel/Panel.jsx b/website/src/repl/components/panel/Panel.jsx index 57cd26c0..81fcacf7 100644 --- a/website/src/repl/components/panel/Panel.jsx +++ b/website/src/repl/components/panel/Panel.jsx @@ -1,8 +1,4 @@ -import { logger } from '@strudel/core'; -import useEvent from '@src/useEvent.mjs'; import cx from '@src/cx.mjs'; -import { nanoid } from 'nanoid'; -import { useCallback, useState } from 'react'; import { setPanelPinned, setActiveFooter as setTab, setIsPanelOpened, useSettings } from '../../../settings.mjs'; import { ConsoleTab } from './ConsoleTab'; import { FilesTab } from './FilesTab'; @@ -119,33 +115,11 @@ function PanelNav({ children, className, settings, ...props }) { } function PanelContent({ context, tab }) { - const [log, setLog] = useState([]); - useLogger( - useCallback((e) => { - const { message, type, data } = e.detail; - setLog((l) => { - const lastLog = l.length ? l[l.length - 1] : undefined; - const id = nanoid(12); - // if (type === 'loaded-sample' && lastLog.type === 'load-sample' && lastLog.url === data.url) { - if (type === 'loaded-sample') { - // const loadIndex = l.length - 1; - const loadIndex = l.findIndex(({ data: { url }, type }) => type === 'load-sample' && url === data.url); - l[loadIndex] = { message, type, id, data }; - } else if (lastLog && lastLog.message === message) { - l = l.slice(0, -1).concat([{ message, type, count: (lastLog.count ?? 1) + 1, id, data }]); - } else { - l = l.concat([{ message, type, id, data }]); - } - return l.slice(-20); - }); - }, []), - ); - switch (tab) { case tabNames.patterns: return ; case tabNames.console: - return ; + return ; case tabNames.sounds: return ; case tabNames.reference: @@ -236,7 +210,3 @@ function CloseButton({ onClick }) { ); } - -function useLogger(onTrigger) { - useEvent(logger.key, onTrigger); -} diff --git a/website/src/repl/components/panel/WelcomeTab.jsx b/website/src/repl/components/panel/WelcomeTab.jsx index b7d45bfd..3e77e71b 100644 --- a/website/src/repl/components/panel/WelcomeTab.jsx +++ b/website/src/repl/components/panel/WelcomeTab.jsx @@ -6,9 +6,7 @@ const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL export function WelcomeTab({ context }) { return (
-

- 🌀 welcome -

+

꩜ welcome

You have found strudel, a new live coding platform to write dynamic music pieces in the browser! It is free and open-source and made for beginners and experts alike. To get started: @@ -30,7 +28,7 @@ export function WelcomeTab({ context }) { {' '} to ask any questions, give feedback or just say hello.

-

about

+

꩜ about

strudel is a JavaScript version of{' '}