@@ -7,10 +7,7 @@ module Types.TUI where
7
7
import Brick.BChan (BChan )
8
8
import Brick.Forms (Form )
9
9
import Brick.Widgets.List (GenericList )
10
- import Data.IntMap.Strict (IntMap )
11
- import Data.Map.Strict (Map )
12
- import Data.Sequence (Seq )
13
- import Data.Text (Text )
10
+ import RIO.Time (UTCTime )
14
11
import Database.Persist.Types (Entity )
15
12
import Lens.Micro.TH
16
13
import Model
@@ -22,7 +19,13 @@ data BabelTUI = BabelTUI
22
19
, babelTUIView :: ! BabelView
23
20
, babelTUIChan :: ! (BChan BabelEvent )
24
21
25
- , babelTUIGameState :: ! (Maybe GameState )
22
+ -- Review state
23
+ , babelTUIMatchMode :: ! (Maybe BabelMode )
24
+ , babelTUIActiveCard :: ! (Maybe (Entity Card ))
25
+ , babelTUIUserAnswer :: ! (Maybe Text )
26
+ , babelTUIAnswerDistance :: ! (Maybe Int )
27
+ , babelTUIReviewStartTimestamp :: ! (Maybe UTCTime )
28
+ , babelTUIReviewEndTimestamp :: ! (Maybe UTCTime )
26
29
27
30
, babelTUIFocusX :: ! Int
28
31
-- ^ Left-to-right focus.
@@ -81,28 +84,10 @@ data BabelEvent =
81
84
| LoadTagCards
82
85
83
86
84
- -- TODO: we can't delegate quite as much responsibility to Lua
85
- -- as we thought.
86
- -- - init will have to get a few constants: number of cards
87
- -- to draw, what display mode (once implemented)
88
- -- - state transition will have to be managed by haskell. Lua
89
- -- will provide hooks into it, such as how to compare user
90
- -- input to the card to ascertain correctness
91
- -- - I don't know how to make many types of game possible! thus
92
- -- LUA is on hold until this is hammered out through the
93
- -- built-in modes!
94
87
data BabelMode =
95
88
Standard
96
89
| Reverse
97
90
deriving Show
98
- -- NOTE: Lua scripting is on hold until I learn the requirements
99
- -- of modes of operation in order to better architect the
100
- -- interface
101
- -- | BabelMode
102
- -- { babelModeInitGame :: !(Lua ())
103
- -- , babelModeStateTransition :: !(Lua ())
104
- -- , babelModeDetermineEnd :: !(Lua Bool)
105
- -- }
106
91
107
92
data BabelView =
108
93
Start
@@ -126,24 +111,6 @@ data BabelView =
126
111
| TagManagement
127
112
| Credits
128
113
129
- -- | TODO
130
- data GameState = GameState
131
- { gameStateMode :: ! BabelMode
132
- , gameStateCards :: ! [Maybe (Entity Card )]
133
- -- ^ Cards in play. A @Nothing@ indicates an empty
134
- -- slot for purposes where many cards are shown at
135
- -- once.
136
- , gameStateScore :: ! Int
137
- -- ^ Fun! :D
138
- , gameStateDict :: ! (Map Text Text )
139
- -- ^ A dictionary for more complex scripts to store
140
- -- and retrieve data.
141
- , gameStateUserInputStack :: ! [UserInput ]
142
- -- ^ User input. This will be consulted to determine
143
- -- whether the user answered correctly.
144
- , gameStateMessagesStack :: ! [String ]
145
- }
146
-
147
114
data CardFormState = CardFormState
148
115
{ cardFormStateObverse :: Text
149
116
, cardFormStateReverse :: Text
@@ -158,15 +125,4 @@ data UserInput =
158
125
makeFields ''CardFormState
159
126
makeFields ''CardMetadata
160
127
makeFields ''DeckMetadata
161
- makeFields ''GameState
162
128
makeFields ''BabelTUI
163
-
164
- -- emptyGameState :: GameState
165
- -- emptyGameState = GameState
166
- -- { gameStateMode = Standard
167
- -- , gameStateCards = mempty
168
- -- , gameStateScore = 0
169
- -- , gameStateDict = mempty
170
- -- , gameStateUserInputStack = mempty
171
- -- , gameStateMessagesStack = mempty
172
- -- }
0 commit comments