Skip to content

Commit

Permalink
Minor UI cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Shpigford committed Aug 20, 2024
1 parent b797879 commit e9f5492
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/views/stocks/news/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<%= news["publisher_name"] %> &bull; <%= time_ago_in_words(news["published_at"]).gsub(/about |less than |almost |over /, '').gsub(' ', '').gsub('hours', 'h').gsub('days', 'd').gsub('weeks', 'w').gsub('months', 'm').gsub('years', 'y').gsub('hour', 'h').gsub('day', 'd').gsub('week', 'w').gsub('month', 'm').gsub('year', 'y') %>
</p>
</div>
<%= image_tag news["image_url"], alt: news["title"], class: "w-10 h-10 object-cover rounded-md" %>
<%= image_tag news["image_url"], class: "w-10 h-10 object-cover rounded-md" %>
<% end %>
<% end %>
<% else %>
Expand Down
42 changes: 22 additions & 20 deletions app/views/stocks/similar_stocks/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<%= turbo_frame_tag "stock_similar_stocks" do %>
<div class="mt-4">
<span class="text-base text-gray-800">Related stocks</span>
<div class="space-y-3 mt-2">
<% @similar_stocks_data.each_with_index do |stock_data, index| %>
<%= link_to stock_path(stock_data[:symbol]), class: "block", data: { turbo: false } do %>
<div class="flex items-center justify-between space-x-4 <%= index < @similar_stocks_data.size - 1 ? 'border-b border-gray-200 pb-3' : '' %>">
<div class="flex items-center">
<img src="https://logo.synthfinance.com/ticker/<%= stock_data[:symbol] %>" alt="<%= stock_data[:symbol] %>" class="w-8 h-8 rounded-full mr-2">
<div>
<h4 class="text-sm font-medium"><%= stock_data[:name] %></h4>
<p class="text-sm text-gray-500"><%= stock_data[:symbol] %></p>
<% if @similar_stocks_data.present? %>
<div class="mt-4">
<span class="text-base text-gray-800">Related stocks</span>
<div class="space-y-3 mt-2">
<% @similar_stocks_data.each_with_index do |stock_data, index| %>
<%= link_to stock_path(stock_data[:symbol]), class: "block", data: { turbo: false } do %>
<div class="flex items-center justify-between space-x-4 <%= index < @similar_stocks_data.size - 1 ? 'border-b border-gray-200 pb-3' : '' %>">
<div class="flex items-center">
<img src="https://logo.synthfinance.com/ticker/<%= stock_data[:symbol] %>" alt="<%= stock_data[:symbol] %>" class="w-8 h-8 rounded-full mr-2">
<div>
<h4 class="text-sm font-medium"><%= stock_data[:name] %></h4>
<p class="text-sm text-gray-500"><%= stock_data[:symbol] %></p>
</div>
</div>
<div class="text-right">
<p class="font-medium text-sm <%= stock_data[:price_change] >= 0 ? 'text-green-500' : 'text-red-500' %>"><%= stock_data[:price_change] >= 0 ? '+' : '' %><%= number_to_currency(stock_data[:price_change]) %></p>
<p class="text-sm <%= stock_data[:price_change] >= 0 ? 'text-green-500' : 'text-red-500' %>">
(<%= stock_data[:percent_change] %>%)
</p>
</div>
</div>
<div class="text-right">
<p class="font-medium text-sm <%= stock_data[:price_change] >= 0 ? 'text-green-500' : 'text-red-500' %>"><%= stock_data[:price_change] >= 0 ? '+' : '' %><%= number_to_currency(stock_data[:price_change]) %></p>
<p class="text-sm <%= stock_data[:price_change] >= 0 ? 'text-green-500' : 'text-red-500' %>">
(<%= stock_data[:percent_change] %>%)
</p>
</div>
</div>
<% end %>
<% end %>
<% end %>
</div>
</div>
</div>
<% end %>
<% end %>

0 comments on commit e9f5492

Please sign in to comment.