File tree Expand file tree Collapse file tree 7 files changed +66
-18
lines changed
miso-functora/src/Functora/Miso/Widgets Expand file tree Collapse file tree 7 files changed +66
-18
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,9 @@ common pkg
19
19
App.I18n
20
20
App.Jsm
21
21
App.Types
22
- App.Widgets.AppLinks
23
22
App.Widgets.Asset
23
+ App.Widgets.Donate
24
+ App.Widgets.GooglePlay
24
25
App.Widgets.Main
25
26
App.Widgets.MarketLinks
26
27
App.Widgets.Menu
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ import qualified Text.URI as URI
64
64
data Model = Model
65
65
{ modelSink :: MVar (Action -> IO () ),
66
66
modelMenu :: OpenedOrClosed ,
67
+ modelDonate :: OpenedOrClosed ,
67
68
modelAppLinks :: OpenedOrClosed ,
68
69
modelShareApp :: OpenedOrClosed ,
69
70
modelPlaceOrder :: OpenedOrClosed ,
Original file line number Diff line number Diff line change
1
+ module App.Widgets.Donate (donate ) where
2
+
3
+ import App.Types
4
+ import Functora.Miso.Prelude
5
+ import qualified Functora.Miso.Widgets.Dialog as Dialog
6
+ import qualified Functora.Miso.Widgets.FieldPairs as FieldPairs
7
+ import qualified Functora.Miso.Widgets.Icon as Icon
8
+
9
+ donate :: Model -> [View Action ]
10
+ donate st =
11
+ if not . null $ st ^. # modelState . # stAssets
12
+ then mempty
13
+ else
14
+ ( button_
15
+ [ onClick openWidget
16
+ ]
17
+ [ icon Icon. IconBitcoin ,
18
+ text " Donate"
19
+ ]
20
+ )
21
+ : Dialog. dialog
22
+ ( Dialog. defOpts
23
+ & # optsTitle
24
+ .~ Just (" Donate" :: Unicode )
25
+ & # optsFlexCol
26
+ .~ False
27
+ & # optsTitleIcon
28
+ .~ Just Icon. IconBitcoin
29
+ )
30
+ Dialog. Args
31
+ { Dialog. argsModel = st,
32
+ Dialog. argsOptic = # modelDonate,
33
+ Dialog. argsAction = PushUpdate ,
34
+ Dialog. argsContent =
35
+ FieldPairs. fieldPairsViewer
36
+ FieldPairs. defOpts
37
+ FieldPairs. Args
38
+ { FieldPairs. argsModel = st,
39
+ FieldPairs. argsOptic = # modelDonateViewer,
40
+ FieldPairs. argsAction = PushUpdate ,
41
+ FieldPairs. argsEmitter = emitter st
42
+ }
43
+ }
44
+ where
45
+ openWidget =
46
+ PushUpdate
47
+ . PureUpdate
48
+ $ # modelDonate
49
+ .~ Opened
Original file line number Diff line number Diff line change 1
- module App.Widgets.AppLinks ( appLinks ) where
1
+ module App.Widgets.GooglePlay ( googlePlay ) where
2
2
3
3
import App.Types
4
+ import qualified App.Widgets.Donate as Donate
4
5
import qualified Functora.Miso.Jsm as Jsm
5
6
import Functora.Miso.Prelude
6
7
import qualified Functora.Miso.Widgets.BrowserLink as BrowserLink
7
8
import qualified Functora.Miso.Widgets.Dialog as Dialog
8
9
import qualified Functora.Miso.Widgets.Icon as Icon
9
10
10
- appLinks :: Model -> [View Action ]
11
- appLinks st =
11
+ googlePlay :: Model -> [View Action ]
12
+ googlePlay st =
12
13
if not . null $ st ^. # modelState . # stAssets
13
14
then mempty
14
15
else
@@ -91,14 +92,9 @@ appLinks st =
91
92
]
92
93
[ icon Icon. IconUser ,
93
94
text " Author"
94
- ],
95
- button_
96
- [ onClick $ setScreenAction Donate
97
- ]
98
- [ icon Icon. IconBitcoin ,
99
- text " Donate"
100
95
]
101
96
]
97
+ <> Donate. donate st
102
98
}
103
99
where
104
100
openWidget =
Original file line number Diff line number Diff line change 1
1
module App.Widgets.Main (mainWidget ) where
2
2
3
3
import App.Types
4
- import qualified App.Widgets.AppLinks as AppLinks
5
4
import qualified App.Widgets.Asset as Asset
5
+ import qualified App.Widgets.GooglePlay as GooglePlay
6
6
import qualified App.Widgets.MarketLinks as MarketLinks
7
7
import qualified App.Widgets.Menu as Menu
8
8
import qualified App.Widgets.PlaceOrder as PlaceOrder
@@ -154,7 +154,7 @@ screenWidget st@Model {modelState = St {stScreen = Main}} =
154
154
]
155
155
)
156
156
: ShareApp. shareApp st
157
- <> AppLinks. appLinks st
157
+ <> GooglePlay. googlePlay st
158
158
<> RemoveOrder. removeOrder st
159
159
<> PlaceOrder. placeOrder st
160
160
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ newModel webOpts sink mSt uri = do
27
27
Model
28
28
{ modelSink = sink,
29
29
modelMenu = Closed ,
30
+ modelDonate = Closed ,
30
31
modelAppLinks = Closed ,
31
32
modelShareApp = Closed ,
32
33
modelPlaceOrder = Closed ,
@@ -45,19 +46,19 @@ newModel webOpts sink mSt uri = do
45
46
46
47
newDonateViewer :: (MonadIO m ) => m [FieldPair DynamicField Unique ]
47
48
newDonateViewer = do
48
- title <- newFieldPair mempty $ DynamicFieldText " Hello, User!"
49
- message <- newFieldPair mempty $ DynamicFieldText exampleDonationText
49
+ message <- newFieldPair " Hello, User!" $ DynamicFieldText exampleDonationText
50
50
btcMtd <- newFieldPair " BTC - Bitcoin" $ DynamicFieldText exampleBtcAddress
51
51
xmrMtd <- newFieldPair " XMR - Monero" $ DynamicFieldText exampleXmrAddress
52
52
pure
53
- [ title & # fieldPairValue . # fieldType .~ FieldTypeTitle ,
54
- message,
53
+ [ noTrunc message,
55
54
qr btcMtd,
56
55
qr xmrMtd
57
56
]
58
57
where
59
58
qr :: FieldPair a b -> FieldPair a b
60
- qr = (& # fieldPairValue . # fieldType .~ FieldTypeQrCode )
59
+ qr = noTrunc . (# fieldPairValue . # fieldType .~ FieldTypeQrCode )
60
+ noTrunc :: FieldPair a b -> FieldPair a b
61
+ noTrunc = # fieldPairValue . # fieldOpts . # fieldOptsTruncateLimit .~ Nothing
61
62
62
63
exampleBtcAddress :: Unicode
63
64
exampleBtcAddress = " bc1qa3qk8d4mxl6qkpvahl5xvg6c5k33kmuwvt9v8q"
Original file line number Diff line number Diff line change @@ -723,7 +723,7 @@ header txt =
723
723
if txt == mempty
724
724
then mempty
725
725
else
726
- [ div_
726
+ [ dt_
727
727
[ style_ [(" text-align" , " center" )]
728
728
]
729
729
[ text txt
You can’t perform that action at this time.
0 commit comments