-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from stagas/help
feat: add help modal
- Loading branch information
Showing
7 changed files
with
167 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { getAllProps, getAllPropsDetailed, getAllPropsReverse } from 'dsp' | ||
import { H3 } from 'ui' | ||
import { keys } from 'utils' | ||
import { dspGens } from '~/generated/typescript/dsp-gens.ts' | ||
|
||
const HIDDEN_PROPS = new Set<any>([ | ||
'gain', | ||
]) | ||
const AUDIO_PROPS = new Set<any>([ | ||
'in', | ||
'sidechain', | ||
]) | ||
const STACK_PROPS = new Set<any>([ | ||
'in', | ||
]) | ||
const HIDDEN_GENS = new Set<any>([ | ||
'gen', | ||
'osc', | ||
'biquad', | ||
'moog', | ||
'svf', | ||
'dcc', | ||
'dcfix', | ||
]) | ||
|
||
const OPERATORS = { | ||
'=': { name: 'assign', kind: 'binary' }, | ||
'?': { name: 'pick', kind: 'binary' }, | ||
'+': { name: 'add', kind: 'binary' }, | ||
'-': { name: 'subtract', kind: 'binary' }, | ||
'*': { name: 'multiply', kind: 'binary' }, | ||
'/': { name: 'divide', kind: 'binary' }, | ||
'%': { name: 'modulo', kind: 'binary' }, | ||
'^': { name: 'power', kind: 'binary' }, | ||
} | ||
|
||
export function Help() { | ||
return <div class="h-[80dvh]"> | ||
<div class="flex flex-col flex-wrap gap-4"> | ||
<H3>Gens</H3> | ||
<div class="h-[50dvh] flex flex-col flex-wrap gap-4"> | ||
{keys(dspGens).filter(name => !HIDDEN_GENS.has(name)).map(name => { | ||
const props = getAllProps(name) | ||
return <div> | ||
<span class="text-neutral-200">{name}</span> | ||
<div class="w-20 flex flex-row flex-wrap gap-1"> | ||
{props.filter(name => !HIDDEN_PROPS.has(name)).map(name => | ||
<span class="text-xs leading-none">{name}</span> | ||
)} | ||
</div> | ||
</div> | ||
})} | ||
</div> | ||
</div> | ||
<div class="flex flex-col flex-wrap gap-4"> | ||
<H3>Ops</H3> | ||
<div class="h-[15dvh] flex flex-col flex-wrap"> | ||
{keys(OPERATORS).map(id => { | ||
const { name, kind } = OPERATORS[id] | ||
return <div class="flex flex-row flex-nowrap items-center gap-1"> | ||
<span class="text-neutral-200">{id}</span> | ||
<span class="">{name}</span> | ||
</div> | ||
})} | ||
</div> | ||
</div> | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { $ } from 'sigui' | ||
import { Help } from '~/src/comp/Help.tsx' | ||
import { state } from '~/src/state.ts' | ||
|
||
export function showHelpModal() { | ||
state.modalIsCancelled = false | ||
|
||
const off = $.fx(() => { | ||
const { modalIsCancelled } = state | ||
if (modalIsCancelled) { | ||
off() | ||
return | ||
} | ||
const { user } = state | ||
$() | ||
if (user == null) { | ||
state.modal = <Help /> | ||
state.modalIsOpen = true | ||
state.modalIsCancelled = false | ||
} | ||
else { | ||
state.modal = null | ||
state.modalIsOpen = false | ||
queueMicrotask(() => off()) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters