-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat][655] Enhance event log (#3571)
* feat: Decode event log * [Feat][655] enhance event log * Apply decode ui * update: data decoded * [Feat][655] enhance event log - fix index * [Feat][655] enhance event log - update --------- Co-authored-by: tambui <tam2391@gmail.com>
- Loading branch information
1 parent
5f61503
commit 7e2e8e4
Showing
12 changed files
with
262 additions
and
101 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
32 changes: 32 additions & 0 deletions
32
src/app/pages/transaction/evm-transaction/decode-message/decode-message.component.html
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<div class="decode-message d-flex justify-content-start align-items-start col-12 d-flex gap-2" [class]="!isMobile ? 'flex-nowrap' : 'flex-wrap'"> | ||
<div class="d-flex gap-2 justify-content-center align-items-start flex-nowrap"> | ||
<p class="name"> | ||
{{index}} <span *ngIf="name">: {{name}}</span> | ||
</p> | ||
<div *ngIf="isAllowSwitchDecode" class="dropdown aura-dropdown mr-4 btn-item"> | ||
<button style="height: 26px; min-width: max-content;" | ||
class="button button--sm button--md-mob button-pill button-outline button-dropdown w-100" type="button" | ||
data-bs-toggle="dropdown" aria-expanded="false"> | ||
<span>{{type}}</span> | ||
</button> | ||
<ul class="dropdown-menu aura-dropdown-menu"> | ||
<li (click)="onHex()" class="dropdown-item cursor-pointer" [class.active]="type === 'Hex'"> | ||
<button type="button" class="button p-0">Hex</button> | ||
</li> | ||
<li (click)="onDecode()" class="dropdown-item cursor-pointer" [class.active]="type === 'Decode'"> | ||
<button type="button" class="button p-0">Decode</button> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
<div *ngIf="!isAllowSwitchDecode" class="data flex-grow-1 font-space-mono"> | ||
<p class="mb-1 font-space-mono">{{value}}</p> | ||
<p class="mb-0 font-space-mono" [innerHTML]="decode | highlight_function"></p> | ||
</div> | ||
<div *ngIf="isAllowSwitchDecode" class="data flex-grow-1 font-space-mono" [class]="isHighlight ? 'highlight' : ''"> | ||
<a *ngIf="isLink && type === 'Decode'" class="text--primary" routerLink="/address/{{ data }}"> | ||
{{data}} | ||
</a> | ||
<span *ngIf="!isLink || type === 'Hex'">{{data}}</span> | ||
</div> | ||
</div> |
56 changes: 56 additions & 0 deletions
56
src/app/pages/transaction/evm-transaction/decode-message/decode-message.component.scss
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.decode-message { | ||
.data{ | ||
font-size: 14px; | ||
line-height: 24px; | ||
} | ||
|
||
.name { | ||
border-radius: 6px; | ||
padding: 4px 10px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
color: #B4B8C0; | ||
border: 1px solid var(--aura-gray-6); | ||
background: var(--aura-gray-9); | ||
font-weight: 600; | ||
font-size: 12px; | ||
white-space: nowrap; | ||
margin: 0; | ||
} | ||
button.button { | ||
background-color: #494C58; | ||
padding-left: 6px; | ||
padding-right: 25px; | ||
font-size: 12px; | ||
line-height: 16px; | ||
bottom: 1px; | ||
top: -1px; | ||
} | ||
|
||
.button.button-dropdown.button--sm:before, | ||
.button.button-dropdown.button--sm:after { | ||
right: 5px; | ||
} | ||
|
||
.dropdown-menu.aura-dropdown-menu{ | ||
top: 0px; | ||
margin-top: 0px; | ||
} | ||
|
||
.dropdown-item.cursor-pointer { | ||
padding: 0 4px; | ||
margin-top: 2px; | ||
|
||
button{ | ||
background-color: transparent; | ||
} | ||
} | ||
|
||
.highlight { | ||
max-width: 98%; | ||
padding: 4px 8px; | ||
border-radius: 4px; | ||
background-color: var(--aura-gray-10); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/app/pages/transaction/evm-transaction/decode-message/decode-message.component.ts
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { EnvironmentService } from 'src/app/core/data-services/environment.service'; | ||
|
||
@Component({ | ||
selector: 'app-decode-message', | ||
templateUrl: './decode-message.component.html', | ||
styleUrls: ['./decode-message.component.scss'], | ||
}) | ||
export class DecodeMessageComponent implements OnInit { | ||
@Input() index: number | string; | ||
@Input() isLink?: boolean; | ||
@Input() name?: string; | ||
@Input() isAllowSwitchDecode?: boolean; | ||
@Input() value: string; | ||
@Input() decode: string; | ||
@Input() isHighlight?: boolean; | ||
|
||
data = ''; | ||
type: 'Decode' | 'Hex' = 'Hex'; | ||
isMobile = false; | ||
|
||
constructor(private environmentService: EnvironmentService) {} | ||
|
||
ngOnInit(): void { | ||
this.isMobile = this.environmentService.isMobile; | ||
this.data = this.value; | ||
} | ||
onDecode() { | ||
this.type = 'Decode'; | ||
this.data = this.decode; | ||
} | ||
|
||
onHex() { | ||
this.type = 'Hex'; | ||
this.data = this.value; | ||
} | ||
} |
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
Oops, something went wrong.