-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d9c4fe
commit eeea785
Showing
17 changed files
with
798 additions
and
47 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
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
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
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,38 @@ | ||
import React from 'react'; | ||
import SortableTable from '../SortableTable'; | ||
import EllipsiCell from '../EllipsiCell'; | ||
|
||
// XXX We should use function component with SortableTable as a component | ||
// but renderTableHead and renderTableBody are implemented and not | ||
// expected as a props, so it demands a bigger refactor | ||
class BuiltInBlueprintsTable extends SortableTable { | ||
renderTableHead() { | ||
return ( | ||
<tr> | ||
<th className="d-lg-table-cell">BLUEPRINT ID</th> | ||
<th className="d-lg-table-cell">NAME</th> | ||
</tr> | ||
); | ||
} | ||
|
||
renderTableBody() { | ||
return this.props.data.map(blueprint => { | ||
return ( | ||
<tr key={blueprint.id} onClick={_e => this.props.handleClickRow(blueprint.id)}> | ||
<td className="d-lg-table-cell pe-3"> | ||
{this.props.isMobile ? ( | ||
<EllipsiCell id={blueprint.id} countBefore={10} countAfter={10} /> | ||
) : ( | ||
blueprint.id | ||
)} | ||
</td> | ||
<td className="d-lg-table-cell pe-3">{blueprint.name}</td> | ||
</tr> | ||
); | ||
}); | ||
} | ||
} | ||
|
||
BuiltInBlueprintsTable.propTypes = SortableTable.propTypes; | ||
|
||
export default BuiltInBlueprintsTable; |
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,76 @@ | ||
import React from 'react'; | ||
import SortableTable from '../SortableTable'; | ||
import EllipsiCell from '../EllipsiCell'; | ||
import dateFormatter from '../../utils/date'; | ||
|
||
// XXX We should use function component with SortableTable as a component | ||
// but renderTableHead and renderTableBody are implemented and not | ||
// expected as a props, so it demands a bigger refactor | ||
class OnChainBlueprintsTable extends SortableTable { | ||
/* | ||
* Get header of first column. In the mobile we show the element | ||
* of two columns in one. | ||
*/ | ||
getFirstHeaderName() { | ||
if (this.props.isMobile) { | ||
return 'BLUEPRINT ID AND NAME'; | ||
} | ||
|
||
return 'BLUEPRINT ID'; | ||
} | ||
|
||
renderTableHead() { | ||
return ( | ||
<tr> | ||
<th className="d-lg-table-cell">{this.getFirstHeaderName()}</th> | ||
{!this.props.isMobile && <th className="d-lg-table-cell">NAME</th>} | ||
<th | ||
className="d-lg-table-cell sortable" | ||
onClick={e => this.props.tableHeaderClicked(e, 'created_at')} | ||
> | ||
CREATED AT {this.getArrow('created_at')} | ||
</th> | ||
</tr> | ||
); | ||
} | ||
|
||
renderMobileRow(blueprint) { | ||
return ( | ||
<> | ||
<td className="d-lg-table-cell pe-3"> | ||
<EllipsiCell id={blueprint.id} countBefore={10} countAfter={10} /> | ||
<p className="mt-2 mb-0">{blueprint.name}</p> | ||
</td> | ||
<td className="d-lg-table-cell pe-3"> | ||
{dateFormatter.parseTimestampNewUi(blueprint.created_at)} | ||
</td> | ||
</> | ||
); | ||
} | ||
|
||
renderDesktopRow(blueprint) { | ||
return ( | ||
<> | ||
<td className="d-lg-table-cell pe-3">{blueprint.id}</td> | ||
<td className="d-lg-table-cell pe-3">{blueprint.name}</td> | ||
<td className="d-lg-table-cell pe-3"> | ||
{dateFormatter.parseTimestampNewUi(blueprint.created_at)} | ||
</td> | ||
</> | ||
); | ||
} | ||
|
||
renderTableBody() { | ||
return this.props.data.map(blueprint => { | ||
return ( | ||
<tr key={blueprint.id} onClick={_e => this.props.handleClickRow(blueprint.id)}> | ||
{this.props.isMobile ? this.renderMobileRow(blueprint) : this.renderDesktopRow(blueprint)} | ||
</tr> | ||
); | ||
}); | ||
} | ||
} | ||
|
||
OnChainBlueprintsTable.propTypes = SortableTable.propTypes; | ||
|
||
export default OnChainBlueprintsTable; |
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.