diff --git a/src/App.css b/src/App.css index 4fb124e..8adee32 100644 --- a/src/App.css +++ b/src/App.css @@ -101,7 +101,7 @@ sl-button:hover>sl-icon { .preset-select::part(form-control-label) { color: white; font-weight: bold; - font-size: 18px; + font-size: calc(10px + 2vmin); } .preset-select::part(display-input) { @@ -305,6 +305,10 @@ sl-select::part(base) { background-color: var(--sl-color-emerald-500); } +.melody-tab::part(base) { + background-color: var(--sl-color-teal-500); +} + sl-tab[active]::part(base) { font-weight: bolder; text-decoration: underline; @@ -317,7 +321,7 @@ sl-tab[active]::part(base) { /* width: 100%; */ flex: auto auto; flex-direction: row; - padding: 16px; + /* padding: 12px; */ align-items: center; } @@ -325,7 +329,7 @@ sl-tab[active]::part(base) { flex-direction: column; display: flex; align-items: center; - padding: 16px; + padding: 12px; } .step-header { diff --git a/src/components/AllSteps.tsx b/src/components/AllSteps.tsx index 751dd01..9964ab0 100644 --- a/src/components/AllSteps.tsx +++ b/src/components/AllSteps.tsx @@ -86,7 +86,7 @@ const parseArpPatternParam = (param: string | null) => { export const AllSteps = () => { const urlParams = new URLSearchParams(window.location.search); - const { isStarted, step, areDrumsEnabled, areChordsEnabled } = useContext(WorkflowContext) + const { isStarted, step, areDrumsEnabled, areChordsEnabled, isMelodyEnabled } = useContext(WorkflowContext) const dispatch = useContext(WorkflowDispatchContext) const [title, setTitle] = React.useState(urlParams.get('title') || '') const [tempo, setTempo] = React.useState(Number.parseInt(urlParams.get('tempo') || `${DEFAULT_TEMPO}`) ?? DEFAULT_TEMPO) @@ -180,6 +180,15 @@ export const AllSteps = () => { >3: Chords + isMelodyEnabled && dispatch?.({ type: "setStep", step: WorkflowStep.MELODY })} + + >4: Sing + diff --git a/src/components/ChordStep.tsx b/src/components/ChordStep.tsx index 6a6cc13..67afaec 100644 --- a/src/components/ChordStep.tsx +++ b/src/components/ChordStep.tsx @@ -6,6 +6,9 @@ import { ArpPattern, ChordPattern } from "../utils/chordPatterns" import { OctoStage } from "./canvas/OctoStage" import { ChordPatternSelector } from "./ChordPatternSelector"; import { ArpPatternSelector } from "./ArpPatternSelector"; +import { WorkflowDispatchContext } from "./WorkflowContext"; +import { useContext } from "react"; +import { WorkflowStep } from "../utils/workflow"; type ChordStepProps = { title: string @@ -20,10 +23,26 @@ type ChordStepProps = { } export const ChordStep = ({ title, chordList, setChordList, chordPattern, setChordPattern, arpPattern, setArpPattern, useSeventh, setUseSeventh }: ChordStepProps) => { + const dispatch = useContext(WorkflowDispatchContext) + return (
- -

Step 3: Chords

+
+ { + dispatch?.({ + type: 'setStep', + step: WorkflowStep.DRUMS + }) + }}> + 🥁 Drums + +

+ Step 3: Chords +

+
  • @@ -41,7 +60,7 @@ export const ChordStep = ({ title, chordList, setChordList, chordPattern, setCho
-

Song: {title}

+

Song: {title}

{ const { drumPreset, setDrumPreset, title, tempo, setTempo } = props - + const [isPlaying, setIsPlaying] = useState(true) const dispatch = useContext(WorkflowDispatchContext) return (
-

- ✨Help the Octopus Make A New Song✨ -

Step 2: Rhythm

-

Song: {title}

-
+

Song: {title}

+ {/*
*/} + { + const transport = getTransport() + if (transport.state === 'started') { + setIsPlaying(false) + transport.pause() + } else { + setIsPlaying(true) + transport.start() + } + }} / + > + {/*
*/} +
{/*
*/}
diff --git a/src/components/PlayButton.tsx b/src/components/PlayButton.tsx index 172181e..8c3d1d0 100644 --- a/src/components/PlayButton.tsx +++ b/src/components/PlayButton.tsx @@ -11,12 +11,13 @@ type Props = { const PB = (props: Props) => { const { isPlaying, onClick } = props - return
- + return ( + {isPlaying ? : } {isPlaying ? `Pause` : `Play`} -
+ ) + //
} diff --git a/src/components/WorkflowContext.tsx b/src/components/WorkflowContext.tsx index 412da10..973d9fa 100644 --- a/src/components/WorkflowContext.tsx +++ b/src/components/WorkflowContext.tsx @@ -5,7 +5,8 @@ const initialWorkflow: Workflow = { step: WorkflowStep.NEW_SONG, isStarted: false, areDrumsEnabled: false, - areChordsEnabled: false + areChordsEnabled: false, + isMelodyEnabled: false, } export const WorkflowContext = createContext(initialWorkflow); @@ -17,10 +18,12 @@ function workflowReducer(workflow: Workflow, action: WorkflowAction) { case "setStep": { const areDrumsEnabled = action.step === WorkflowStep.DRUMS ? true : workflow.areDrumsEnabled const areChordsEnabled = action.step === WorkflowStep.CHORDS ? true : workflow.areChordsEnabled + const isMelodyEnabled = action.step === WorkflowStep.MELODY ? true : workflow.isMelodyEnabled return { ...workflow, areDrumsEnabled, areChordsEnabled, + isMelodyEnabled, step: action.step, } } @@ -36,6 +39,7 @@ type Workflow = { isStarted: boolean areDrumsEnabled: boolean areChordsEnabled: boolean + isMelodyEnabled: boolean } type WorkflowAction = { diff --git a/src/components/canvas/PlayPause.tsx b/src/components/canvas/PlayPause.tsx index 6e3d113..bce04f4 100644 --- a/src/components/canvas/PlayPause.tsx +++ b/src/components/canvas/PlayPause.tsx @@ -52,7 +52,7 @@ export const PlayPause = () => { } }} style={{ - fontSize: 32, + fontSize: 48, stroke: '#ffffff', fill: iconFill, // fill: iconFill, diff --git a/src/utils/workflow.ts b/src/utils/workflow.ts index 0a7078a..85a8658 100644 --- a/src/utils/workflow.ts +++ b/src/utils/workflow.ts @@ -1,5 +1,6 @@ export enum WorkflowStep { NEW_SONG, DRUMS, - CHORDS + CHORDS, + MELODY, }