diff options
author | Joris | 2019-10-27 20:26:29 +0100 |
---|---|---|
committer | Joris | 2019-10-27 20:26:29 +0100 |
commit | b97ad942495352c3fc1e0c820cfba82a9693ac7a (patch) | |
tree | f554831888929e2eff5e1fe478f92758637d37cf /client/src/Component/Table.hs | |
parent | 8ef4d96644bce59bbb736af6359e644743e5610a (diff) | |
download | budget-b97ad942495352c3fc1e0c820cfba82a9693ac7a.tar.gz budget-b97ad942495352c3fc1e0c820cfba82a9693ac7a.tar.bz2 budget-b97ad942495352c3fc1e0c820cfba82a9693ac7a.zip |
WIP Set up server side paging for incomes
Diffstat (limited to 'client/src/Component/Table.hs')
-rw-r--r-- | client/src/Component/Table.hs | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/client/src/Component/Table.hs b/client/src/Component/Table.hs index a02eaa7..7103abd 100644 --- a/client/src/Component/Table.hs +++ b/client/src/Component/Table.hs @@ -10,7 +10,6 @@ import qualified Reflex.Dom as R import qualified Component.Button as Button import qualified Component.Modal as Modal -import qualified Component.Pages as Pages import qualified Util.Reflex as ReflexUtil import qualified View.Icon as Icon @@ -18,8 +17,6 @@ data In m t h r a = In { _in_headerLabel :: h -> Text , _in_rows :: Dynamic t [r] , _in_cell :: h -> r -> Text - , _in_perPage :: Int - , _in_resetPage :: Event t () , _in_cloneModal :: r -> Modal.Content t m a , _in_editModal :: r -> Modal.Content t m a , _in_deleteModal :: r -> Modal.Content t m a @@ -47,12 +44,7 @@ view input = R.divClass "cell" $ R.blank R.divClass "cell" $ R.blank - let rows = getRange - (_in_perPage input) - <$> (Pages._out_currentPage pages) - <*> (_in_rows input) - - R.simpleList rows $ \r -> + R.simpleList (_in_rows input) $ \r -> R.divClass "row" $ do flip mapM_ [minBound..] $ \h -> R.divClass "cell" $ @@ -104,12 +96,6 @@ view input = return (cloned, edited, deleted) - pages <- Pages.view $ Pages.In - { Pages._in_total = length <$> _in_rows input - , Pages._in_perPage = _in_perPage input - , Pages._in_reset = _in_resetPage input - } - let add = R.switch . R.current . fmap (R.leftmost . map (\(a, _, _) -> a)) $ result edit = R.switch . R.current . fmap (R.leftmost . map (\(_, a, _) -> a)) $ result delete = R.switch . R.current . fmap (R.leftmost . map (\(_, _, a) -> a)) $ result @@ -119,7 +105,3 @@ view input = , _out_edit = edit , _out_delete = delete } - -getRange :: forall a. Int -> Int -> [a] -> [a] -getRange perPage currentPage = - take perPage . drop ((currentPage - 1) * perPage) |