diff --git a/website/src/repl/Header.jsx b/website/src/repl/Header.jsx index 5e991f8a..b6f13060 100644 --- a/website/src/repl/Header.jsx +++ b/website/src/repl/Header.jsx @@ -87,7 +87,7 @@ export function Header({ context }) { )} + )} + + {!isExample && ( + + )} + + + )} +
+ {Object.entries(userPatterns).map(([key, up]) => ( + { + const { code } = up; + setActivePattern(key); + context.handleUpdate(code, true); + }} + > + {key} + + ))} +
+
- - - -
- {Object.entries(userPatterns).map(([key, up]) => ( - + { + const files = Array.from(e.target.files); + await Promise.all( + files.map(async (file, i) => { + const content = await file.text(); + if (file.type === 'application/json') { + const userPatterns = getUserPatterns() || {}; + setUserPatterns({ ...userPatterns, ...JSON.parse(content) }); + } else if (file.type === 'text/plain') { + const name = file.name.replace(/\.[^/.]+$/, ''); + addUserPattern(name, { code: content }); + } + }), + ); + logger(`import done!`); + }} + /> + import + + +

Examples

- {Object.entries(tunes).map(([key, tune]) => ( - { - setActivePattern(key); - context.handleUpdate(tune); - }} - > - {key} - - ))} +
+ {Object.entries(tunes).map(([key, tune]) => ( + { + setActivePattern(key); + context.handleUpdate(tune, true); + }} + > + {key} + + ))} +
); } - -/* -selectable examples -if example selected - type character -> create new user pattern with exampleName_n - even if -clicking (+) opens the "new" example with same behavior as above -*/ diff --git a/website/src/repl/panel/SoundsTab.jsx b/website/src/repl/panel/SoundsTab.jsx index aeda4f6d..fe32212d 100644 --- a/website/src/repl/panel/SoundsTab.jsx +++ b/website/src/repl/panel/SoundsTab.jsx @@ -42,8 +42,8 @@ export function SoundsTab() { }); }); return ( -
-
+
+
settingsMap.setKey('soundsFilter', value)} @@ -55,7 +55,7 @@ export function SoundsTab() { }} >
-
+
{soundEntries.map(([name, { data, onTrigger }]) => (