summaryrefslogtreecommitdiffstats
path: root/app/Main.hs
diff options
context:
space:
mode:
authorRutger Broekhoff2025-07-23 12:05:08 +0200
committerRutger Broekhoff2025-07-23 12:05:08 +0200
commit56273cf3b371312f0e72fc2af95a9dcacc8228b8 (patch)
treeb4249523cab145fa32e2fdfb826cb592dcfdc127 /app/Main.hs
parenta40d93a36f0dd9f493757d793321f38a58cbb21b (diff)
downloadrdcapsis-56273cf3b371312f0e72fc2af95a9dcacc8228b8.tar.gz
rdcapsis-56273cf3b371312f0e72fc2af95a9dcacc8228b8.zip
Slaying
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs142
1 files changed, 1 insertions, 141 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 97a0463..82505bf 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -1,144 +1,4 @@
1{-# LANGUAGE ImplicitParams #-}
2{-# LANGUAGE OverloadedLabels #-}
3{-# LANGUAGE OverloadedRecordDot #-}
4{-# LANGUAGE OverloadedStrings #-}
5
6module Main where 1module Main where
7 2
8import Control.Monad (void)
9import Data.GI.Base
10import GI.Adw qualified as Adw
11import GI.Adw.Objects.ApplicationWindow
12import GI.Gtk qualified as Gtk
13import Import.Ing.CurrentAccountCsv qualified
14import Import.Ing.SavingsAccountCsv qualified
15import System.IO (IOMode (ReadMode), withFile)
16import Text.Pretty.Simple (pPrint)
17
18-- data AccountType = Asset | Equity | Liability | Expense | Income
19--
20-- data TxAction = Inc | Dec
21--
22-- txAopp :: TxAction -> TxAction
23-- txaOpp Inc = Dec
24-- txaOpp Dec = Inc
25--
26-- onDebit :: AccountType -> TxAction
27-- onDebit Asset = Inc
28-- onDebit Equity = Dec
29-- onDebit Liability = Dec
30-- onDebit Expense = Inc
31-- onDebit Income = Dec
32--
33-- onCredit :: AccountType -> TxAction
34-- onCredit = txaOpp . onDebit
35--
36-- data Ledger = [LedgerEntry]
37--
38-- data LedgerEntry = TxEntry Tx | BalAssertEntry BalAssert
39--
40-- -- A balance assertion is only valid when all transactions before it have been
41-- -- cleared and the balance of the account agrees with the amount in the
42-- -- assertion.
43-- data BalAssert = BalAssert {
44-- account :: Account,
45-- amount :: Decimal,
46-- tags :: Tags }
47--
48-- data Tx = Tx {
49-- txClearedAt :: Maybe UTCTime,
50-- txCommodity :: Commodity, -- the commodity w.r.t. which rates are calculated
51-- txDebit :: [(Account, Rate, Amount)],
52-- txCredit :: [(Account, Rate, Amount)]
53-- -- Description
54-- -- Type:
55-- } deriving Show
56--
57-- data Account = Account {
58-- acName :: [T.Text],
59-- acBalance :: Amount }
60
61activate :: Adw.Application -> IO ()
62activate app = do
63 button <-
64 new
65 Gtk.Button
66 [ #label := "Click me",
67 On
68 #clicked
69 ( ?self
70 `set` [ #sensitive := False,
71 #label := "Thanks for clicking me"
72 ]
73 )
74 ]
75 button2 <-
76 new
77 Gtk.Button
78 [ #label := "Click me",
79 On
80 #clicked
81 ( ?self
82 `set` [ #sensitive := False,
83 #label := "Thanks for clicking me"
84 ]
85 )
86 ]
87
88 title <- new Adw.WindowTitle [ #title := "rdcapsis" ]
89 topBar <- new Adw.HeaderBar
90 [ #titleWidget := title ]
91
92 sidebarToolbarView <-
93 new Adw.ToolbarView
94 [ #content := button ]
95
96 mainToolbarView <-
97 new Adw.ToolbarView
98 []
99 mainToolbarView.addTopBar topBar
100
101 sidebarNavPage <- new Adw.NavigationPage
102 [ #title := "Accounts",
103 #tag := "sidebar",
104 #child := sidebarToolbarView ]
105
106 mainNavPage <- new Adw.NavigationPage
107 [ #title := "Content",
108 #tag := "content",
109 #child := mainToolbarView ]
110
111 splitView <- new Adw.NavigationSplitView
112 [ #sidebar := sidebarNavPage,
113 #content := mainNavPage ]
114
115 window <-
116 new
117 Adw.ApplicationWindow
118 [ #application := app,
119 #content := splitView,
120 #widthRequest := 280,
121 #heightRequest := 200,
122 #defaultWidth := 800,
123 #defaultHeight := 800
124 ]
125
126 cond <- Adw.breakpointConditionParse "max-width: 400sp"
127 breakpoint <- new Adw.Breakpoint [ #condition := cond,
128 On #apply (splitView.setCollapsed True),
129 On #unapply (splitView.setCollapsed False) ]
130 window.addBreakpoint breakpoint
131
132 window.present
133
134main :: IO () 3main :: IO ()
135main = do 4main = putStrLn "Hello!"
136 app <-
137 new
138 Adw.Application
139 [ #applicationId := "eu.fautchen.rdcapsis",
140 On #activate (activate ?self)
141 ]
142 void $ app.run Nothing
143
144-- window <- applicationWindowNew