-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent amount to be truncated on transactions headers #851
Merged
Merged
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d25b259
Refactor transactions details grid to prevent truncated amount
alfonsobries 97236f0
Apply the flexible layout only to the items with amount
alfonsobries a5ef975
Test hadAmount method
alfonsobries c1e5c05
style: resolve style guide violations
alfonsobries 4e29833
chore: rebuild assets
alfonsobries 4a94f79
Sort checks for testing coverage
alfonsobries cdd6dff
Update resources/views/components/general/entity-header-item.blade.php
alfonsobries f3bf736
Update resources/views/components/page-headers/transaction/icon-type.…
alfonsobries 9930c21
Merge branch 'develop' of github.com:ArkEcosystem/explorer.ark.io int…
alfonsobries 2c089e1
Merge branch 'develop' into fix/prevent-amount-truncate
alfonsobries 2cd6311
Merge branch 'develop' into fix/prevent-amount-truncate
alfonsobries e64624b
Merge branch 'develop' of github.com:ArkEcosystem/explorer.ark.io int…
alfonsobries b93cbdf
Dockblock
alfonsobries 1ef722e
Merge branch 'develop' of github.com:ArkEcosystem/explorer.ark.io int…
alfonsobries d29abc3
Use factories
alfonsobries 1501d14
Fix factory states
alfonsobries 5508537
Merge branch 'develop' into fix/prevent-amount-truncate
ItsANameToo fe081a9
Merge branch 'develop' into fix/prevent-amount-truncate
ItsANameToo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
33 changes: 23 additions & 10 deletions
33
resources/views/components/general/entity-header-item.blade.php
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,29 +1,42 @@ | ||
<div class="entity-header-item {{ $wrapperClass ?? false }}"> | ||
@unless($withoutIcon ?? false) | ||
@props([ | ||
'title', | ||
'text', | ||
'wrapperClass' => '', | ||
'contentClass' => 'md:ml-4 md:pr-4', | ||
'url' => false, | ||
'withoutIcon' => false, | ||
'icon' => false, | ||
'iconSize' => false, | ||
'avatar' => false, | ||
'truncate' => true, | ||
]) | ||
|
||
<div class="entity-header-item {{ $wrapperClass }}{{ $truncate ? ' overflow-x-auto truncate' : '' }}"> | ||
@unless($withoutIcon) | ||
<div class="hidden items-center md:flex"> | ||
<div class="circled-icon text-theme-secondary-900 border-theme-secondary-900 dark:text-theme-secondary-600 dark:border-theme-secondary-600"> | ||
@if ($icon ?? false) | ||
@if ($iconSize ?? false) | ||
@if ($icon) | ||
@if ($iconSize) | ||
<x-ark-icon :name="$icon" :size="$iconSize" /> | ||
@else | ||
<x-ark-icon :name="$icon" /> | ||
@endif | ||
@elseif ($avatar ?? false) | ||
@elseif ($avatar) | ||
<x-general.avatar-small :identifier="$avatar" /> | ||
@endif | ||
</div> | ||
</div> | ||
@endunless | ||
|
||
<div class="flex flex-col flex-1 justify-between font-semibold truncate space-y-2 p-1 -m-1 {{ $contentClass ?? 'md:ml-4 md:pr-4' }}"> | ||
<div class="text-sm leading-tight text-theme-secondary-500 dark:text-theme-secondary-700">{{ $title }}</div> | ||
<div class="flex flex-col flex-1 justify-between font-semibold space-y-2 p-1 -m-1 {{ $contentClass }}{{ $truncate ? ' overflow-x-auto truncate' : '' }}"> | ||
<div class="text-sm leading-tight text-theme-secondary-500 dark:text-theme-secondary-700{{ $truncate ? ' truncate' : '' }}">{{ $title }}</div> | ||
|
||
@if ($url ?? false) | ||
@if ($url) | ||
<a href="{{ $url }}" class="flex leading-tight link"> | ||
<span class="truncate">{{ $text }}</span> | ||
<span class="{{ $truncate ? 'truncate' : 'whitespace-nowrap' }}">{{ $text }}</span> | ||
</a> | ||
@else | ||
<span class="leading-tight truncate text-theme-secondary-900 dark:text-theme-secondary-200">{{ $text }}</span> | ||
<span class="leading-tight text-theme-secondary-900 dark:text-theme-secondary-200{{ $truncate ? ' truncate' : ' whitespace-nowrap' }} ">{{ $text }}</span> | ||
@endif | ||
</div> | ||
</div> |
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
63 changes: 35 additions & 28 deletions
63
resources/views/components/page-headers/transaction/fallback.blade.php
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,34 +1,41 @@ | ||
<x-page-headers.transaction.icon-type :model="$transaction" /> | ||
<div class="flex flex-col space-y-8 sm:flex-row sm:space-y-0 xl:pr-7 xl:border-r xl:border-theme-secondary-300"> | ||
<x-page-headers.transaction.icon-type :model="$transaction" wrapper-class="sm:w-1/2" /> | ||
|
||
<x-general.entity-header-item | ||
:title="trans('pages.transaction.amount')" | ||
icon="app-supply" | ||
> | ||
<x-slot name="text"> | ||
<x-general.amount-fiat-tooltip | ||
:amount="$transaction->amount()" | ||
:fiat="$transaction->amountFiat()" | ||
/> | ||
</x-slot> | ||
</x-general.entity-header-item> | ||
<x-general.entity-header-item | ||
:title="trans('pages.transaction.amount')" | ||
icon="app-supply" | ||
:truncate="false" | ||
> | ||
<x-slot name="text"> | ||
<x-general.amount-fiat-tooltip | ||
:amount="$transaction->amount()" | ||
:fiat="$transaction->amountFiat()" | ||
/> | ||
</x-slot> | ||
</x-general.entity-header-item> | ||
</div> | ||
|
||
<x-general.entity-header-item | ||
:title="trans('pages.transaction.fee')" | ||
icon="app-monitor" | ||
> | ||
<x-slot name="text"> | ||
<x-general.amount-fiat-tooltip | ||
<div class="grid grid-cols-1 gap-y-8 sm:grid-cols-2 xl:pl-7"> | ||
<x-general.entity-header-item | ||
:title="trans('pages.transaction.fee')" | ||
:wrapper-class="$wrapperClass ?? ''" | ||
icon="app-monitor" | ||
> | ||
<x-slot name="text"> | ||
<x-general.amount-fiat-tooltip | ||
:amount="$transaction->fee()" | ||
:fiat="$transaction->feeFiat()" | ||
/> | ||
</x-slot> | ||
</x-general.entity-header-item> | ||
</x-slot> | ||
</x-general.entity-header-item> | ||
|
||
<x-general.entity-header-item | ||
:title="trans('pages.transaction.confirmations')" | ||
icon="app-confirmations" | ||
> | ||
<x-slot name="text"> | ||
<x-number>{{ $transaction->confirmations() }}</x-number> | ||
</x-slot> | ||
</x-general.entity-header-item> | ||
<x-general.entity-header-item | ||
:title="trans('pages.transaction.confirmations')" | ||
:wrapper-class="$wrapperClass ?? ''" | ||
icon="app-confirmations" | ||
> | ||
<x-slot name="text"> | ||
<x-number>{{ $transaction->confirmations() }}</x-number> | ||
</x-slot> | ||
</x-general.entity-header-item> | ||
</div> |
6 changes: 5 additions & 1 deletion
6
resources/views/components/page-headers/transaction/icon-type.blade.php
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make more sense to reverse this, or reducing it completely until there are more "amount" types? 🤔
or
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexbarnsley by checking the views that don't have the amount I was able to securely say which types don't have the amount, the rest of them used the
fallback
view and includes other types like "second signature", IPFS, etc. In other words, those types are the ones that have a special template so it's safest to exclude them. (In case you are wondering I tested the condition you proposed and even that the test pass some views are broken)Regarding the multiline, it was in purpose to ensure the code coverage covers all the conditions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alfonsobries can you add a comment regarding that to the code so the next guy doesn't go and refactor this without prior knowledge