diff options
-rw-r--r-- | client/client.cabal | 1 | ||||
-rw-r--r-- | client/src/Component/Appearing.hs | 10 | ||||
-rw-r--r-- | client/src/View/App.hs | 3 | ||||
-rw-r--r-- | client/src/View/Income/Income.hs | 24 | ||||
-rw-r--r-- | client/src/View/Income/Table.hs | 3 | ||||
-rw-r--r-- | server/server.cabal | 1 | ||||
-rw-r--r-- | server/src/Design/Appearing.hs | 25 | ||||
-rw-r--r-- | server/src/Design/Global.hs | 2 |
8 files changed, 48 insertions, 21 deletions
diff --git a/client/client.cabal b/client/client.cabal index 8648d57..cac06d5 100644 --- a/client/client.cabal +++ b/client/client.cabal @@ -45,6 +45,7 @@ Executable client , uri-bytestring other-modules: + Component.Appearing Component.Button Component.ConfirmDialog Component.Form diff --git a/client/src/Component/Appearing.hs b/client/src/Component/Appearing.hs new file mode 100644 index 0000000..e0144ca --- /dev/null +++ b/client/src/Component/Appearing.hs @@ -0,0 +1,10 @@ +module Component.Appearing + ( view + ) where + +import Reflex.Dom (MonadWidget) +import qualified Reflex.Dom as R + +view :: forall t m a. MonadWidget t m => m a -> m a +view = + R.divClass "g-Appearing" diff --git a/client/src/View/App.hs b/client/src/View/App.hs index 1e26417..d305d00 100644 --- a/client/src/View/App.hs +++ b/client/src/View/App.hs @@ -67,11 +67,10 @@ signedWidget init route = do } IncomeRoute -> do - incomeInit <- Income.init Income.view $ Income.In { Income._in_currentUser = _init_currentUser init , Income._in_currency = _init_currency init - , Income._in_init = incomeInit + , Income._in_users = _init_users init } NotFoundRoute -> diff --git a/client/src/View/Income/Income.hs b/client/src/View/Income/Income.hs index fedf3d8..d31775a 100644 --- a/client/src/View/Income/Income.hs +++ b/client/src/View/Income/Income.hs @@ -1,20 +1,18 @@ {-# LANGUAGE ExplicitForAll #-} module View.Income.Income - ( init - , view + ( view , In(..) ) where -import qualified Data.Text as T import Data.Aeson (FromJSON) import qualified Data.Maybe as Maybe -import Prelude hiding (init) +import qualified Data.Text as T import Reflex.Dom (Dynamic, Event, MonadWidget) import qualified Reflex.Dom as R import Common.Model (Currency, Income (..), - IncomesAndCount (..), UserId) + IncomesAndCount (..), User, UserId) import qualified Component.Pages as Pages import Loadable (Loadable (..)) @@ -27,22 +25,11 @@ import qualified View.Income.Reducer as Reducer import qualified View.Income.Table as Table data In t = In - { _in_currentUser :: UserId + { _in_users :: [User] + , _in_currentUser :: UserId , _in_currency :: Currency - , _in_init :: Dynamic t (Loadable Init) } -init :: forall t m. MonadWidget t m => m (Dynamic t (Loadable Init)) -init = do - users <- AjaxUtil.getNow "api/users" - incomes <- AjaxUtil.getNow "api/incomes" - payments <- AjaxUtil.getNow "api/payments" - return $ do - us <- users - is <- incomes - ps <- payments - return $ Init <$> us <*> is <*> ps - view :: forall t m. MonadWidget t m => In t -> m () view input = do rec @@ -69,6 +56,7 @@ view input = do { Table._in_currentUser = _in_currentUser input , Table._in_currency = _in_currency input , Table._in_incomes = incomes + , Table._in_users = _in_users input } pages <- Pages.view $ Pages.In diff --git a/client/src/View/Income/Table.hs b/client/src/View/Income/Table.hs index 9b2129f..32ab27b 100644 --- a/client/src/View/Income/Table.hs +++ b/client/src/View/Income/Table.hs @@ -27,6 +27,7 @@ data In t = In { _in_currentUser :: UserId , _in_currency :: Currency , _in_incomes :: [Income] + , _in_users :: [User] } data Out t = Out @@ -41,7 +42,7 @@ view input = do table <- Table.view $ Table.In { Table._in_headerLabel = headerLabel , Table._in_rows = reverse . L.sortOn _income_date $ _in_incomes input - , Table._in_cell = cell [] (_in_currency input) + , Table._in_cell = cell (_in_users input) (_in_currency input) , Table._in_cloneModal = \income -> Form.view $ Form.In { Form._in_operation = Form.Clone income diff --git a/server/server.cabal b/server/server.cabal index c7b4f2b..b170a18 100644 --- a/server/server.cabal +++ b/server/server.cabal @@ -65,6 +65,7 @@ Executable server Controller.Payment Controller.User Cookie + Design.Appearing Design.Color Design.Constants Design.Errors diff --git a/server/src/Design/Appearing.hs b/server/src/Design/Appearing.hs new file mode 100644 index 0000000..79b94b3 --- /dev/null +++ b/server/src/Design/Appearing.hs @@ -0,0 +1,25 @@ +module Design.Appearing + ( design + ) where + +import Clay + +design :: Css +design = do + + appearKeyframe + + ".g-Appearing" ? do + appearAnimation + +appearAnimation :: Css +appearAnimation = do + animationName "appear" + animationDuration (sec 0.2) + animationTimingFunction easeIn + +appearKeyframe :: Css +appearKeyframe = keyframes + "appear" + [ (0, "opacity" -: "0") + ] diff --git a/server/src/Design/Global.hs b/server/src/Design/Global.hs index f9884bd..df41cfd 100644 --- a/server/src/Design/Global.hs +++ b/server/src/Design/Global.hs @@ -6,6 +6,7 @@ import Clay import Clay.Color as C import Data.Text.Lazy (Text) +import qualified Design.Appearing as Appearing import qualified Design.Color as Color import qualified Design.Constants as Constants import qualified Design.Errors as Errors @@ -22,6 +23,7 @@ globalDesign = renderWith compact [] global global :: Css global = do ".errors" ? Errors.design + Appearing.design Modal.design ".tooltip" ? Tooltip.design Views.design |