diff --git a/lib/basket/websocket/alpaca.ex b/lib/basket/websocket/alpaca.ex
index b1bb8de..04323de 100644
--- a/lib/basket/websocket/alpaca.ex
+++ b/lib/basket/websocket/alpaca.ex
@@ -36,6 +36,8 @@ defmodule Basket.Websocket.Alpaca do
@impl true
def handle_disconnect(disconnect_map, state) do
+ IO.inspect("DISC: #{inspect(disconnect_map)}")
+ IO.inspect("STATE: #{inspect(state)}")
Logger.info("Alpaca websocket disconnected.")
super(disconnect_map, state)
end
@@ -61,6 +63,8 @@ defmodule Basket.Websocket.Alpaca do
@impl true
def handle_frame({_tpe, msg}, state) do
+ IO.inspect("FRAME: #{inspect(msg)}")
+
case Jason.decode(msg) do
{:ok, decoded_message} ->
Enum.each(decoded_message, &process_message/1)
diff --git a/lib/basket_web/components/core_components.ex b/lib/basket_web/components/core_components.ex
index e8190aa..a912150 100644
--- a/lib/basket_web/components/core_components.ex
+++ b/lib/basket_web/components/core_components.ex
@@ -721,16 +721,20 @@ defmodule BasketWeb.CoreComponents do
defp diff_color(col, row) do
key = Map.get(col, :key)
- field = row[key]
-
- if is_number(field.value) do
- case field.value - field.prev_value do
- x when x > 0 -> "bg-emerald-300 text-emerald-900"
- x when x < 0 -> "bg-rose-300 text-rose-900"
- _ -> ""
- end
- else
+ if is_nil(key) do
""
+ else
+ field = row[key]
+
+ if field != nil && is_number(field.value) && is_number(field.prev_value) do
+ case field.value - field.prev_value do
+ x when x > 0 -> "bg-emerald-300 text-emerald-900"
+ x when x < 0 -> "bg-rose-300 text-rose-900"
+ _ -> ""
+ end
+ else
+ ""
+ end
end
end
end
diff --git a/lib/basket_web/components/dark_mode_toggle.ex b/lib/basket_web/components/dark_mode_toggle.ex
index 17c6c71..c772b7c 100644
--- a/lib/basket_web/components/dark_mode_toggle.ex
+++ b/lib/basket_web/components/dark_mode_toggle.ex
@@ -10,14 +10,17 @@ defmodule BasketWeb.Components.DarkModeToggle do
def render(assigns) do
~F"""
-
-
-
-
"""
+
+ # ~F"""
+ #
+ #
+ #
+ #
+ # """
end
end
diff --git a/lib/basket_web/components/search_input.ex b/lib/basket_web/components/search_input.ex
index bb38dd2..b56cadd 100644
--- a/lib/basket_web/components/search_input.ex
+++ b/lib/basket_web/components/search_input.ex
@@ -30,7 +30,7 @@ defmodule BasketWeb.Components.SearchInput do
<.input
name="selected-ticker"
value=""
- field={@ticker_search_form["ticker_search_field"]}
+ field={assigns.ticker_search_form["ticker_search_field"]}
list="tickers"
phx-debounce="500"
errors={["TODO"]}
diff --git a/lib/basket_web/components/ticker_bar_table.ex b/lib/basket_web/components/ticker_bar_table.ex
index 6607180..cf346b8 100644
--- a/lib/basket_web/components/ticker_bar_table.ex
+++ b/lib/basket_web/components/ticker_bar_table.ex
@@ -20,6 +20,8 @@ defmodule BasketWeb.Components.TickerBarTable do
end
def render(assigns) do
+ IO.inspect("ROWS: #{@rows}")
+
~F"""