@@ -57,28 +57,30 @@ class ViewPresenter:
5757 @staticmethod
5858 def format_amount (amount : float , for_table : bool = False ) -> Union [str , Text ]:
5959 """
60- Format dollar amount with sign outside dollar sign.
60+ Format amount with sign and thousands separators.
61+
62+ Currency symbol is shown in column header, not in cells, to reduce visual noise.
6163
6264 Args:
63- amount: The dollar amount to format
65+ amount: The amount to format
6466 for_table: If True, return Rich Text with right justification for tables
6567
6668 Returns:
67- Formatted string like "-$ 1,234.56" or "+$ 5,000.00"
69+ Formatted string like "-1,234.56" or "+5,000.00" (no currency symbol)
6870 If for_table=True, returns Rich Text object with right justification
6971 Positive amounts (credits) are styled in green
7072
7173 Examples:
7274 >>> ViewPresenter.format_amount(-1234.56)
73- '-$ 1,234.56'
75+ '-1,234.56'
7476 >>> ViewPresenter.format_amount(5000.00)
75- '+$ 5,000.00'
77+ '+5,000.00'
7678 >>> ViewPresenter.format_amount(0.00)
77- '+$ 0.00'
79+ '+0.00'
7880 """
7981 sign = "-" if amount < 0 else "+"
8082 abs_amount = abs (amount )
81- formatted = f"{ sign } $ { abs_amount :,.2f} "
83+ formatted = f"{ sign } { abs_amount :,.2f} "
8284
8385 if for_table :
8486 # Color positive amounts (credits) green for visual distinction
@@ -160,7 +162,7 @@ def prepare_aggregation_columns(
160162 group_by_field: The field to group by
161163 sort_by: Current sort mode
162164 sort_direction: Current sort direction
163- column_config: Optional backend -specific column width config
165+ column_config: Backend -specific config (widths, currency_symbol)
164166 display_labels: Optional backend-specific display labels
165167
166168 Returns:
@@ -177,7 +179,8 @@ def prepare_aggregation_columns(
177179 """
178180 # Use defaults if not provided
179181 if column_config is None :
180- column_config = {"merchant_width_pct" : 35 , "account_width_pct" : 30 }
182+ column_config = {}
183+
181184 if display_labels is None :
182185 display_labels = {"merchant" : "Merchant" , "account" : "Account" , "accounts" : "Accounts" }
183186
@@ -190,13 +193,17 @@ def prepare_aggregation_columns(
190193 }
191194 name_label = name_labels [group_by_field ]
192195
196+ # Extract currency symbol from config (defaults to $ if not provided)
197+ currency_symbol = column_config .get ("currency_symbol" , "$" ) if column_config else "$"
198+
199+ # Default name width
200+ name_width = 40
201+
193202 # Get column width based on field type
194203 if group_by_field == "merchant" :
195- name_width = column_config .get ("merchant_width_pct" , 35 ) # Wider for 150 char terminals
204+ name_width = column_config .get ("merchant_width_pct" , name_width )
196205 elif group_by_field == "account" :
197- name_width = column_config .get ("account_width_pct" , 30 )
198- else :
199- name_width = 40 # Default for category/group
206+ name_width = column_config .get ("account_width_pct" , name_width )
200207
201208 # Map aggregation field to sort mode
202209 field_to_sort_mode : dict [AggregationField , SortMode ] = {
@@ -214,8 +221,8 @@ def prepare_aggregation_columns(
214221 amount_arrow = ViewPresenter .get_sort_arrow (sort_by , sort_direction , SortMode .AMOUNT )
215222
216223 # Build column specs
217- # Total column label - right-aligned to match the values
218- total_label = f"Total { amount_arrow } " .strip ()
224+ # Total column label - right-aligned to match the values, includes currency
225+ total_label = f"Total ( { currency_symbol } ) { amount_arrow } " .strip ()
219226 total_label_text = Text (total_label , justify = "right" )
220227
221228 columns : list [ColumnSpec ] = [
@@ -389,7 +396,7 @@ def prepare_transaction_columns(
389396 Args:
390397 sort_by: Current sort mode
391398 sort_direction: Current sort direction
392- column_config: Optional backend -specific column width config
399+ column_config: Backend -specific config (widths, currency_symbol)
393400 display_labels: Optional backend-specific display labels
394401
395402 Returns:
@@ -406,10 +413,17 @@ def prepare_transaction_columns(
406413 """
407414 # Use defaults if not provided
408415 if column_config is None :
409- column_config = {"merchant_width_pct" : 25 , "account_width_pct" : 30 }
416+ column_config = {
417+ "merchant_width_pct" : 25 ,
418+ "account_width_pct" : 30 ,
419+ "currency_symbol" : "$" ,
420+ }
410421 if display_labels is None :
411422 display_labels = {"merchant" : "Merchant" , "account" : "Account" , "accounts" : "Accounts" }
412423
424+ # Extract currency symbol from config
425+ currency_symbol = column_config .get ("currency_symbol" , "$" )
426+
413427 # Get arrows for each field
414428 date_arrow = ViewPresenter .get_sort_arrow (sort_by , sort_direction , SortMode .DATE )
415429 merchant_arrow = ViewPresenter .get_sort_arrow (sort_by , sort_direction , SortMode .MERCHANT )
@@ -425,8 +439,8 @@ def prepare_transaction_columns(
425439 merchant_width = column_config .get ("merchant_width_pct" , 25 )
426440 account_width = column_config .get ("account_width_pct" , 30 )
427441
428- # Amount column label - right-aligned to match the values
429- amount_label = f"Amount { amount_arrow } " .strip ()
442+ # Amount column label - right-aligned to match the values, includes currency
443+ amount_label = f"Amount ( { currency_symbol } ) { amount_arrow } " .strip ()
430444 amount_label_text = Text (amount_label , justify = "right" )
431445
432446 columns : list [ColumnSpec ] = [
0 commit comments