Skip to content
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

refactor: transaction detail page add failed status #1017

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions resources/lang/en/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'coming_soon' => 'Coming Soon',
'select_all' => 'Select All',
'success' => 'Success',
'failed' => 'Failed',
'information' => 'Information',
'error' => 'Error',
'warning' => 'Warning',
Expand Down
4 changes: 4 additions & 0 deletions resources/lang/en/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@
'original' => 'Original',
],
],

'status' => [
'failed_message' => 'Error encountered during contract execution',
],
],

'transactions' => [
Expand Down
2 changes: 1 addition & 1 deletion resources/views/app/transaction.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<x-transaction.page.summary :transaction="$transaction" />

<x-general.page-section.confirmations :model="$transaction" />
<x-transaction.page.status :model="$transaction" />
</div>

<div class="mb-8">
Expand Down
66 changes: 66 additions & 0 deletions resources/views/components/transaction/page/status.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@props(['model'])

@php
$hasFailedStatus = $model->hasFailedStatus();

if ($hasFailedStatus) {
$icon = 'circle.cross';
} else {
$icon = 'double-check-mark';
}
@endphp

<x-general.page-section.container
:title="trans('general.confirmations_only')"
wrapper-class="flex flex-col flex-1 whitespace-nowrap"
:wrapper-container-class="Arr::toCssClasses(['py-2 mx-2 rounded-lg border sm:mx-0 sm:py-4',
'bg-theme-success-100 dark:bg-theme-success-900 border-theme-success-200 dark:border-theme-success-500' => ! $hasFailedStatus,
'bg-theme-danger-50 dark:bg-transparent border-theme-danger-200 dark:border-theme-danger-400' => $hasFailedStatus,
])"
no-border
>
<div @class([
'flex items-center space-x-2 divide-x sm:space-x-3',
'divide-theme-success-200 dark:divide-theme-success-800' => ! $hasFailedStatus,
'divide-theme-danger-200 dark:divide-theme-dark-700' => $hasFailedStatus,
])>
<div @class([
'flex items-center space-x-2 pl-3 sm:pl-6',
'text-theme-success-700 dark:text-theme-success-500' => ! $hasFailedStatus,
'text-theme-danger-700 dark:text-theme-danger-400' => $hasFailedStatus,
])>
<x-ark-icon
:name="$icon"
size="w-4 h-4 sm:w-5 sm:h-5"
/>

<div>
@if ($hasFailedStatus)
@lang('general.failed')
@else
@lang('general.success')
@endif
</div>
</div>

<div class="pl-2 sm:pl-3">
@if ($model->confirmations() > 1000)
<x-number>1000</x-number>+ @lang('general.confirmations_only')
@else
{{ trans_choice('general.confirmations', $model->confirmations(), ['count' => $model->confirmations()]) }}
@endif
</div>

@if ($hasFailedStatus)
<div class="hidden pl-2 sm:pl-3 md-lg:block">
@lang('pages.transaction.status.failed_message')
</div>
@endif
</div>

@if ($hasFailedStatus)
<div class="px-3 pt-2 mt-2 whitespace-normal border-t sm:pt-3 sm:pl-6 sm:mt-3 border-theme-danger-200 md-lg:hidden dark:border-theme-dark-700">
@lang('pages.transaction.status.failed_message')
</div>
@endif
</x-general.page-section.container>
Loading