From 5c69c2fa6fef6267257492736214b712998db5fa Mon Sep 17 00:00:00 2001 From: Hiruni Date: Fri, 6 Sep 2024 10:03:24 -0400 Subject: [PATCH] center dash text-alignment and give planned spending columns type 'dollar' --- .../src/components/DisplayTable/DisplayTable.tsx | 14 ++++++++++---- client/src/rpb/granular_view.js | 2 -- client/src/tables/programSpending.js | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/client/src/components/DisplayTable/DisplayTable.tsx b/client/src/components/DisplayTable/DisplayTable.tsx index 645aa32420..da52f40bb8 100644 --- a/client/src/components/DisplayTable/DisplayTable.tsx +++ b/client/src/components/DisplayTable/DisplayTable.tsx @@ -333,14 +333,20 @@ export class _DisplayTable extends React.Component< ); const determine_text_align = (row: DisplayTableData, col: string) => { - console.log(row, col); const current_col_formatter = col_configs_with_defaults[col].formatter; const current_col_plain_formatter = col_configs_with_defaults[col].plain_formatter; - return (_.isString(current_col_formatter) && _.isNumber(row[col])) || + + if ( + (_.isString(current_col_formatter) && _.isNumber(row[col])) || _.isNumber(current_col_plain_formatter(row[col])) - ? "right" - : "left"; + ) { + return "right"; + } else if (current_col_plain_formatter(row[col]) === "-") { + return "center"; + } else { + return "left"; + } }; const clean_search_string = (search_string: CellValue) => diff --git a/client/src/rpb/granular_view.js b/client/src/rpb/granular_view.js index d81959a68b..b15d7d687f 100644 --- a/client/src/rpb/granular_view.js +++ b/client/src/rpb/granular_view.js @@ -208,8 +208,6 @@ class GranularView extends React.Component { ), }; - console.log(table_data); - console.log(column_configs); return ( { this.add_col(header).add_child([ { - type: "big_int", + type: "dollar", nick: header, header: { en: "Planned Spending",