Hide confirmed-in content when confirmed

This commit is contained in:
Râu Cao
2023-01-15 13:16:38 +08:00
parent 2626543f3e
commit d90ddd464a
3 changed files with 15 additions and 0 deletions
+4
View File
@@ -17,4 +17,8 @@ export default class ConfirmedInComponent extends Component {
get confirmedInHumanTime () { get confirmedInHumanTime () {
return moment.duration(this.confirmedInSeconds, "seconds").humanize(); return moment.duration(this.confirmedInSeconds, "seconds").humanize();
} }
get isConfirmed () {
return this.confirmedInBlocks <= 0;
}
} }
+2
View File
@@ -1 +1,3 @@
{{#unless this.isConfirmed}}
Confirming in <strong>{{this.confirmedInBlocks}}</strong> blocks (~ {{this.confirmedInHumanTime}}) Confirming in <strong>{{this.confirmedInBlocks}}</strong> blocks (~ {{this.confirmedInHumanTime}})
{{/unless}}
@@ -37,4 +37,13 @@ module('Unit | Component | confirmed-in', function(hooks) {
assert.equal(component.confirmedInHumanTime, '4 hours'); assert.equal(component.confirmedInHumanTime, '4 hours');
}) })
test('#isConfirmed', function(assert) {
const kredits = this.owner.lookup('service:kredits');
kredits.set('currentBlock', 430000);
let component = createComponent('component:confirmed-in');
component.args.confirmedAtBlock = 420000;
assert.ok(component.isConfirmed);
})
}); });