player selection branch

This commit is contained in:
Jonathan Lamothe 2019-11-01 02:55:43 -04:00
parent 43c2f6191d
commit b19f1386ec
2 changed files with 22 additions and 2 deletions

View File

@ -21,8 +21,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
module Mtlstats.Control.EditPlayer (editPlayer) where
import Lens.Micro ((^.))
import Mtlstats.Types
-- | Dispatcher/controller for the player edit mode
editPlayer :: EditPlayerState -> Controller
editPlayer = undefined
editPlayer eps
| null $ eps^.epsSelectedPlayer = selectPlayerC
| otherwise = undefined
selectPlayerC :: Controller
selectPlayerC = undefined

View File

@ -83,6 +83,8 @@ module Mtlstats.Types (
cgsName,
cgsSuccessCallback,
cgsFailureCallback,
-- ** EditPlayerState Lenses
epsSelectedPlayer,
-- ** Database Lenses
dbPlayers,
dbGoalies,
@ -122,6 +124,7 @@ module Mtlstats.Types (
newGameState,
newCreatePlayerState,
newCreateGoalieState,
newEditPlayerState,
newDatabase,
newPlayer,
newPlayerStats,
@ -301,7 +304,10 @@ data CreateGoalieState = CreateGoalieState
}
-- | Player edit status
data EditPlayerState = EditPlayerState
newtype EditPlayerState = EditPlayerState
{ _epsSelectedPlayer :: Maybe Int
-- ^ The index number of the player being edited
}
-- | Represents the database
data Database = Database
@ -549,6 +555,7 @@ makeLenses ''ProgState
makeLenses ''GameState
makeLenses ''CreatePlayerState
makeLenses ''CreateGoalieState
makeLenses ''EditPlayerState
makeLenses ''Database
makeLenses ''Player
makeLenses ''PlayerStats
@ -631,6 +638,12 @@ newCreateGoalieState = CreateGoalieState
, _cgsFailureCallback = return ()
}
-- | Constructor for an 'EditPlayerState'
newEditPlayerState :: EditPlayerState
newEditPlayerState = EditPlayerState
{ _epsSelectedPlayer = Nothing
}
-- | Constructor for a 'Database'
newDatabase :: Database
newDatabase = Database