1
1
module App.Widgets.Menu
2
2
( menu ,
3
+ qrButton ,
4
+ linksWidget ,
3
5
)
4
6
where
5
7
6
8
import App.Types
7
9
import qualified App.Widgets.Fav as Fav
8
10
import qualified App.Xlsx as Xlsx
9
- import qualified Functora.Miso.Css as Css
10
11
import qualified Functora.Miso.Jsm as Jsm
11
12
import Functora.Miso.Prelude
12
13
import qualified Functora.Miso.Widgets.BrowserLink as BrowserLink
@@ -181,8 +182,9 @@ menu st =
181
182
in Field. defOpts @ Model @ Action
182
183
& # optsDisabled
183
184
.~ disabled
184
- & # optsPlaceholder
185
- .~ ( " 1 "
185
+ & # optsLabel
186
+ .~ Just
187
+ ( " 1 "
186
188
<> toUpper
187
189
( Money. inspectCurrencyCode
188
190
$ st
@@ -191,7 +193,14 @@ menu st =
191
193
. # currencyOutput
192
194
. # currencyInfoCode
193
195
)
194
- <> " \8776 X "
196
+ <> " \8776 "
197
+ <> inspectRatioDef
198
+ ( st
199
+ ^. # modelState
200
+ . # stExchangeRate
201
+ . # fieldOutput
202
+ )
203
+ <> " "
195
204
<> toUpper
196
205
( Money. inspectCurrencyCode
197
206
$ st
@@ -200,7 +209,7 @@ menu st =
200
209
. # currencyOutput
201
210
. # currencyInfoCode
202
211
)
203
- )
212
+ )
204
213
& ( if disabled
205
214
then # optsTrailingWidget .~ Nothing
206
215
else id
@@ -217,8 +226,8 @@ menu st =
217
226
pushActionQueue st . Instant
218
227
}
219
228
( Field. defOpts
220
- & # optsPlaceholder
221
- .~ (" Merchant fee %" :: Unicode )
229
+ & # optsLabel
230
+ .~ Just (" Merchant fee %" :: Unicode )
222
231
)
223
232
<> Field. textField
224
233
Field. Args
@@ -228,8 +237,8 @@ menu st =
228
237
Field. argsEmitter = pushActionQueue st . Instant
229
238
}
230
239
( Field. defOpts
231
- & # optsPlaceholder
232
- .~ (" Merchant telegram" :: Unicode )
240
+ & # optsLabel
241
+ .~ Just (" Merchant telegram" :: Unicode )
233
242
)
234
243
<> Field. textField
235
244
Field. Args
@@ -239,25 +248,29 @@ menu st =
239
248
Field. argsEmitter = pushActionQueue st . Instant
240
249
}
241
250
( Field. defOpts @ Model @ Action
242
- & # optsPlaceholder
243
- .~ (" QR title" :: Unicode )
251
+ & # optsLabel
252
+ .~ Just (" QR title" :: Unicode )
244
253
)
245
- <> [ button_
246
- [ Css. fullWidth,
247
- onClick
248
- . screen
249
- $ if isQrCode sc
250
- then Main
251
- else QrCode sc
252
- ]
253
- [ text
254
- $ if isQrCode sc
255
- then " Delivery Calculator"
256
- else " QR"
257
- ]
258
- ]
259
- <> linksWidget st
260
254
}
255
+
256
+ qrButton :: Model -> View Action
257
+ qrButton st =
258
+ button_
259
+ [ onClick
260
+ . screen
261
+ $ if isQrCode sc
262
+ then Main
263
+ else QrCode sc
264
+ ]
265
+ [ icon
266
+ $ if isQrCode sc
267
+ then Icon. IconDelivery
268
+ else Icon. IconQr ,
269
+ text
270
+ $ if isQrCode sc
271
+ then " Calculator"
272
+ else " QR"
273
+ ]
261
274
where
262
275
screen next =
263
276
PushUpdate
@@ -272,10 +285,10 @@ menu st =
272
285
linksWidget :: Model -> [View Action ]
273
286
linksWidget st =
274
287
[ button_
275
- [ onClick openWidget,
276
- Css. fullWidth
288
+ [ onClick openWidget
277
289
]
278
- [ text " App"
290
+ [ icon Icon. IconGooglePlay ,
291
+ text " Google Play"
279
292
]
280
293
]
281
294
<> Dialog. dialog
@@ -315,38 +328,32 @@ linksWidget st =
315
328
},
316
329
text " directly." ,
317
330
button_
318
- [ onClick $ openBrowser testGroupLink,
319
- Css. fullWidth
331
+ [ onClick $ openBrowser testGroupLink
320
332
]
321
333
[ text " Join testing (closed beta)"
322
334
],
323
335
button_
324
- [ onClick $ openBrowser googlePlayLink,
325
- Css. fullWidth
336
+ [ onClick $ openBrowser googlePlayLink
326
337
]
327
338
[ text " Google Play (closed beta)"
328
339
],
329
340
button_
330
- [ onClick $ openBrowser apkLink,
331
- Css. fullWidth
341
+ [ onClick $ openBrowser apkLink
332
342
]
333
343
[ text " Download APK"
334
344
],
335
345
button_
336
- [ onClick $ openBrowser sourceLink,
337
- Css. fullWidth
346
+ [ onClick $ openBrowser sourceLink
338
347
]
339
348
[ text " Source"
340
349
],
341
350
button_
342
- [ onClick $ openBrowser functoraLink,
343
- Css. fullWidth
351
+ [ onClick $ openBrowser functoraLink
344
352
]
345
353
[ text " Author"
346
354
],
347
355
button_
348
- [ onClick $ setScreenAction Donate ,
349
- Css. fullWidth
356
+ [ onClick $ setScreenAction Donate
350
357
]
351
358
[ text " Donate"
352
359
]
0 commit comments