@@ -5,10 +5,7 @@ module App.Widgets.Menu
5
5
)
6
6
where
7
7
8
- import qualified App.Jsm as Jsm
9
8
import App.Types
10
- import qualified App.Xlsx as Xlsx
11
- import qualified Data.ByteString.Lazy as BL
12
9
import qualified Functora.Miso.Jsm as Jsm
13
10
import Functora.Miso.Prelude
14
11
import qualified Functora.Miso.Widgets.BrowserLink as BrowserLink
@@ -25,24 +22,10 @@ menu st =
25
22
[ keyed " menu"
26
23
$ nav_
27
24
[ style_
28
- [ (" grid-template-columns" , " auto 1fr auto auto auto auto" )
25
+ [ (" grid-template-columns" , " 1fr auto" )
29
26
]
30
27
]
31
28
[ button_
32
- [ role_ " button" ,
33
- style_
34
- [ (" min-width" , " 0" )
35
- ],
36
- onClick
37
- . PushUpdate
38
- . Instant
39
- . PureUpdate
40
- $ # modelMenu
41
- .~ Opened
42
- ]
43
- [ icon Icon. IconMenu
44
- ],
45
- button_
46
29
[ role_ " button" ,
47
30
style_
48
31
[ (" min-width" , " 0" ),
@@ -54,7 +37,8 @@ menu st =
54
37
doc <- liftIO newSt
55
38
pure $ # modelState .~ doc
56
39
]
57
- [ text " Delivery Calculator"
40
+ [ icon Icon. IconDelivery ,
41
+ text " Delivery Calculator"
58
42
],
59
43
button_
60
44
[ role_ " button" ,
@@ -64,37 +48,27 @@ menu st =
64
48
onClick
65
49
. PushUpdate
66
50
. Instant
67
- . Jsm. shareText
68
- . from @ String @ Unicode
69
- . either impureThrow URI. renderStr
70
- $ stUri st
71
- ]
72
- [ icon Icon. IconShare
73
- ],
74
- button_
75
- [ role_ " button" ,
76
- style_
77
- [ (" min-width" , " 0" )
78
- ],
79
- onClick . PushUpdate . Instant . EffectUpdate $ do
80
- let doc = st ^. # modelState
81
- imgs <- Jsm. fetchBlobUris doc
82
- Jsm. saveFile Xlsx. xlsxFile Xlsx. xlsxMime
83
- . from @ BL. ByteString @ ByteString
84
- $ Xlsx. newXlsx doc imgs
51
+ . PureUpdate
52
+ $ # modelMenu
53
+ .~ Opened
85
54
]
86
- [ icon Icon. IconDownload
55
+ [ icon Icon. IconMenu
87
56
]
88
57
]
89
58
]
90
59
<> Dialog. dialog
91
60
( Dialog. defOpts
92
- & # optsTitleIcon
93
- .~ Just Icon. IconSettings
94
- & # optsKeyed
95
- .~ Just (" menu" :: Unicode )
96
- & # optsTitle
97
- .~ Just " Settings"
61
+ { Dialog. optsTitleIcon = Just Icon. IconSettings ,
62
+ Dialog. optsKeyed = Just " menu" ,
63
+ Dialog. optsTitle = Just " Settings" ,
64
+ Dialog. optsHeaderRight =
65
+ ( ( button_
66
+ [shareOnClick]
67
+ [Dialog. optsIcon Dialog. defOpts Icon. IconShare ]
68
+ )
69
+ :
70
+ )
71
+ }
98
72
)
99
73
Dialog. Args
100
74
{ Dialog. argsModel = st,
@@ -225,6 +199,16 @@ menu st =
225
199
]
226
200
)
227
201
}
202
+ where
203
+ shareOnClick :: Attribute Action
204
+ shareOnClick =
205
+ onClick
206
+ . PushUpdate
207
+ . Instant
208
+ . Jsm. shareText
209
+ . from @ String @ Unicode
210
+ . either impureThrow URI. renderStr
211
+ $ stUri st
228
212
229
213
qrButton :: Model -> View Action
230
214
qrButton st =
0 commit comments