Skip to content

Commit

Permalink
init (#35)
Browse files Browse the repository at this point in the history
* update block view in mobile

* update models / add block extension view
  • Loading branch information
deadit authored Jun 17, 2019
1 parent 9ef8193 commit c199fd9
Show file tree
Hide file tree
Showing 22 changed files with 294 additions and 100 deletions.
26 changes: 26 additions & 0 deletions api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ components:
- header
- blockTransactions
- adProofs
- extension
properties:
header:
$ref: '#/components/schemas/BlockHeader'
Expand All @@ -732,6 +733,8 @@ components:
$ref: '#/components/schemas/Transaction'
adProofs:
$ref: '#/components/schemas/SerializedAdProof'
extension:
$ref: '#/components/schemas/BlockExtension'

SearchBlock:
description: Block for search results
Expand Down Expand Up @@ -853,6 +856,29 @@ components:
adProofsId:
$ref: '#/components/schemas/ModifierId'

BlockExtension:
type: object
required:
- headerId
- digest
- fields
properties:
headerId:
$ref: '#/components/schemas/ModifierId'
digest:
$ref: '#/components/schemas/Digest32'
fields:
description: List of key-value records
type: array
nullable: true
items:
$ref: '#/components/schemas/KeyValueItem'

KeyValueItem:
type: array
items:
$ref: '#/components/schemas/HexString'

PowSolutions:
description: An object containing all components of pow solution
type: object
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { BlockExtension } from '../../../models/generated/blockExtension';


interface IBlockExtProps {
extension: BlockExtension;
}

import './block-extension.scss';

export class BlockExtensionComponent extends React.Component<IBlockExtProps> {
render (): JSX.Element {

return (
<div className='bi-block-ext'>
<div className='bi-block-ext__table bi-table'>
<div className='bi-block-ext__row bi-table__row'>
<div className='bi-block-ext__cell bi-block-ext__cell--header bi-table__cell'>
<FormattedMessage id='common.block.headerId'/>
</div>

<div className='bi-block-ext__cell bi-table__cell'>
{ this.props.extension.headerId }
</div>
</div>
<div className='bi-block-ext__row bi-table__row'>
<div className='bi-block-ext__cell bi-block-ext__cell--header bi-table__cell'>
<FormattedMessage id='common.block.digest'/>
</div>

<div className='bi-block-ext__cell bi-table__cell'>
{ this.props.extension.digest }
</div>
</div>
<div className='bi-block-ext__row bi-table__row'>
<div className='bi-block-ext__cell bi-block-ext__cell--header bi-table__cell'>
<FormattedMessage id='common.block.fields'/>
</div>

<div className='bi-block-ext__cell bi-table__cell'>
{this.props.extension.fields.map((i) => <div key={i[0]}>
<b>{i[0]}</b>: {i[1]}
</div>
)}
</div>
</div>
</div>
</div>
);
}
}
78 changes: 78 additions & 0 deletions client/src/components/block/block-extension/block-extension.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
@import '~styles/base/variables';

// #BLOCK EXTENSION
//-------------------------------------
$block-ext-bg-color: #ffffff;
$block-ext-row-hover-bg-color: #f8f8f8;
$block-ext-border-color: #eeeeee;
$block-table-title-color: $theme-primary-color;
$block-table-cell-color: $theme-primary-color;
$block-table-cell-border-color: $theme-color-blue;

.bi-block-ext {
font-family: $theme-main-font;

// [ Components ]
//--------------------------------------------------
&__table {
width: 100%;
border: 1px solid $block-ext-border-color;
background-color: $block-ext-bg-color;
}

&__row {
border-bottom: 1px solid $block-ext-border-color;

&:hover {
background-color: $block-ext-row-hover-bg-color;

.bi-block-ext__cell:first-child:after {
visibility: visible;
}
}
}

&__cell {
position: relative;
padding: $grid-offset-step * 4;
border: 1px solid $block-ext-border-color;
border-right: 0;
border-left: 0;
color: $block-table-cell-color;
font-size: 15px;

&:first-child:after {
visibility: hidden;
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 2px;
background-color: $block-table-cell-border-color;
content: '';
}
}

&__interlink {
display: block;
}

&__cell--header {
width: 200px;
font-size: 14px;
font-weight: 600;
}
}

@media screen and (max-width: $mobile-device-width) {
.bi-block-ext {
&__cell {
padding: ($grid-offset-step * 2) ($grid-offset-step * 2);
border-bottom: 0;
}

&__cell--header + &__cell {
border-top: 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ export class BlockHeaderComponent extends React.Component<IBlockHeaderProps> {
<Link className='bi-block-header__btn-back'
to={ `/${this.props.prevLink}` }>
<ArrowIcon className='bi-block-header__btn-back-icon'/>

<span className='bi-block-header__btn-back-title'>
<FormattedMessage id='components.block-header.back'/>
</span>
</Link>
</div>

<div className='bi-block-header__line g-flex-column__item g-flex'>
<div className='bi-block-header__title g-flex__item-fixed'>
<FormattedMessage id='common.block.block'/> <span>#{ this.props.block.header.height }</span>
</div>

<div className='bi-block-header__navigation g-flex__item-fixed'>
{
(this.props.references.previousId && this.props.block.header.height !== 0) ?
Expand All @@ -43,7 +43,7 @@ export class BlockHeaderComponent extends React.Component<IBlockHeaderProps> {
<ArrowIcon className='bi-block-header__navigation-btn-icon'/>
</Link> : null
}

{
this.props.references.nextId ?
<Link className='bi-block-header__navigation-btn bi-block-header__navigation-btn--next'
Expand All @@ -52,22 +52,29 @@ export class BlockHeaderComponent extends React.Component<IBlockHeaderProps> {
</Link> : null
}
</div>

<div className='bi-block-header__tabs g-flex__item-fixed g-flex'>
<NavLink className='bi-block-header__tab g-flex__item-fixed'
activeClassName='bi-block-header__tab--active'
exact={ true }
to={ `/blocks/${this.props.block.header.id}` }>
<FormattedMessage id='components.block-header.information'/>
</NavLink>

<NavLink className='bi-block-header__tab g-flex__item-fixed'
activeClassName='bi-block-header__tab--active'
exact={ true }
to={ `/blocks/${this.props.block.header.id}/transactions` }>
<FormattedMessage id='components.block-header.transactions'/>
</NavLink>


<NavLink className='bi-block-header__tab g-flex__item-fixed'
activeClassName='bi-block-header__tab--active'
exact={ true }
to={ `/blocks/${this.props.block.header.id}/extension` }>
<FormattedMessage id='components.block-header.extension'/>
</NavLink>

<NavLink className='bi-block-header__tab g-flex__item-fixed'
activeClassName='bi-block-header__tab--active'
exact={ true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ $payment-request-modal-link-color: #828795;
$payment-request-modal-link-border-color: #e5e5e5;

.bi-payment-request-modal {
max-width: 550px;
padding: ($grid-offset-step * 12) ($grid-offset-step * 15);
border-radius: 4px;
outline: none;
background-color: $payment-request-modal-bg;
font-family: $theme-main-font;
max-width: 375px;

// [ Components ]
//-----------------------------------
Expand Down Expand Up @@ -125,10 +125,10 @@ $payment-request-modal-link-border-color: #e5e5e5;

@media screen and (max-width: $mobile-device-width) {
.bi-payment-request-modal {
padding: ($grid-offset-step * 3) ($grid-offset-step * 5);
max-height: 100vh;
width: 100%;
box-sizing: border-box;
width: 100%;
max-height: 100vh;
padding: ($grid-offset-step * 3) ($grid-offset-step * 5);
border-radius: 0;

&__input-wrapper {
Expand All @@ -141,17 +141,18 @@ $payment-request-modal-link-border-color: #e5e5e5;

&__qrcode {
margin-bottom: $grid-offset-step * 5;

align-items: center;
}

&__link {
margin: 0;
}

&__result,
&__form-item {
&__result, &__form-item {
flex-direction: column;

align-items: flex-start;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { FormattedMessage } from 'react-intl';

import { IOSummary } from '../../../models/generated/IOSummary';
import { IOSummary } from '../../../models/generated/iOSummary';

import { CoinValueComponent } from '../../common/coin-value/coin-value.component';
import './transaction-io-summary.scss';
Expand Down
8 changes: 6 additions & 2 deletions client/src/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"stateRoot": "State Root",
"transactions": "Transactions",
"transactionsRoot": "Transactions Root",
"version": "Version"
"version": "Version",
"headerId": "Header ID",
"digest": "Digest",
"fields": "Fields"
},
"pages": {
"address": {
Expand Down Expand Up @@ -99,7 +102,8 @@
"adproofs": "AD Proofs",
"back": "Back to all blocks",
"information": "Information",
"transactions": "Transactions"
"transactions": "Transactions",
"extension": "Extension"
},
"block-summary": {
"averageMiningTime": "Average mining time",
Expand Down
8 changes: 6 additions & 2 deletions client/src/locales/ru/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"stateRoot": "Хэш Состояния",
"transactions": "Транзакции",
"transactionsRoot": "Хэш Секции Транзакции",
"version": "Версия"
"version": "Версия",
"headerId": "ID заголовка",
"digest": "Дайджест",
"fields": "Поля"
},
"pages": {
"address": {
Expand Down Expand Up @@ -99,7 +102,8 @@
"adproofs": "AD Доказательства",
"back": "Назад ко всем блокам",
"information": "Информация",
"transactions": "Транзакции"
"transactions": "Транзакции",
"extension": "Расширение"
},
"block-summary": {
"averageMiningTime": "Среднее время между блоками",
Expand Down
23 changes: 23 additions & 0 deletions client/src/models/generated/blockExtension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Ergo blockchain explorer
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 2.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/import { Digest32 } from './digest32';
import { KeyValueItem } from './keyValueItem';
import { ModifierId } from './modifierId';


export interface BlockExtension {
headerId: ModifierId;
digest: Digest32;
/**
* List of key-value records
*/
fields: Array<KeyValueItem>;
}
6 changes: 3 additions & 3 deletions client/src/models/generated/blockchainStatsBlockSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export interface BlockchainStatsBlockSummary {
/**
* Number of mined blocks
*/
total: number;
total?: number;
/**
* Time between blocks in ms
*/
averageMiningTime: number;
averageMiningTime?: number;
/**
* Total mined coins
*/
totalCoins: number;
totalCoins?: number;
}
Loading

0 comments on commit c199fd9

Please sign in to comment.