Simplify preferences
I'd like to deploy an MVP version of this application today, so I'm dropping support for a few features to focus my efforts. I may bring these features back. TL;DR: - Temporarily drop support for "Fine Tune" tab of preferences - Sort keys by the Circle of Fifths
This commit is contained in:
parent
5ca0fa2fcd
commit
bdb16c11ba
1 changed files with 40 additions and 32 deletions
|
@ -126,7 +126,7 @@ init =
|
||||||
, tempo = 30
|
, tempo = 30
|
||||||
, firstNote = firstNote
|
, firstNote = firstNote
|
||||||
, lastNote = lastNote
|
, lastNote = lastNote
|
||||||
, view = Practice
|
, view = Preferences
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ update msg model =
|
||||||
SetView x ->
|
SetView x ->
|
||||||
( { model
|
( { model
|
||||||
| view = x
|
| view = x
|
||||||
|
, isPaused = True
|
||||||
}
|
}
|
||||||
, Cmd.none
|
, Cmd.none
|
||||||
)
|
)
|
||||||
|
@ -368,53 +369,61 @@ inversionCheckboxes inversions =
|
||||||
selectKey :
|
selectKey :
|
||||||
Model
|
Model
|
||||||
->
|
->
|
||||||
{ pitchClass : Theory.PitchClass
|
{ relativeMajor : Theory.Key
|
||||||
, majorKey : Theory.Key
|
, relativeMinor : Theory.Key
|
||||||
, minorKey : Theory.Key
|
|
||||||
, bluesKey : Theory.Key
|
|
||||||
}
|
}
|
||||||
-> Html Msg
|
-> Html Msg
|
||||||
selectKey model { pitchClass, majorKey, minorKey, bluesKey } =
|
selectKey model { relativeMajor, relativeMinor } =
|
||||||
let
|
let
|
||||||
active key =
|
active key =
|
||||||
List.member key model.whitelistedKeys
|
List.member key model.whitelistedKeys
|
||||||
|
|
||||||
|
buttonLabel major minor =
|
||||||
|
Theory.viewKey major ++ ", " ++ Theory.viewKey minor
|
||||||
in
|
in
|
||||||
div [ class "flex pt-0" ]
|
div [ class "flex pt-0" ]
|
||||||
[ p [ class "text-gray-500 text-center text-5xl flex-1 py-10" ] [ text (Theory.viewPitchClass pitchClass) ]
|
[ UI.textToggleButton
|
||||||
, UI.textToggleButton
|
{ label = buttonLabel relativeMajor relativeMinor
|
||||||
{ label = "major"
|
, handleClick = ToggleKey relativeMinor
|
||||||
, handleClick = ToggleKey majorKey
|
|
||||||
, classes = [ "flex-1" ]
|
, classes = [ "flex-1" ]
|
||||||
, toggled = active majorKey
|
, toggled = active relativeMinor
|
||||||
}
|
|
||||||
, UI.textToggleButton
|
|
||||||
{ label = "minor"
|
|
||||||
, handleClick = ToggleKey minorKey
|
|
||||||
, classes = [ "flex-1" ]
|
|
||||||
, toggled = active minorKey
|
|
||||||
}
|
|
||||||
, UI.textToggleButton
|
|
||||||
{ label = "blues"
|
|
||||||
, handleClick = ToggleKey bluesKey
|
|
||||||
, classes = [ "flex-1" ]
|
|
||||||
, toggled = active bluesKey
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
keyCheckboxes : Model -> Html Msg
|
keyCheckboxes : Model -> Html Msg
|
||||||
keyCheckboxes model =
|
keyCheckboxes model =
|
||||||
|
let
|
||||||
|
majorKey pitchClass =
|
||||||
|
{ pitchClass = pitchClass, mode = Theory.MajorMode }
|
||||||
|
|
||||||
|
minorKey pitchClass =
|
||||||
|
{ pitchClass = pitchClass, mode = Theory.MinorMode }
|
||||||
|
|
||||||
|
circleOfFifths =
|
||||||
|
[ ( Theory.C, Theory.A )
|
||||||
|
, ( Theory.G, Theory.E )
|
||||||
|
, ( Theory.D, Theory.B )
|
||||||
|
, ( Theory.A, Theory.F_sharp )
|
||||||
|
, ( Theory.E, Theory.C_sharp )
|
||||||
|
, ( Theory.B, Theory.G_sharp )
|
||||||
|
, ( Theory.F_sharp, Theory.D_sharp )
|
||||||
|
, ( Theory.C_sharp, Theory.A_sharp )
|
||||||
|
, ( Theory.G_sharp, Theory.F )
|
||||||
|
, ( Theory.D_sharp, Theory.C )
|
||||||
|
, ( Theory.A_sharp, Theory.G )
|
||||||
|
, ( Theory.F, Theory.D )
|
||||||
|
]
|
||||||
|
in
|
||||||
div []
|
div []
|
||||||
[ h2 [ class "text-center py-10 text-5xl" ] [ text "Select Keys" ]
|
[ h2 [ class "text-gray-500 text-center pt-10 text-5xl" ] [ text "Select keys" ]
|
||||||
, ul []
|
, ul []
|
||||||
(Theory.allPitchClasses
|
(circleOfFifths
|
||||||
|> List.map
|
|> List.map
|
||||||
(\pitchClass ->
|
(\( major, minor ) ->
|
||||||
selectKey model
|
selectKey model
|
||||||
{ pitchClass = pitchClass
|
{ relativeMajor = majorKey major
|
||||||
, majorKey = { pitchClass = pitchClass, mode = Theory.MajorMode }
|
, relativeMinor = minorKey minor
|
||||||
, minorKey = { pitchClass = pitchClass, mode = Theory.MinorMode }
|
|
||||||
, bluesKey = { pitchClass = pitchClass, mode = Theory.BluesMode }
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -478,7 +487,6 @@ preferences model =
|
||||||
{ tempo = model.tempo
|
{ tempo = model.tempo
|
||||||
, handleInput = SetTempo
|
, handleInput = SetTempo
|
||||||
}
|
}
|
||||||
, practiceModeButtons model
|
|
||||||
, case model.practiceMode of
|
, case model.practiceMode of
|
||||||
KeyMode ->
|
KeyMode ->
|
||||||
keyCheckboxes model
|
keyCheckboxes model
|
||||||
|
@ -505,7 +513,7 @@ practice model =
|
||||||
|
|
||||||
( handleClick, extraClasses, buttonText ) =
|
( handleClick, extraClasses, buttonText ) =
|
||||||
if model.isPaused then
|
if model.isPaused then
|
||||||
( Play, [ "opacity-50" ], "Press to resume" )
|
( Play, [ "opacity-50" ], "Press to practice" )
|
||||||
|
|
||||||
else
|
else
|
||||||
( Pause, [ "opacity-0" ], "" )
|
( Pause, [ "opacity-0" ], "" )
|
||||||
|
|
Loading…
Reference in a new issue