diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 336cfead2..255d9c69a 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -68,6 +68,7 @@ import { HashrateChartPoolsComponent } from './components/hashrates-chart-pools/ import { MiningStartComponent } from './components/mining-start/mining-start.component'; import { AmountShortenerPipe } from './shared/pipes/amount-shortener.pipe'; import { ShortenStringPipe } from './shared/pipes/shorten-string-pipe/shorten-string.pipe'; +import { CapAddressPipe } from './shared/pipes/cap-address-pipe/cap-address-pipe'; import { GraphsComponent } from './components/graphs/graphs.component'; import { DifficultyAdjustmentsTable } from './components/difficulty-adjustments-table/difficulty-adjustments-table.components'; import { BlocksList } from './components/blocks-list/blocks-list.component'; @@ -163,6 +164,7 @@ import { BlockSizesWeightsGraphComponent } from './components/block-sizes-weight StorageService, LanguageService, ShortenStringPipe, + CapAddressPipe, { provide: HTTP_INTERCEPTORS, useClass: HttpCacheInterceptor, multi: true } ], bootstrap: [AppComponent] diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.html b/frontend/src/app/components/transactions-list/transactions-list.component.html index eded208bd..46678e52b 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.html +++ b/frontend/src/app/components/transactions-list/transactions-list.component.html @@ -65,7 +65,10 @@ {{ vin.prevout.scriptpubkey_address | shortenString : 16 }} - {{ vin.prevout.scriptpubkey_address | shortenString : 35 }} + + {{ vin.prevout.scriptpubkey_address }} + {{ vin.prevout.scriptpubkey_address | capAddress: 40: 10 }} +
@@ -156,7 +159,10 @@ {{ vout.scriptpubkey_address | shortenString : 16 }} - {{ vout.scriptpubkey_address | shortenString : 35 }} + + {{ vout.scriptpubkey_address }} + {{ vout.scriptpubkey_address | capAddress: 40: 10 }} +
diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.scss b/frontend/src/app/components/transactions-list/transactions-list.component.scss index 4f20be835..6690337ce 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.scss +++ b/frontend/src/app/components/transactions-list/transactions-list.component.scss @@ -129,3 +129,14 @@ h2 { .summary { margin-top: 10px; } + +.addr-left { + font-family: monospace; + overflow: hidden; + text-overflow: ellipsis; + margin-right: -7px +} + +.addr-right { + font-family: monospace; +} \ No newline at end of file diff --git a/frontend/src/app/shared/pipes/cap-address-pipe/cap-address-pipe.ts b/frontend/src/app/shared/pipes/cap-address-pipe/cap-address-pipe.ts new file mode 100644 index 000000000..c58de52bf --- /dev/null +++ b/frontend/src/app/shared/pipes/cap-address-pipe/cap-address-pipe.ts @@ -0,0 +1,12 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ name: 'capAddress' }) +export class CapAddressPipe implements PipeTransform { + transform(str: string, cap: number, leftover: number) { + if (!str) { return; } + if (str.length <= cap) { + return str; + } + return str.slice(-Math.max(cap - str.length, leftover)); + } +} diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.ts index aa23bb639..8d57630c3 100644 --- a/frontend/src/app/shared/shared.module.ts +++ b/frontend/src/app/shared/shared.module.ts @@ -29,6 +29,7 @@ import { MempoolBlocksComponent } from '../components/mempool-blocks/mempool-blo import { BlockchainBlocksComponent } from '../components/blockchain-blocks/blockchain-blocks.component'; import { AmountComponent } from '../components/amount/amount.component'; import { RouterModule } from '@angular/router'; +import { CapAddressPipe } from './pipes/cap-address-pipe/cap-address-pipe'; @NgModule({ declarations: [ @@ -51,6 +52,7 @@ import { RouterModule } from '@angular/router'; WuBytesPipe, CeilPipe, ShortenStringPipe, + CapAddressPipe, Decimal2HexPipe, FeeRoundingPipe, ColoredPriceDirective, @@ -103,6 +105,7 @@ import { RouterModule } from '@angular/router'; WuBytesPipe, CeilPipe, ShortenStringPipe, + CapAddressPipe, Decimal2HexPipe, FeeRoundingPipe, ColoredPriceDirective,