instruction
stringlengths
0
1k
input
stringlengths
1
1k
output
stringlengths
10
6.51k
if item["name"] != "Credit Cards" ) ) return round(other_liabilities + abs(cc_balance), 2) @rx.var def asset_percentages( self, ) -> List[AssetLiabilitySummaryItem]: """Calculate asset percentages.""" total = self.total_assets if total == 0: return [ { "name": item["name"], "value": 0.0, "color": item["color"], } for item in self.assets_summary ] return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in self.assets_summary ] @rx.var def liability_percentages( self, ) -> List[AssetLiabilitySummaryItem]: """Calculate liability percentages.""" total = self.total_liabilities
current_liability_summary = [] for item in self.liabilities_summary: if item["name"] == "Credit Cards": cc_balance = next( ( cat["total_balance"] for cat in self.account_categories if cat["category_name"] == "Credit Cards" ), 0, ) current_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item) return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.act
if total == 0: return [ { "name": item["name"], "value": 0.0, "color": item["color"], } for item in self.liabilities_summary ]
" total = self.total_assets if total == 0: return [ { "name": item["name"], "value": 0.0, "color": item["color"], } for item in self.assets_summary ] return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in self.assets_summary ] @rx.var def liability_percentages( self, ) -> List[AssetLiabilitySummaryItem]: """Calculate liability percentages.""" total = self.total_liabilities if total == 0: return [ { "name": item["name"], "value": 0.0, "color": item["color"], } for item in self.liabilities_summary ]
for item in self.liabilities_summary: if item["name"] == "Credit Cards": cc_balance = next( ( cat["total_balance"] for cat in self.account_categories if cat["category_name"] == "Credit Cards" ), 0, ) current_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item) return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event
current_liability_summary = []
if total == 0: return [ { "name": item["name"], "value": 0.0, "color": item["color"], } for item in self.assets_summary ] return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in self.assets_summary ] @rx.var def liability_percentages( self, ) -> List[AssetLiabilitySummaryItem]: """Calculate liability percentages.""" total = self.total_liabilities if total == 0: return [ { "name": item["name"], "value": 0.0, "color": item["color"], } for item in self.liabilities_summary ] current_liability_summary = []
return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for th
for item in self.liabilities_summary: if item["name"] == "Credit Cards": cc_balance = next( ( cat["total_balance"] for cat in self.account_categories if cat["category_name"] == "Credit Cards" ), 0, ) current_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item)
{ "name": item["name"], "value": 0.0, "color": item["color"], } for item in self.assets_summary ] return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in self.assets_summary ] @rx.var def liability_percentages( self, ) -> List[AssetLiabilitySummaryItem]: """Calculate liability percentages.""" total = self.total_liabilities if total == 0: return [ { "name": item["name"], "value": 0.0, "color": item["color"], } for item in self.liabilities_summary ] current_liability_summary = [] for item in self.liabilities_summary:
return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for th
if item["name"] == "Credit Cards": cc_balance = next( ( cat["total_balance"] for cat in self.account_categories if cat["category_name"] == "Credit Cards" ), 0, ) current_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item)
"value": 0.0, "color": item["color"], } for item in self.assets_summary ] return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in self.assets_summary ] @rx.var def liability_percentages( self, ) -> List[AssetLiabilitySummaryItem]: """Calculate liability percentages.""" total = self.total_liabilities if total == 0: return [ { "name": item["name"], "value": 0.0, "color": item["color"], } for item in self.liabilities_summary ] current_liability_summary = [] for item in self.liabilities_summary: if item["name"] == "Credit Cards":
current_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item) return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ][
cc_balance = next( ( cat["total_balance"] for cat in self.account_categories if cat["category_name"] == "Credit Cards" ), 0, )
"color": item["color"], } for item in self.liabilities_summary ] current_liability_summary = [] for item in self.liabilities_summary: if item["name"] == "Credit Cards": cc_balance = next( ( cat["total_balance"] for cat in self.account_categories if cat["category_name"] == "Credit Cards" ), 0, ) current_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item) return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event
@rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates
def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name
] current_liability_summary = [] for item in self.liabilities_summary: if item["name"] == "Credit Cards": cc_balance = next( ( cat["total_balance"] for cat in self.account_categories if cat["category_name"] == "Credit Cards" ), 0, ) current_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item) return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar."""
@rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates
self.active_page = page_name
for item in self.liabilities_summary: if item["name"] == "Credit Cards": cc_balance = next( ( cat["total_balance"] for cat in self.account_categories if cat["category_name"] == "Credit Cards" ), 0, ) current_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item) return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event
@rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount /
def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories
( cat["total_balance"] for cat in self.account_categories if cat["category_name"] == "Credit Cards" ), 0, ) current_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item) return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category."""
@rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount /
if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories
for cat in self.account_categories if cat["category_name"] == "Credit Cards" ), 0, ) current_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item) return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories):
new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount =
new_categories = [dict(cat) for cat in self.account_categories]
if cat["category_name"] == "Credit Cards" ), 0, ) current_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item) return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories]
self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = roun
new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"]
t_liability_summary.append({**item, "value": abs(cc_balance)}) else: current_liability_summary.append(item) return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"]
@rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount /
self.account_categories = new_categories
}) else: current_liability_summary.append(item) return [ { "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event
@rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_pe
def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass
{ "name": item["name"], "value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph."""
@rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_pe
if value in self.graph_ranges: self.selected_graph_range = value else: pass
"value": round(item["value"] / total * 100, 1), "color": item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges:
else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0
self.selected_graph_range = value
: item["color"], } for item in current_liability_summary if item["value"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event
@rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.
def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view
lue"] > 0 ] @rx.event def set_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent."""
@rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.
if view in ["Totals", "Percent"]: self.summary_view = view
_active_page(self, page_name: str): """Set the currently active page in the sidebar.""" self.active_page = page_name @rx.event def toggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]:
@rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.
self.summary_view = view
ggle_account_category(self, category_index: int): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes."""
self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict
new_data = generate_net_worth_data()
nt): """Toggle the open/closed state of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data()
self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: ac
self._raw_net_worth_data = new_data
of an account category.""" if 0 <= category_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data
if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() cha
self.net_worth = new_data[-1]["value"]
egory_index < len(self.account_categories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"]
new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance
if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0
gories): new_categories = [dict(cat) for cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30:
self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["bala
month_ago_value = new_data[-31]["value"]
cat in self.account_categories] new_categories[category_index]["is_open"] = not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"]
if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2)
self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2)
= not new_categories[ category_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2)
else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now"
if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0
egory_index ]["is_open"] self.account_categories = new_categories @rx.event def set_graph_range(self, value: str): """Set the time range for the net worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0:
else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"]
self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, )
t worth graph.""" if value in self.graph_ranges: self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else:
else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now"
self.net_worth_change_percent = 0.0
self.selected_graph_range = value else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else:
self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account)
self.net_worth_change_amount = 0.0
else: pass @rx.event def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0
new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance
self.net_worth_change_percent = 0.0
def set_summary_view(self, view: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0
total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_c
new_categories = []
iew: str): """Set the summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = []
total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff
total_assets_val = 0
summary view to Totals or Percent.""" if view in ["Totals", "Percent"]: self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0
for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_ac
total_liabilities_val = 0
self.summary_view = view @rx.event def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories:
new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + categ
category = category_dict.copy()
def refresh_all(self): """Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy()
category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change
new_accounts = []
"""Placeholder for refreshing all account data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = []
category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"]
category_balance_change = 0
unt data. Simulates data changes.""" new_data = generate_net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0
for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one
category_opening_balance = category["total_balance"]
net_worth_data() self._raw_net_worth_data = new_data self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"]
category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else:
for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff
ta self.net_worth = new_data[-1]["value"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]:
change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1),
account = account_dict.copy()
e"] if len(new_data) > 30: month_ago_value = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy()
prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balan
change_factor = random.uniform(0.98, 1.02)
lue = new_data[-31]["value"] self.net_worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02)
new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_bala
prev_balance = account["balance"]
worth_change_amount = round(self.net_worth - month_ago_value, 2) if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"]
account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if pre
new_balance = round(prev_balance * change_factor, 2)
if month_ago_value != 0: self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2)
new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: cate
account["balance"] = new_balance
self.net_worth_change_percent = round( self.net_worth_change_amount / month_ago_value * 100, 1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance
account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100,
new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ]
1, ) else: self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ]
account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else:
account["sparkline_data"] = new_sparkline
self.net_worth_change_percent = 0.0 else: self.net_worth_change_amount = 0.0 self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline
new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] =
account["last_updated"] = "Just now"
self.net_worth_change_percent = 0.0 new_categories = [] total_assets_val = 0 total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account)
category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val
balance_diff = new_balance - prev_balance
total_liabilities_val = 0 for category_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff
new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_
category["accounts"] = new_accounts
ry_dict in self.account_categories: category = category_dict.copy() new_accounts = [] category_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts
category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_su
new_category_total_balance = ( category_opening_balance + category_balance_change )
tegory_balance_change = 0 category_opening_balance = category["total_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change )
category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = i
category["total_balance"] = round(new_category_total_balance, 2)
tal_balance"] for account_dict in category["accounts"]: account = account_dict.copy() change_factor = random.uniform(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2)
prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories
category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, )
form(0.98, 1.02) prev_balance = account["balance"] new_balance = round(prev_balance * change_factor, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, )
if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_cate
prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] )
or, 2) account["balance"] = new_balance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] )
if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self
if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0
ance new_sparkline = account["sparkline_data"][-5:] + [ {"value": new_balance} ] account["sparkline_data"] = new_sparkline account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0:
else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2,
category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, )
account["last_updated"] = "Just now" new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else:
if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self
category["one_month_change_percent"] = 0.0
new_accounts.append(account) balance_diff = new_balance - prev_balance category_balance_change += balance_diff category["accounts"] = new_accounts new_category_total_balance = ( category_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0
new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None,
if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"]
tegory_opening_balance + category_balance_change ) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category)
new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for i
self.account_categories = new_categories
) category["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories
for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary:
new_assets_summary = []
ry["total_balance"] = round(new_category_total_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = []
self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented ye
for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy)
l_balance, 2) category["one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary:
matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Cre
item_copy = item.copy()
one_month_change"] = round( category["one_month_change"] * random.uniform(0.9, 1.1), 2, ) prev_month_balance_approx = ( category["total_balance"] - category["one_month_change"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy()
if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) ne
matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, )
"] ) if prev_month_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, )
new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warn
if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, )
onth_balance_approx != 0: category["one_month_change_percent"] = round( category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category:
else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary
item_copy["value"] = matching_category["total_balance"]
category["one_month_change"] / prev_month_balance_approx * 100, 1, ) else: category["one_month_change_percent"] = 0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else:
new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warn
item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, )
0.0 if category["category_name"] == "Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy)
new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented yet.")
self.assets_summary = new_assets_summary
"Credit Cards": total_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary
cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented yet.")
new_liabilities_summary = []
_liabilities_val += abs(category["total_balance"]) else: total_assets_val += category["total_balance"] new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = []
cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented yet.")
cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, )
new_categories.append(category) self.account_categories = new_categories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, )
for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented yet.")
cc_total = abs(cc_category["total_balance"]) if cc_category else 0
ories new_assets_summary = [] for item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0
self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented yet.")
for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy)
item in self.assets_summary: item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary:
if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented yet.")
item_copy = item.copy()
item_copy = item.copy() matching_category = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy()
new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented yet.")
if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, )
ry = next( ( cat for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards":
else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented yet.")
item_copy["value"] = cc_total
for cat in new_categories if cat["category_name"] == item_copy["name"] ), None, ) if matching_category: item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else:
new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented yet.")
item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, )
item_copy["value"] = matching_category["total_balance"] else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy)
yield rx.toast.info("Data refreshed (simulated)") @rx.event def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented yet.")
self.liabilities_summary = new_liabilities_summary
item_copy["value"] * random.uniform(0.99, 1.01), 2, ) new_assets_summary.append(item_copy) self.assets_summary = new_assets_summary new_liabilities_summary = [] cc_category = next( (cat for cat in new_categories if cat["category_name"] == "Credit Cards"), None, ) cc_total = abs(cc_category["total_balance"]) if cc_category else 0 for item in self.liabilities_summary: item_copy = item.copy() if item_copy["name"] == "Credit Cards": item_copy["value"] = cc_total else: item_copy["value"] = round( item_copy["value"] * random.uniform(0.995, 1.005), 2, ) new_liabilities_summary.append(item_copy) self.liabilities_summary = new_liabilities_summary yield rx.toast.info("Data refreshed (simulated)") @rx.event
def add_account(self): """Placeholder for adding a new account.""" yield rx.toast.warning("Add Account functionality not implemented yet.")
import reflex.components.radix.themes as rdxt from admin_dashboard.components.customer_details import customer_details from admin_dashboard.components.data_table import data_table from admin_dashboard.components.navigation import navigation def index() -> rx.Component: """The main page layout for the dashboard.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( data_table(), customer_details(), class_name="grid grid-cols-1 md:grid-cols-3", ), class_name="bg-gray-100 w-full h-screen", ), appearance="light", ) def mock_page(title: str) -> rx.Component: """Creates a simple mock page layout.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( rx.el.h1( title, class_name="text-2xl font-bold mb-4 text-gray-800", ), rx
import reflex as rx
import reflex as rx
from admin_dashboard.components.customer_details import customer_details from admin_dashboard.components.data_table import data_table from admin_dashboard.components.navigation import navigation def index() -> rx.Component: """The main page layout for the dashboard.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( data_table(), customer_details(), class_name="grid grid-cols-1 md:grid-cols-3", ), class_name="bg-gray-100 w-full h-screen", ), appearance="light", ) def mock_page(title: str) -> rx.Component: """Creates a simple mock page layout.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( rx.el.h1( title, class_name="text-2xl font-bold mb-4 text-gray-800", ), rx.el.p( f"Content for {titl
import reflex.components.radix.themes as rdxt
import reflex as rx import reflex.components.radix.themes as rdxt
from admin_dashboard.components.data_table import data_table from admin_dashboard.components.navigation import navigation def index() -> rx.Component: """The main page layout for the dashboard.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( data_table(), customer_details(), class_name="grid grid-cols-1 md:grid-cols-3", ), class_name="bg-gray-100 w-full h-screen", ), appearance="light", ) def mock_page(title: str) -> rx.Component: """Creates a simple mock page layout.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( rx.el.h1( title, class_name="text-2xl font-bold mb-4 text-gray-800", ), rx.el.p( f"Content for {title} goes here.", class_name="text-gray-600",
from admin_dashboard.components.customer_details import customer_details
import reflex as rx import reflex.components.radix.themes as rdxt from admin_dashboard.components.customer_details import customer_details
from admin_dashboard.components.navigation import navigation def index() -> rx.Component: """The main page layout for the dashboard.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( data_table(), customer_details(), class_name="grid grid-cols-1 md:grid-cols-3", ), class_name="bg-gray-100 w-full h-screen", ), appearance="light", ) def mock_page(title: str) -> rx.Component: """Creates a simple mock page layout.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( rx.el.h1( title, class_name="text-2xl font-bold mb-4 text-gray-800", ), rx.el.p( f"Content for {title} goes here.", class_name="text-gray-600", ), class_name="p-6", ),
from admin_dashboard.components.data_table import data_table
import reflex as rx import reflex.components.radix.themes as rdxt from admin_dashboard.components.customer_details import customer_details from admin_dashboard.components.data_table import data_table
def index() -> rx.Component: """The main page layout for the dashboard.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( data_table(), customer_details(), class_name="grid grid-cols-1 md:grid-cols-3", ), class_name="bg-gray-100 w-full h-screen", ), appearance="light", ) def mock_page(title: str) -> rx.Component: """Creates a simple mock page layout.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( rx.el.h1( title, class_name="text-2xl font-bold mb-4 text-gray-800", ), rx.el.p( f"Content for {title} goes here.", class_name="text-gray-600", ), class_name="p-6", ), class_name="bg-gray-100 h-screen", ),
from admin_dashboard.components.navigation import navigation
: """The main page layout for the dashboard.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( data_table(), customer_details(), class_name="grid grid-cols-1 md:grid-cols-3", ), class_name="bg-gray-100 w-full h-screen", ), appearance="light", ) def mock_page(title: str) -> rx.Component: """Creates a simple mock page layout.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( rx.el.h1( title, class_name="text-2xl font-bold mb-4 text-gray-800", ), rx.el.p( f"Content for {title} goes here.", class_name="text-gray-600", ), class_name="p-6", ), class_name="bg-gray-100 h-screen", ), appearance="light", )
def hr_portal_page() -> rx.Component: """Mock HR Portal page.""" return mock_page("HR Portal") def customer_success_hub_page() -> rx.Component: """Mock Customer Success Hub page.""" return mock_page("Customer Success Hub") app = rx.App(theme=rx.theme(appearance="light"), stylesheets=[]) app.add_page(index, route="/") app.add_page(sales_pipeline_page, route="/sales-pipeline") app.add_page(hr_portal_page, route="/hr-portal") app.add_page(customer_success_hub_page, route="/customer-success-hub")
def sales_pipeline_page() -> rx.Component: """Mock Sales Pipeline page.""" return mock_page("Sales Pipeline")
rx.el.div( data_table(), customer_details(), class_name="grid grid-cols-1 md:grid-cols-3", ), class_name="bg-gray-100 w-full h-screen", ), appearance="light", ) def mock_page(title: str) -> rx.Component: """Creates a simple mock page layout.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( rx.el.h1( title, class_name="text-2xl font-bold mb-4 text-gray-800", ), rx.el.p( f"Content for {title} goes here.", class_name="text-gray-600", ), class_name="p-6", ), class_name="bg-gray-100 h-screen", ), appearance="light", ) def sales_pipeline_page() -> rx.Component: """Mock Sales Pipeline page.""" return mock_page("Sales Pipeline")
def customer_success_hub_page() -> rx.Component: """Mock Customer Success Hub page.""" return mock_page("Customer Success Hub") app = rx.App(theme=rx.theme(appearance="light"), stylesheets=[]) app.add_page(index, route="/") app.add_page(sales_pipeline_page, route="/sales-pipeline") app.add_page(hr_portal_page, route="/hr-portal") app.add_page(customer_success_hub_page, route="/customer-success-hub")
def hr_portal_page() -> rx.Component: """Mock HR Portal page.""" return mock_page("HR Portal")
class_name="grid grid-cols-1 md:grid-cols-3", ), class_name="bg-gray-100 w-full h-screen", ), appearance="light", ) def mock_page(title: str) -> rx.Component: """Creates a simple mock page layout.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( rx.el.h1( title, class_name="text-2xl font-bold mb-4 text-gray-800", ), rx.el.p( f"Content for {title} goes here.", class_name="text-gray-600", ), class_name="p-6", ), class_name="bg-gray-100 h-screen", ), appearance="light", ) def sales_pipeline_page() -> rx.Component: """Mock Sales Pipeline page.""" return mock_page("Sales Pipeline") def hr_portal_page() -> rx.Component: """Mock HR Portal page.""" return mock_page("HR Portal")
app = rx.App(theme=rx.theme(appearance="light"), stylesheets=[]) app.add_page(index, route="/") app.add_page(sales_pipeline_page, route="/sales-pipeline") app.add_page(hr_portal_page, route="/hr-portal") app.add_page(customer_success_hub_page, route="/customer-success-hub")
def customer_success_hub_page() -> rx.Component: """Mock Customer Success Hub page.""" return mock_page("Customer Success Hub")
arance="light", ) def mock_page(title: str) -> rx.Component: """Creates a simple mock page layout.""" return rdxt.theme( rx.el.div( navigation(), rx.el.div( rx.el.h1( title, class_name="text-2xl font-bold mb-4 text-gray-800", ), rx.el.p( f"Content for {title} goes here.", class_name="text-gray-600", ), class_name="p-6", ), class_name="bg-gray-100 h-screen", ), appearance="light", ) def sales_pipeline_page() -> rx.Component: """Mock Sales Pipeline page.""" return mock_page("Sales Pipeline") def hr_portal_page() -> rx.Component: """Mock HR Portal page.""" return mock_page("HR Portal") def customer_success_hub_page() -> rx.Component: """Mock Customer Success Hub page.""" return mock_page("Customer Success Hub")
app.add_page(index, route="/") app.add_page(sales_pipeline_page, route="/sales-pipeline") app.add_page(hr_portal_page, route="/hr-portal") app.add_page(customer_success_hub_page, route="/customer-success-hub")
app = rx.App(theme=rx.theme(appearance="light"), stylesheets=[])
import reflex.components.recharts as recharts from admin_dashboard.states.dashboard_state import ( CustomerData, DashboardState, ) def detail_item(label: str, value: rx.Var[str]) -> rx.Component: """Displays a single detail item with label and value.""" return rx.el.div( rx.el.dt( label, class_name="text-sm font-medium text-gray-500", ), rx.el.dd(value, class_name="mt-1 text-sm text-gray-900"), class_name="py-2", ) def license_stat(label: str, value: rx.Var[int], change: rx.Var[int]) -> rx.Component: """Displays a license statistic card.""" return rx.el.div( rx.el.p( label, class_name="text-sm font-medium text-gray-500", ), rx.el.div( rx.el.span( value, class_name="text-3xl font-bold text-gray-900 mr-2", ), rx.el.span( rx.icon( rx.cond(change > 0,
import reflex as rx
import reflex as rx
from admin_dashboard.states.dashboard_state import ( CustomerData, DashboardState, ) def detail_item(label: str, value: rx.Var[str]) -> rx.Component: """Displays a single detail item with label and value.""" return rx.el.div( rx.el.dt( label, class_name="text-sm font-medium text-gray-500", ), rx.el.dd(value, class_name="mt-1 text-sm text-gray-900"), class_name="py-2", ) def license_stat(label: str, value: rx.Var[int], change: rx.Var[int]) -> rx.Component: """Displays a license statistic card.""" return rx.el.div( rx.el.p( label, class_name="text-sm font-medium text-gray-500", ), rx.el.div( rx.el.span( value, class_name="text-3xl font-bold text-gray-900 mr-2", ), rx.el.span( rx.icon( rx.cond(change > 0, "arrow-up", "arrow-down"),
import reflex.components.recharts as recharts
import reflex as rx import reflex.components.recharts as recharts
def detail_item(label: str, value: rx.Var[str]) -> rx.Component: """Displays a single detail item with label and value.""" return rx.el.div( rx.el.dt( label, class_name="text-sm font-medium text-gray-500", ), rx.el.dd(value, class_name="mt-1 text-sm text-gray-900"), class_name="py-2", ) def license_stat(label: str, value: rx.Var[int], change: rx.Var[int]) -> rx.Component: """Displays a license statistic card.""" return rx.el.div( rx.el.p( label, class_name="text-sm font-medium text-gray-500", ), rx.el.div( rx.el.span( value, class_name="text-3xl font-bold text-gray-900 mr-2", ), rx.el.span( rx.icon( rx.cond(change > 0, "arrow-up", "arrow-down"), size=16, class_name="mr-1", ), rx.cond(ch
from admin_dashboard.states.dashboard_state import ( CustomerData, DashboardState, )
import reflex as rx import reflex.components.recharts as recharts from admin_dashboard.states.dashboard_state import ( CustomerData, DashboardState, )
def license_stat(label: str, value: rx.Var[int], change: rx.Var[int]) -> rx.Component: """Displays a license statistic card.""" return rx.el.div( rx.el.p( label, class_name="text-sm font-medium text-gray-500", ), rx.el.div( rx.el.span( value, class_name="text-3xl font-bold text-gray-900 mr-2", ), rx.el.span( rx.icon( rx.cond(change > 0, "arrow-up", "arrow-down"), size=16, class_name="mr-1", ), rx.cond(change < 0, change * -1, change), "%", class_name=rx.cond( change > 0, "text-sm font-medium text-green-600 bg-green-100 px-2 py-0.5 rounded-full inline-flex items-center", "text-sm font-medium text-red-600 bg-red-100 px-2 py-0.5 rounded-full inline-flex items-center",
def detail_item(label: str, value: rx.Var[str]) -> rx.Component: """Displays a single detail item with label and value.""" return rx.el.div( rx.el.dt( label, class_name="text-sm font-medium text-gray-500", ), rx.el.dd(value, class_name="mt-1 text-sm text-gray-900"), class_name="py-2", )
class_name="text-3xl font-bold text-gray-900 mr-2", ), rx.el.span( rx.icon( rx.cond(change > 0, "arrow-up", "arrow-down"), size=16, class_name="mr-1", ), rx.cond(change < 0, change * -1, change), "%", class_name=rx.cond( change > 0, "text-sm font-medium text-green-600 bg-green-100 px-2 py-0.5 rounded-full inline-flex items-center", "text-sm font-medium text-red-600 bg-red-100 px-2 py-0.5 rounded-full inline-flex items-center", ), ), class_name="flex items-baseline", ), class_name="p-4 bg-white rounded-lg border border-gray-200 shadow-sm", ) def customer_details_panel( customer: CustomerData, ) -> rx.Component: """Panel showing detailed information about a selected customer."""
return rx.el.div( rx.el.h3( customer["customer_name"], class_name="text-xl font-semibold text-gray-900 mb-4", ), rx.el.div( rx.el.h4( "Usage", class_name="text-md font-medium text-gray-700 mb-2", ), rx.el.div( rx.el.p( usage_percentage.to_string() + "%", class_name="text-5xl font-bold text-emerald-600 text-center", ), class_name="flex items-center justify-center w-32 h-32 rounded-full bg-emerald-50 border-4 border-emerald-200 mx-auto mb-4", ), class_name="mb-6 p-4 bg-white rounded-lg border border-gray-200 shadow-sm", ), rx.el.div( rx.el.h4( "Details", class_name="text-md font-medium text-gray-700 mb-2", ), rx.el.dl( detail_item( "Revenue"
usage_percentage = rx.cond( customer["licenses"] > 0, round(customer["active_licenses"] * 100 / customer["licenses"]).to(int), 0, )
import reflex as rx from admin_dashboard.states.dashboard_state import ( CustomerData, DashboardState, SortColumn, ) def platform_tag(platform: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the platform.""" return rx.el.span( platform, class_name=rx.match( platform, ( "Windows", "px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800", ), ( "macOS", "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ( "iOS", "px-2 py-1 text-xs font-medium rounded-full bg-yellow-100 text-yellow-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ) def industry_tag(industry: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the industry.""" return rx.el.
from typing import Optional, Tuple
from typing import Optional, Tuple
from admin_dashboard.states.dashboard_state import ( CustomerData, DashboardState, SortColumn, ) def platform_tag(platform: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the platform.""" return rx.el.span( platform, class_name=rx.match( platform, ( "Windows", "px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800", ), ( "macOS", "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ( "iOS", "px-2 py-1 text-xs font-medium rounded-full bg-yellow-100 text-yellow-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ) def industry_tag(industry: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the industry.""" return rx.el.span( industr
import reflex as rx
from typing import Optional, Tuple import reflex as rx
def platform_tag(platform: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the platform.""" return rx.el.span( platform, class_name=rx.match( platform, ( "Windows", "px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800", ), ( "macOS", "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ( "iOS", "px-2 py-1 text-xs font-medium rounded-full bg-yellow-100 text-yellow-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ) def industry_tag(industry: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the industry.""" return rx.el.span( industry, class_name=rx.match( industry, ( "Finance",
from admin_dashboard.states.dashboard_state import ( CustomerData, DashboardState, SortColumn, )
from typing import Optional, Tuple import reflex as rx from admin_dashboard.states.dashboard_state import ( CustomerData, DashboardState, SortColumn, )
def industry_tag(industry: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the industry.""" return rx.el.span( industry, class_name=rx.match( industry, ( "Finance", "px-2 py-1 text-xs font-medium rounded-full bg-pink-100 text-pink-800", ), ( "Healthcare", "px-2 py-1 text-xs font-medium rounded-full bg-purple-100 text-purple-800", ), ( "Education", "px-2 py-1 text-xs font-medium rounded-full bg-orange-100 text-orange-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ) def sort_icon(column_key: SortColumn) -> rx.Component: """Displays sort direction icon or a neutral sortable indicator.""" icon_base_class = ( "ml-1 inline-block w-3 h-3 transition-colors duration-150 ease-in-out" ) activ
def platform_tag(platform: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the platform.""" return rx.el.span( platform, class_name=rx.match( platform, ( "Windows", "px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800", ), ( "macOS", "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ( "iOS", "px-2 py-1 text-xs font-medium rounded-full bg-yellow-100 text-yellow-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), )
from typing import Optional, Tuple import reflex as rx from admin_dashboard.states.dashboard_state import ( CustomerData, DashboardState, SortColumn, ) def platform_tag(platform: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the platform.""" return rx.el.span( platform, class_name=rx.match( platform, ( "Windows", "px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800", ), ( "macOS", "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ( "iOS", "px-2 py-1 text-xs font-medium rounded-full bg-yellow-100 text-yellow-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), )
def sort_icon(column_key: SortColumn) -> rx.Component: """Displays sort direction icon or a neutral sortable indicator.""" icon_base_class = ( "ml-1 inline-block w-3 h-3 transition-colors duration-150 ease-in-out" ) active_icon_class = f"{icon_base_class} text-gray-700" inactive_icon_class = f"{icon_base_class} text-gray-400 group-hover:text-gray-600" is_active_column = DashboardState.sort_column == column_key return rx.cond( is_active_column, rx.cond( DashboardState.sort_order == "asc", rx.icon( "arrow-up", size=12, class_name=active_icon_class, ), rx.icon( "arrow-down", size=12, class_name=active_icon_class, ), ), rx.icon( "chevrons-up-down", size=12, class_name=inactive_icon_class, ), ) def sortable_table_heade
def industry_tag(industry: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the industry.""" return rx.el.span( industry, class_name=rx.match( industry, ( "Finance", "px-2 py-1 text-xs font-medium rounded-full bg-pink-100 text-pink-800", ), ( "Healthcare", "px-2 py-1 text-xs font-medium rounded-full bg-purple-100 text-purple-800", ), ( "Education", "px-2 py-1 text-xs font-medium rounded-full bg-orange-100 text-orange-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), )
( "iOS", "px-2 py-1 text-xs font-medium rounded-full bg-yellow-100 text-yellow-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ) def industry_tag(industry: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the industry.""" return rx.el.span( industry, class_name=rx.match( industry, ( "Finance", "px-2 py-1 text-xs font-medium rounded-full bg-pink-100 text-pink-800", ), ( "Healthcare", "px-2 py-1 text-xs font-medium rounded-full bg-purple-100 text-purple-800", ), ( "Education", "px-2 py-1 text-xs font-medium rounded-full bg-orange-100 text-orange-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), )
def sortable_table_header(col_name: str, column_key: SortColumn) -> rx.Component: """Renders a sortable table header cell.""" base_class = "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider group" sortable_class = f"{base_class} cursor-pointer" text_align_class = rx.match( col_name, ("Revenue", "text-right"), ("Licenses", "text-center"), ("Active licenses", "text-center"), "text-left", ) justify_content_val = rx.match( col_name, ("Revenue", "flex-end"), ("Licenses", "center"), ("Active licenses", "center"), "flex-start", ) combined_class = f"{sortable_class} {text_align_class}" header_content_inner = rx.el.div( col_name, sort_icon(column_key), class_name="flex items-center group-hover:text-gray-700 transition-colors duration-150 ease-in-out", style={"justify_content": justify_content_val}, ) return rx
def sort_icon(column_key: SortColumn) -> rx.Component: """Displays sort direction icon or a neutral sortable indicator.""" icon_base_class = ( "ml-1 inline-block w-3 h-3 transition-colors duration-150 ease-in-out" ) active_icon_class = f"{icon_base_class} text-gray-700" inactive_icon_class = f"{icon_base_class} text-gray-400 group-hover:text-gray-600" is_active_column = DashboardState.sort_column == column_key return rx.cond( is_active_column, rx.cond( DashboardState.sort_order == "asc", rx.icon( "arrow-up", size=12, class_name=active_icon_class, ), rx.icon( "arrow-down", size=12, class_name=active_icon_class, ), ), rx.icon( "chevrons-up-down", size=12, class_name=inactive_icon_class, ), )
), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ) def industry_tag(industry: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the industry.""" return rx.el.span( industry, class_name=rx.match( industry, ( "Finance", "px-2 py-1 text-xs font-medium rounded-full bg-pink-100 text-pink-800", ), ( "Healthcare", "px-2 py-1 text-xs font-medium rounded-full bg-purple-100 text-purple-800", ), ( "Education", "px-2 py-1 text-xs font-medium rounded-full bg-orange-100 text-orange-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ) def sort_icon(column_key: SortColumn) -> rx.Component: """Displays sort direction icon or a neutral sortable indicator."""
active_icon_class = f"{icon_base_class} text-gray-700" inactive_icon_class = f"{icon_base_class} text-gray-400 group-hover:text-gray-600" is_active_column = DashboardState.sort_column == column_key return rx.cond( is_active_column, rx.cond( DashboardState.sort_order == "asc", rx.icon( "arrow-up", size=12, class_name=active_icon_class, ), rx.icon( "arrow-down", size=12, class_name=active_icon_class, ), ), rx.icon( "chevrons-up-down", size=12, class_name=inactive_icon_class, ), ) def sortable_table_header(col_name: str, column_key: SortColumn) -> rx.Component: """Renders a sortable table header cell.""" base_class = "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider group" sortable_class = f"{base
icon_base_class = ( "ml-1 inline-block w-3 h-3 transition-colors duration-150 ease-in-out" )
) def industry_tag(industry: rx.Var[str]) -> rx.Component: """Renders a colored tag based on the industry.""" return rx.el.span( industry, class_name=rx.match( industry, ( "Finance", "px-2 py-1 text-xs font-medium rounded-full bg-pink-100 text-pink-800", ), ( "Healthcare", "px-2 py-1 text-xs font-medium rounded-full bg-purple-100 text-purple-800", ), ( "Education", "px-2 py-1 text-xs font-medium rounded-full bg-orange-100 text-orange-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ) def sort_icon(column_key: SortColumn) -> rx.Component: """Displays sort direction icon or a neutral sortable indicator.""" icon_base_class = ( "ml-1 inline-block w-3 h-3 transition-colors duration-150 ease-in-out" )
inactive_icon_class = f"{icon_base_class} text-gray-400 group-hover:text-gray-600" is_active_column = DashboardState.sort_column == column_key return rx.cond( is_active_column, rx.cond( DashboardState.sort_order == "asc", rx.icon( "arrow-up", size=12, class_name=active_icon_class, ), rx.icon( "arrow-down", size=12, class_name=active_icon_class, ), ), rx.icon( "chevrons-up-down", size=12, class_name=inactive_icon_class, ), ) def sortable_table_header(col_name: str, column_key: SortColumn) -> rx.Component: """Renders a sortable table header cell.""" base_class = "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider group" sortable_class = f"{base_class} cursor-pointer" text_align_class = rx.match(
active_icon_class = f"{icon_base_class} text-gray-700"
nent: """Renders a colored tag based on the industry.""" return rx.el.span( industry, class_name=rx.match( industry, ( "Finance", "px-2 py-1 text-xs font-medium rounded-full bg-pink-100 text-pink-800", ), ( "Healthcare", "px-2 py-1 text-xs font-medium rounded-full bg-purple-100 text-purple-800", ), ( "Education", "px-2 py-1 text-xs font-medium rounded-full bg-orange-100 text-orange-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ) def sort_icon(column_key: SortColumn) -> rx.Component: """Displays sort direction icon or a neutral sortable indicator.""" icon_base_class = ( "ml-1 inline-block w-3 h-3 transition-colors duration-150 ease-in-out" ) active_icon_class = f"{icon_base_class} text-gray-700"
is_active_column = DashboardState.sort_column == column_key return rx.cond( is_active_column, rx.cond( DashboardState.sort_order == "asc", rx.icon( "arrow-up", size=12, class_name=active_icon_class, ), rx.icon( "arrow-down", size=12, class_name=active_icon_class, ), ), rx.icon( "chevrons-up-down", size=12, class_name=inactive_icon_class, ), ) def sortable_table_header(col_name: str, column_key: SortColumn) -> rx.Component: """Renders a sortable table header cell.""" base_class = "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider group" sortable_class = f"{base_class} cursor-pointer" text_align_class = rx.match( col_name, ("Revenue", "text-right"), ("Licenses", "text-center"),
inactive_icon_class = f"{icon_base_class} text-gray-400 group-hover:text-gray-600"
industry, class_name=rx.match( industry, ( "Finance", "px-2 py-1 text-xs font-medium rounded-full bg-pink-100 text-pink-800", ), ( "Healthcare", "px-2 py-1 text-xs font-medium rounded-full bg-purple-100 text-purple-800", ), ( "Education", "px-2 py-1 text-xs font-medium rounded-full bg-orange-100 text-orange-800", ), "px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800", ), ) def sort_icon(column_key: SortColumn) -> rx.Component: """Displays sort direction icon or a neutral sortable indicator.""" icon_base_class = ( "ml-1 inline-block w-3 h-3 transition-colors duration-150 ease-in-out" ) active_icon_class = f"{icon_base_class} text-gray-700" inactive_icon_class = f"{icon_base_class} text-gray-400 group-hover:text-gray-600"
return rx.cond( is_active_column, rx.cond( DashboardState.sort_order == "asc", rx.icon( "arrow-up", size=12, class_name=active_icon_class, ), rx.icon( "arrow-down", size=12, class_name=active_icon_class, ), ), rx.icon( "chevrons-up-down", size=12, class_name=inactive_icon_class, ), ) def sortable_table_header(col_name: str, column_key: SortColumn) -> rx.Component: """Renders a sortable table header cell.""" base_class = "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider group" sortable_class = f"{base_class} cursor-pointer" text_align_class = rx.match( col_name, ("Revenue", "text-right"), ("Licenses", "text-center"), ("Active licenses", "text-center"), "text-left"
is_active_column = DashboardState.sort_column == column_key
table indicator.""" icon_base_class = ( "ml-1 inline-block w-3 h-3 transition-colors duration-150 ease-in-out" ) active_icon_class = f"{icon_base_class} text-gray-700" inactive_icon_class = f"{icon_base_class} text-gray-400 group-hover:text-gray-600" is_active_column = DashboardState.sort_column == column_key return rx.cond( is_active_column, rx.cond( DashboardState.sort_order == "asc", rx.icon( "arrow-up", size=12, class_name=active_icon_class, ), rx.icon( "arrow-down", size=12, class_name=active_icon_class, ), ), rx.icon( "chevrons-up-down", size=12, class_name=inactive_icon_class, ), ) def sortable_table_header(col_name: str, column_key: SortColumn) -> rx.Component: """Renders a sortable table header cell."""
sortable_class = f"{base_class} cursor-pointer" text_align_class = rx.match( col_name, ("Revenue", "text-right"), ("Licenses", "text-center"), ("Active licenses", "text-center"), "text-left", ) justify_content_val = rx.match( col_name, ("Revenue", "flex-end"), ("Licenses", "center"), ("Active licenses", "center"), "flex-start", ) combined_class = f"{sortable_class} {text_align_class}" header_content_inner = rx.el.div( col_name, sort_icon(column_key), class_name="flex items-center group-hover:text-gray-700 transition-colors duration-150 ease-in-out", style={"justify_content": justify_content_val}, ) return rx.el.th( header_content_inner, scope="col", class_name=combined_class, on_click=lambda: DashboardState.sort_by(column_key), ) def non_sortable_table_header( col_name: str, ) -> rx.Component:
base_class = "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider group"
n-150 ease-in-out" ) active_icon_class = f"{icon_base_class} text-gray-700" inactive_icon_class = f"{icon_base_class} text-gray-400 group-hover:text-gray-600" is_active_column = DashboardState.sort_column == column_key return rx.cond( is_active_column, rx.cond( DashboardState.sort_order == "asc", rx.icon( "arrow-up", size=12, class_name=active_icon_class, ), rx.icon( "arrow-down", size=12, class_name=active_icon_class, ), ), rx.icon( "chevrons-up-down", size=12, class_name=inactive_icon_class, ), ) def sortable_table_header(col_name: str, column_key: SortColumn) -> rx.Component: """Renders a sortable table header cell.""" base_class = "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider group"
text_align_class = rx.match( col_name, ("Revenue", "text-right"), ("Licenses", "text-center"), ("Active licenses", "text-center"), "text-left", ) justify_content_val = rx.match( col_name, ("Revenue", "flex-end"), ("Licenses", "center"), ("Active licenses", "center"), "flex-start", ) combined_class = f"{sortable_class} {text_align_class}" header_content_inner = rx.el.div( col_name, sort_icon(column_key), class_name="flex items-center group-hover:text-gray-700 transition-colors duration-150 ease-in-out", style={"justify_content": justify_content_val}, ) return rx.el.th( header_content_inner, scope="col", class_name=combined_class, on_click=lambda: DashboardState.sort_by(column_key), ) def non_sortable_table_header( col_name: str, ) -> rx.Component: """Renders a non-sortable table header cell."""
sortable_class = f"{base_class} cursor-pointer"