@@ -9,11 +9,14 @@ import qualified Functora.Miso.Css as Css
9
9
import qualified Functora.Miso.Jsm as Jsm
10
10
import Functora.Miso.Prelude
11
11
import qualified Functora.Miso.Widgets.BrowserLink as BrowserLink
12
+ import qualified Functora.Miso.Widgets.Currency as Currency
12
13
import qualified Functora.Miso.Widgets.Field as Field
13
14
import qualified Functora.Miso.Widgets.Grid as Grid
14
15
import qualified Material.Button as Button
15
16
import qualified Material.Dialog as Dialog
16
17
import qualified Material.IconButton as IconButton
18
+ import qualified Material.Select as Select
19
+ import qualified Material.Select.Item as SelectItem
17
20
import qualified Material.Theme as Theme
18
21
import qualified Material.TopAppBar as TopAppBar
19
22
import qualified Text.URI as URI
@@ -114,44 +117,69 @@ menu st =
114
117
Nothing
115
118
[ Grid. grid
116
119
mempty
117
- $ [ Grid. mediumCell
118
- [ Button. raised
119
- ( Button. config
120
- & Button. setOnClick
121
- ( screen
122
- $ if isQrCode sc
123
- then Main
124
- else QrCode sc
120
+ $ [ Currency. selectCurrency
121
+ Currency. Args
122
+ { Currency. argsModel = st,
123
+ Currency. argsOptic =
124
+ # modelState . # stDefAssetCurrency,
125
+ Currency. argsAction =
126
+ PushUpdate . Instant ,
127
+ Currency. argsCurrencies =
128
+ # modelCurrencies
129
+ }
130
+ Currency. Opts
131
+ { Currency. optsExtraOnClick = (& # modelLoading .~ True )
132
+ },
133
+ Currency. selectCurrency
134
+ Currency. Args
135
+ { Currency. argsModel = st,
136
+ Currency. argsOptic =
137
+ # modelState . # stPaymentMoney . # moneyCurrency,
138
+ Currency. argsAction =
139
+ PushUpdate . Instant ,
140
+ Currency. argsCurrencies =
141
+ # modelCurrencies
142
+ }
143
+ Currency. Opts
144
+ { Currency. optsExtraOnClick = (& # modelLoading .~ True )
145
+ },
146
+ let item :| items = enumerateNE @ OnlineOrOffline
147
+ in Grid. mediumCell
148
+ [ Select. outlined
149
+ ( Select. config
150
+ & Select. setLabel
151
+ ( Just " Exchange rate"
152
+ )
153
+ & Select. setSelected
154
+ ( Just
155
+ $ st
156
+ ^. # modelState
157
+ . # stOnlineOrOffline
158
+ )
159
+ & Select. setOnChange
160
+ ( \ x ->
161
+ PushUpdate
162
+ . Instant
163
+ $ pure
164
+ . ( &
165
+ # modelState
166
+ . # stOnlineOrOffline
167
+ .~ x
168
+ )
169
+ )
170
+ )
171
+ ( SelectItem. selectItem
172
+ (SelectItem. config item)
173
+ [text $ inspect item]
174
+ )
175
+ $ fmap
176
+ ( \ x ->
177
+ SelectItem. selectItem
178
+ (SelectItem. config x)
179
+ [text $ inspect x]
125
180
)
126
- & Button. setIcon
127
- ( Just
128
- $ if isQrCode sc
129
- then " local_shipping"
130
- else " qr_code_2"
131
- )
132
- & Button. setAttributes
133
- [ Theme. secondaryBg,
134
- Css. fullWidth
135
- ]
136
- )
137
- $ if isQrCode sc
138
- then " Delivery Calculator"
139
- else " QR"
140
- ],
141
- Grid. mediumCell
142
- [ Field. textField
143
- Field. Args
144
- { Field. argsModel = st,
145
- Field. argsOptic = # modelState . # stPreview,
146
- Field. argsAction = PushUpdate . Instant
147
- }
148
- ( Field. defOpts @ Model @ Action
149
- & # optsPlaceholder
150
- .~ (" QR title" :: Unicode )
151
- & # optsFilledOrOutlined
152
- .~ Outlined
153
- )
154
- ],
181
+ items
182
+ ],
155
183
Grid. mediumCell
156
184
[ Field. ratioField
157
185
Field. Args
@@ -181,6 +209,44 @@ menu st =
181
209
& # optsFilledOrOutlined
182
210
.~ Outlined
183
211
)
212
+ ],
213
+ Grid. mediumCell
214
+ [ Field. textField
215
+ Field. Args
216
+ { Field. argsModel = st,
217
+ Field. argsOptic = # modelState . # stPreview,
218
+ Field. argsAction = PushUpdate . Instant
219
+ }
220
+ ( Field. defOpts @ Model @ Action
221
+ & # optsPlaceholder
222
+ .~ (" QR title" :: Unicode )
223
+ & # optsFilledOrOutlined
224
+ .~ Outlined
225
+ )
226
+ ],
227
+ Grid. mediumCell
228
+ [ Button. raised
229
+ ( Button. config
230
+ & Button. setOnClick
231
+ ( screen
232
+ $ if isQrCode sc
233
+ then Main
234
+ else QrCode sc
235
+ )
236
+ & Button. setIcon
237
+ ( Just
238
+ $ if isQrCode sc
239
+ then " local_shipping"
240
+ else " qr_code_2"
241
+ )
242
+ & Button. setAttributes
243
+ [ Theme. secondaryBg,
244
+ Css. fullWidth
245
+ ]
246
+ )
247
+ $ if isQrCode sc
248
+ then " Delivery Calculator"
249
+ else " QR"
184
250
]
185
251
]
186
252
<> linksWidget st
@@ -238,7 +304,10 @@ linksWidget st =
238
304
( Button. config
239
305
& Button. setOnClick openWidget
240
306
& Button. setIcon (Just " android" )
241
- & Button. setAttributes [Css. fullWidth]
307
+ & Button. setAttributes
308
+ [ Css. fullWidth,
309
+ Theme. secondaryBg
310
+ ]
242
311
)
243
312
" App"
244
313
]
0 commit comments