aboutsummaryrefslogtreecommitdiff
path: root/client/src/View/Income/Header.hs
diff options
context:
space:
mode:
authorJoris2019-10-22 22:26:38 +0200
committerJoris2019-10-22 22:26:38 +0200
commit613ffccac4b3ab25c6d4c631fab757da0b35acf6 (patch)
tree13e448af89f4079bb62d7ce8b5a44b6a64515129 /client/src/View/Income/Header.hs
parent80f09e8b3a5c856e60922a73c9161a8c5392e4d4 (diff)
downloadbudget-613ffccac4b3ab25c6d4c631fab757da0b35acf6.tar.gz
budget-613ffccac4b3ab25c6d4c631fab757da0b35acf6.tar.bz2
budget-613ffccac4b3ab25c6d4c631fab757da0b35acf6.zip
Harmonize view component code style
Diffstat (limited to 'client/src/View/Income/Header.hs')
-rw-r--r--client/src/View/Income/Header.hs43
1 files changed, 21 insertions, 22 deletions
diff --git a/client/src/View/Income/Header.hs b/client/src/View/Income/Header.hs
index 4e08955..ae1174a 100644
--- a/client/src/View/Income/Header.hs
+++ b/client/src/View/Income/Header.hs
@@ -1,7 +1,7 @@
module View.Income.Header
( view
- , HeaderIn(..)
- , HeaderOut(..)
+ , In(..)
+ , Out(..)
) where
import Control.Monad.IO.Class (liftIO)
@@ -16,25 +16,24 @@ import qualified Common.Model as CM
import qualified Common.Msg as Msg
import qualified Common.View.Format as Format
-import Component (ButtonOut (..))
-import qualified Component
+import qualified Component.Button as Button
import qualified Component.Modal as Modal
import qualified Util.Date as DateUtil
import qualified View.Income.Add as Add
import View.Income.Init (Init (..))
-data HeaderIn t = HeaderIn
- { _headerIn_init :: Init
- , _headerIn_currency :: Currency
- , _headerIn_incomes :: Dynamic t [Income]
+data In t = In
+ { _in_init :: Init
+ , _in_currency :: Currency
+ , _in_incomes :: Dynamic t [Income]
}
-data HeaderOut t = HeaderOut
- { _headerOut_addIncome :: Event t Income
+data Out t = Out
+ { _out_addIncome :: Event t Income
}
-view :: forall t m. MonadWidget t m => HeaderIn t -> m (HeaderOut t)
-view headerIn =
+view :: forall t m. MonadWidget t m => In t -> m (Out t)
+view input =
R.divClass "withMargin" $ do
currentTime <- liftIO Clock.getCurrentTime
@@ -58,7 +57,7 @@ view headerIn =
T.intercalate " "
[ _user_name user
, "−"
- , Format.price (_headerIn_currency headerIn) $
+ , Format.price (_in_currency input) $
CM.cumulativeIncomesSince currentTime since userIncomes
]
@@ -67,23 +66,23 @@ view headerIn =
R.text $
Msg.get Msg.Income_MonthlyNet
- addIncome <- _buttonOut_clic <$>
- (Component.button . Component.defaultButtonIn . R.text $
+ addIncome <- Button._out_clic <$>
+ (Button.view . Button.defaultIn . R.text $
Msg.get Msg.Income_AddLong)
- addIncome <- Modal.view $ Modal.Input
- { Modal._input_show = addIncome
- , Modal._input_content = Add.view
+ addIncome <- Modal.view $ Modal.In
+ { Modal._in_show = addIncome
+ , Modal._in_content = Add.view
}
- return $ HeaderOut
- { _headerOut_addIncome = addIncome
+ return $ Out
+ { _out_addIncome = addIncome
}
where
- init = _headerIn_init headerIn
+ init = _in_init input
- useIncomesFrom = R.ffor (_headerIn_incomes headerIn) $ \incomes ->
+ useIncomesFrom = R.ffor (_in_incomes input) $ \incomes ->
( CM.useIncomesFrom
(map _user_id $_init_users init)
incomes