Skip to content

Commit

Permalink
bug(converter): fix issues with layout and processing
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorAvelar committed Oct 13, 2022
1 parent 9fd03d3 commit 16cb0c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
13 changes: 6 additions & 7 deletions resources/views/converter.blade.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
<x-dashboard-tile :position="$position" :refreshIntervalInSeconds="$refreshIntervalInSeconds">
<h3 class="text-base text-bold text-center">Currency conversion</h3>
<ul role="list" class="min-h-full space-y-3 flex flex-col items-center justify-center">
<h4 class="text-base text-center">{{ Config::get('dashboard.tiles.exchange_rates.convert_value') }}
{{ $base }}</h4>
<ul role="list" class="min-h-full space-y-2 flex flex-col items-center justify-center">
@foreach ($rates as $rate)
<li @class([
'overflow-hidden rounded-md px-2 py-1 shadow w-full',
'bg-gray-200' => $rate['kind'] == 'crypto',
'bg-white' => $rate['kind'] != 'crypto',
])>
<div class="w-full flex justify-between items-center text-xl">
<p class="w-1/3">
@config('dashboard.tiles.exchange_rates.convert_value') {{ $base }}
</p>
<div class="w-1/3">
<div class="w-1/2">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round"
d="M3 7.5L7.5 3m0 0L12 7.5M7.5 3v13.5m13.5 0L16.5 21m0 0L12 16.5m4.5 4.5V7.5" />
</svg>
</div>
<p @class(['w-1/3', 'text-sm' => $rate['kind'] == 'crypto'])>
<p @class(['w-1/2', 'text-sm' => $rate['kind'] == 'crypto'])>
@php
$places = $rate['kind'] == 'crypto' ? 6 : 2;
echo number_format($rates['value'], $places) . ' ' . $rate['symbol'];
echo number_format($rate['value'], $places) . ' ' . $rate['symbol'];
@endphp
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/ConverterTileComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function render()
{
$base = config('dashboard.tiles.exchange_rates.base');

return view('dashboard-exchange-rates-tile::tile', [
return view('dashboard-exchange-rates-tile::converter', [
'base' => $base,
'rates' => ExchangeRatesStore::make($base)->values(),
'refreshIntervalInSeconds' => $this->refreshInSeconds
Expand Down
4 changes: 2 additions & 2 deletions src/ExchangeRatesStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function updateRates(array $rates)
$data = [];
$values = [];

$value = config('dashboard.tiles.exhange_rates.convert_value');
$value = config('dashboard.tiles.exchange_rates.convert_value');

foreach ($rates['rates'] as $symbol => $rate) {
$kind = in_array(
Expand All @@ -40,7 +40,7 @@ public function updateRates(array $rates)
'kind' => $kind,
];

$value[] = [
$values[] = [
'symbol' => $symbol,
'date' => $rates['date'],
'value' => $value * $rate,
Expand Down

0 comments on commit 16cb0c5

Please sign in to comment.