-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from sgobotta/feature/upgrade-to-daily-graphs-…
…for-dollar-quotes feature/upgrade to daily graphs for dollar quotes
- Loading branch information
Showing
9 changed files
with
244 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 94 additions & 51 deletions
145
lib/ex_finance_web/live/public/currency_live/show.html.heex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,111 @@ | ||
<.header> | ||
<div id={@currency.id} class="p-4 sm:w-1/2 lg:w-1/3 w-full cursor-default"> | ||
<div | ||
id={@currency.id} | ||
class="p-4 xs:w-full sm:w-2/3 md:w-2/3 lg:w-1/2 xl:w-1/3 w-full cursor-default" | ||
> | ||
<div | ||
class="flex items-center justify-between p-4 rounded-lg bg-white shadow-zinc-500 shadow-md duration-500 | ||
class="p-4 rounded-lg bg-white shadow-zinc-500 shadow-md duration-500 | ||
border-zinc-300 border-[1px]" | ||
id={"currencies-#{@currency.id}-card"} | ||
> | ||
<div class="text-left"> | ||
<h2 class={"text-gray-900 text-lg font-bold border-b border-#{get_color_by_currency_type(@currency)}-500"}> | ||
<%= @currency.name %> | ||
</h2> | ||
<%= if @currency.info_type == :reference do %> | ||
<h3 class={"mt-2 text-xl font-bold text-#{get_color_by_currency_type(@currency)}-500 text-left cursor-text"}> | ||
<%= render_price(@currency.variation_price) %> | ||
</h3> | ||
<% end %> | ||
<%= if @currency.info_type == :market do %> | ||
<h3 class={"mt-2 text-xl font-bold text-#{get_color_by_currency_type(@currency)}-500 text-left cursor-text"}> | ||
<%= render_price(@currency.buy_price) %> - <%= render_price( | ||
@currency.sell_price | ||
) %> | ||
</h3> | ||
<div class="flex items-center justify-between"> | ||
<div class="text-left"> | ||
<h2 class={"text-gray-900 text-lg font-bold border-b border-#{get_color_by_currency_type(@currency)}-500"}> | ||
<%= @currency.name %> | ||
</h2> | ||
<%= if @currency.info_type == :reference do %> | ||
<h3 class={"mt-2 text-xl font-bold text-#{get_color_by_currency_type(@currency)}-500 text-left cursor-text"}> | ||
<%= render_price(@currency.variation_price) %> | ||
</h3> | ||
<% end %> | ||
<%= if @currency.info_type == :market do %> | ||
<h3 class={"mt-2 text-xl font-bold text-#{get_color_by_currency_type(@currency)}-500 text-left cursor-text"}> | ||
<%= render_price(@currency.buy_price) %> - <%= render_price( | ||
@currency.sell_price | ||
) %> | ||
</h3> | ||
<p class="text-sm font-semibold text-gray-400 text-left"> | ||
Spread: | ||
<span class={"text-#{get_color_by_currency_type(@currency)}-500"}> | ||
<%= render_spread(@currency) %> | ||
</span> | ||
</p> | ||
<% end %> | ||
<p class="text-sm font-semibold text-gray-400 text-left"> | ||
Spread: | ||
<span class={"text-#{get_color_by_currency_type(@currency)}-500"}> | ||
<%= render_spread(@currency) %> | ||
</span> | ||
<%= render_update_time(@currency) %> | ||
</p> | ||
<% end %> | ||
<p class="text-sm font-semibold text-gray-400 text-left"> | ||
<%= render_update_time(@currency) %> | ||
</p> | ||
<button class={" | ||
cursor-default | ||
text-sm mt-6 px-4 py-2 | ||
bg-#{get_color_by_currency_type(@currency)}-400 text-white | ||
rounded-lg tracking-wider | ||
hover:bg-#{get_color_by_currency_type(@currency)}-300 | ||
outline-none | ||
"}> | ||
<%= render_info_type(@currency) %> | ||
</button> | ||
<button class={" | ||
cursor-default | ||
text-sm mt-6 px-4 py-2 | ||
bg-#{get_color_by_currency_type(@currency)}-400 text-white | ||
rounded-lg tracking-wider | ||
hover:bg-#{get_color_by_currency_type(@currency)}-300 | ||
outline-none | ||
"}> | ||
<%= render_info_type(@currency) %> | ||
</button> | ||
</div> | ||
<div class={" | ||
bg-gradient-to-tr | ||
from-#{get_color_by_price_direction(@currency)}-400 to-#{get_color_by_price_direction(@currency)}-300 | ||
w-32 h-32 | ||
rounded-full | ||
shadow-2xl shadow-#{get_color_by_price_direction(@currency)}-400 | ||
border-#{get_color_by_price_direction(@currency)}-500 border-dashed border-2 | ||
flex justify-center items-center | ||
"}> | ||
<div> | ||
<h1 class="text-white text-2xl"> | ||
<%= render_variation_percent(@currency) %> | ||
</h1> | ||
</div> | ||
</div> | ||
</div> | ||
<div class={" | ||
bg-gradient-to-tr | ||
from-#{get_color_by_price_direction(@currency)}-400 to-#{get_color_by_price_direction(@currency)}-300 | ||
w-32 h-32 | ||
rounded-full | ||
shadow-2xl shadow-#{get_color_by_price_direction(@currency)}-400 | ||
border-#{get_color_by_price_direction(@currency)}-500 border-dashed border-2 | ||
flex justify-center items-center | ||
"}> | ||
<div> | ||
<h1 class="text-white text-2xl"> | ||
<%= render_variation_percent(@currency) %> | ||
</h1> | ||
<div class="w-full cursor-default mt-4"> | ||
<div class="inline-flex w-full justify-evenly font-normal"> | ||
<button | ||
class={" | ||
#{if @interval == :daily, | ||
do: "text-base text-#{get_color_by_currency_type(@currency)}-500 font-semibold", | ||
else: "text-sm hover:text-zinc-500" | ||
} | ||
"} | ||
phx-click="interval_change" | ||
phx-value-interval={:daily} | ||
> | ||
<%= gettext("Daily") %> | ||
</button> | ||
<button | ||
class={" | ||
#{if @interval == :weekly, | ||
do: "text-base text-#{get_color_by_currency_type(@currency)}-500 font-semibold", | ||
else: "text-sm hover:text-zinc-500" | ||
} | ||
"} | ||
phx-click="interval_change" | ||
phx-value-interval={:weekly} | ||
> | ||
<%= gettext("Weekly") %> | ||
</button> | ||
<button | ||
class={" | ||
#{if @interval == :monthly, | ||
do: "text-base text-#{get_color_by_currency_type(@currency)}-500 font-semibold", | ||
else: "text-sm hover:text-zinc-500" | ||
} | ||
"} | ||
phx-click="interval_change" | ||
phx-value-interval={:monthly} | ||
> | ||
<%= gettext("Monthly") %> | ||
</button> | ||
</div> | ||
<%= render_chart(@socket) %> | ||
</div> | ||
</div> | ||
</div> | ||
</.header> | ||
|
||
<%!-- <div class="h-full w-full md:w-1/2 md:h-1/2 flex justify-center row-span-2 items-center pr-6"> --%> | ||
<div class="p-4 sm:w-1/2 lg:w-1/3 w-full cursor-default"> | ||
<%= render_chart(@socket) %> | ||
</div> | ||
|
||
<.back navigate={~p"/currencies"}><%= gettext("Back to currencies") %></.back> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.