Skip to content

Commit 64498f5

Browse files
committed
wip
1 parent b7af9d5 commit 64498f5

File tree

4 files changed

+53
-58
lines changed

4 files changed

+53
-58
lines changed

ghcjs/delivery-calculator/delivery-calculator.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ common pkg
9393
, functora-ghcjs
9494
, microlens
9595
, miso
96-
, miso-components
9796
, miso-functora
9897
, modern-uri
9998
, syb

ghcjs/delivery-calculator/src/App/Widgets/Main.hs

Lines changed: 34 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,13 @@ import qualified Functora.Miso.Widgets.FieldPairs as FieldPairs
1313
import qualified Functora.Miso.Widgets.Grid as Grid
1414
import qualified Functora.Money as Money
1515
import Lens.Micro ((^..))
16-
import qualified Material.Button as Button
17-
import qualified Material.LayoutGrid as LayoutGrid
18-
import qualified Material.Theme as Theme
19-
import qualified Material.TopAppBar as TopAppBar
20-
import qualified Material.Typography as Typography
2116
import Miso hiding (at, view)
2217

2318
mainWidget :: Model -> View Action
2419
mainWidget st =
25-
LayoutGrid.layoutGrid
26-
[ LayoutGrid.alignMiddle
27-
]
28-
$ [ LayoutGrid.inner
29-
[ class_ "container",
30-
TopAppBar.shortFixedAdjust
20+
Grid.grid mempty
21+
$ [ div_
22+
[ class_ "container"
3123
]
3224
( Menu.menu st
3325
<> screenWidget st
@@ -77,13 +69,12 @@ screenWidget st@Model {modelState = St {stScreen = QrCode sc}} =
7769
}
7870
]
7971
<> [ Grid.bigCell
80-
[ Button.raised
81-
( Button.config
82-
& Button.setIcon (Just "login")
83-
& Button.setAttributes [Css.fullWidth]
84-
& Button.setOnClick (setScreenAction $ unQrCode sc)
85-
)
86-
"Open"
72+
[ button_
73+
[ onClick . setScreenAction $ unQrCode sc,
74+
Css.fullWidth
75+
]
76+
[ text "Open"
77+
]
8778
]
8879
]
8980
screenWidget st@Model {modelState = St {stScreen = Donate}} =
@@ -95,13 +86,12 @@ screenWidget st@Model {modelState = St {stScreen = Donate}} =
9586
FieldPairs.argsEmitter = Misc.pushActionQueue st . Instant
9687
}
9788
<> [ Grid.bigCell
98-
[ Button.raised
99-
( Button.config
100-
& Button.setIcon (Just "login")
101-
& Button.setAttributes [Css.fullWidth]
102-
& Button.setOnClick (setScreenAction Main)
103-
)
104-
"Open"
89+
[ button_
90+
[ onClick $ setScreenAction Main,
91+
Css.fullWidth
92+
]
93+
[ text "Open"
94+
]
10595
]
10696
]
10797
screenWidget st@Model {modelState = St {stScreen = Main}} =
@@ -118,31 +108,26 @@ screenWidget st@Model {modelState = St {stScreen = Main}} =
118108
buttons :: [View Action]
119109
buttons =
120110
[ Grid.mediumCell
121-
[ Button.raised
122-
( Button.config
123-
& Button.setIcon (Just "add_box")
124-
& Button.setAttributes [Css.fullWidth]
125-
& Button.setOnClick
126-
( PushUpdate . Instant . ImpureUpdate $ do
127-
asset <- newAsset
128-
pure $ #modelState . #stAssets %~ flip snoc asset
129-
)
130-
)
131-
"Add item"
111+
[ button_
112+
[ Css.fullWidth,
113+
onClick . PushUpdate . Instant . ImpureUpdate $ do
114+
asset <- newAsset
115+
pure $ #modelState . #stAssets %~ flip snoc asset
116+
]
117+
[ text "Add item"
118+
]
132119
],
133120
Grid.mediumCell
134-
[ Button.raised
135-
( Button.config
136-
& Button.setIcon (Just "send")
137-
& Button.setAttributes [Css.fullWidth]
138-
& Button.setOnClick
139-
( PushUpdate
140-
. Instant
141-
. either impureThrow Jsm.openBrowserPage
142-
$ stTeleUri st
143-
)
144-
)
145-
"Order via Telegram"
121+
[ button_
122+
[ Css.fullWidth,
123+
onClick
124+
. PushUpdate
125+
. Instant
126+
. either impureThrow Jsm.openBrowserPage
127+
$ stTeleUri st
128+
]
129+
[ text "Order via Telegram"
130+
]
146131
]
147132
]
148133

@@ -234,15 +219,7 @@ foldFieldPair acc =
234219

235220
tosWidget :: View Action
236221
tosWidget =
237-
LayoutGrid.cell
238-
[ LayoutGrid.span12,
239-
Typography.caption,
240-
Theme.textDisabledOnBackground,
241-
class_ "no-print",
242-
style_
243-
[ ("text-align", "center")
244-
]
245-
]
222+
Grid.cell
246223
[ Miso.text "\169 2024 ",
247224
BrowserLink.browserLink
248225
BrowserLink.Args

ghcjs/miso-functora/miso-functora.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ common pkg
7373
, barbies
7474
, base
7575
, bytestring
76+
, deepseq
7677
, functora-ghcjs
7778
, fuzzy
7879
, jsaddle

ghcjs/miso-functora/src/Functora/Miso/Orphan.hs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@ import Data.Monoid.Null
1111
import Data.Monoid.Textual
1212
import Data.Semigroup.Cancellative
1313
import Functora.Prelude
14+
import qualified Miso
15+
import Prelude hiding (String)
16+
17+
deriving stock instance Generic (Miso.View action)
18+
19+
deriving stock instance Generic (Miso.Attribute action)
20+
21+
deriving stock instance Generic Miso.NS
22+
23+
deriving stock instance Generic Miso.Key
24+
25+
instance NFData (Miso.View action)
26+
27+
instance NFData (Miso.Attribute action)
28+
29+
instance NFData Miso.NS
30+
31+
instance NFData Miso.Key
1432

1533
instance MonoidNull JSString where
1634
null = JS.null

0 commit comments

Comments
 (0)