Skip to content

Commit 5c38b07

Browse files
committed
console: Tweak Customer and Invoice rendering. #376
1 parent c19b6be commit 5c38b07

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

console/src/Statebox/Console.purs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,20 @@ render state =
103103
, h3 [] [ text "Customer's payment methods" ]
104104
, div [] (state.paymentMethods <#> paymentMethodHtml)
105105
, h2 [] [ text "Invoices" ]
106-
, div []
107-
(state.accounts <#> \account -> table []
108-
(account.invoices <#> invoiceSummaryLineHtml)
109-
)
106+
, div [] (state.accounts <#> \account -> invoiceSummaries account.invoices)
110107
]
111108

112-
invoiceSummaryLineHtml :: m. MonadAff m => Stripe.Invoice -> ComponentHTML Action ChildSlots m
113-
invoiceSummaryLineHtml i =
114-
tr [] [ td [] [ text $ i.customer_email ]
115-
, td [] [ text $ i.account_name ]
116-
, td [] [ text $ i.currency ]
117-
, td [] [ text $ show i.amount_due ]
118-
]
109+
invoiceSummaries :: m. MonadAff m => Array Stripe.Invoice -> ComponentHTML Action ChildSlots m
110+
invoiceSummaries invoices =
111+
table [] (invoices <#> invoiceSummaryLineHtml)
112+
where
113+
invoiceSummaryLineHtml :: m. MonadAff m => Stripe.Invoice -> ComponentHTML Action ChildSlots m
114+
invoiceSummaryLineHtml i =
115+
tr [] [ td [] [ text $ i.customer_email ]
116+
, td [] [ text $ i.account_name ]
117+
, td [] [ text $ i.currency ]
118+
, td [] [ text $ show i.amount_due ]
119+
]
119120

120121
customerHtml :: m. MonadAff m => Stripe.Customer -> ComponentHTML Action ChildSlots m
121122
customerHtml c =
@@ -138,7 +139,7 @@ customerHtml c =
138139
, tr [] [ th [] [ text "balance" ]
139140
, td [] [ text $ c.currency <> " " <> show c.balance <> " cents" ]
140141
]
141-
, tr [] [ th [] [ text "tax" ]
142+
, tr [] [ th [] [ text "tax ids" ]
142143
, td [] [ taxIdsHtml c.tax_ids ]
143144
]
144145
]

0 commit comments

Comments
 (0)