diff --git a/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.html b/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.html new file mode 100644 index 000000000..d69a4f885 --- /dev/null +++ b/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.html @@ -0,0 +1,30 @@ +
+ {{ rbfInfo.tx.txid | shortenString : 24 }} + + + + + + + + + + + + + + + + RBF + RBF + Mined + + +
First seen
Fee{{ rbfInfo.tx.fee | number }} sat
Virtual size
+
diff --git a/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.scss b/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.scss new file mode 100644 index 000000000..4e202f1ec --- /dev/null +++ b/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.scss @@ -0,0 +1,32 @@ +.rbf-tooltip { + position: fixed; + z-index: 3; + background: rgba(#11131f, 0.95); + border-radius: 4px; + box-shadow: 1px 1px 10px rgba(0,0,0,0.5); + color: #b1b1b1; + padding: 10px 15px; + text-align: left; + pointer-events: none; + max-width: 300px; + + p { + margin: 0; + white-space: nowrap; + } + + table tr td { + padding: 0; + + &:last-child { + text-align: right; + } + } + + .badge { + margin-right: 1em; + &:last-child { + margin-right: 0; + } + } +} \ No newline at end of file diff --git a/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.ts b/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.ts new file mode 100644 index 000000000..dbe6281ed --- /dev/null +++ b/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.ts @@ -0,0 +1,35 @@ +import { Component, ElementRef, ViewChild, Input, OnChanges } from '@angular/core'; +import { RbfInfo } from '../../interfaces/node-api.interface'; + +@Component({ + selector: 'app-rbf-timeline-tooltip', + templateUrl: './rbf-timeline-tooltip.component.html', + styleUrls: ['./rbf-timeline-tooltip.component.scss'], +}) +export class RbfTimelineTooltipComponent implements OnChanges { + @Input() rbfInfo: RbfInfo | void; + @Input() cursorPosition: { x: number, y: number }; + + tooltipPosition = { x: 0, y: 0 }; + + @ViewChild('tooltip') tooltipElement: ElementRef; + + constructor() {} + + ngOnChanges(changes): void { + if (changes.cursorPosition && changes.cursorPosition.currentValue) { + let x = Math.max(10, changes.cursorPosition.currentValue.x - 50); + let y = changes.cursorPosition.currentValue.y + 20; + if (this.tooltipElement) { + const elementBounds = this.tooltipElement.nativeElement.getBoundingClientRect(); + if ((x + elementBounds.width) > (window.innerWidth - 10)) { + x = Math.max(0, window.innerWidth - elementBounds.width - 10); + } + if (y + elementBounds.height > (window.innerHeight - 20)) { + y = y - elementBounds.height - 20; + } + } + this.tooltipPosition = { x, y }; + } + } +} diff --git a/frontend/src/app/components/rbf-timeline/rbf-timeline.component.html b/frontend/src/app/components/rbf-timeline/rbf-timeline.component.html index 069d63357..206b3f01f 100644 --- a/frontend/src/app/components/rbf-timeline/rbf-timeline.component.html +++ b/frontend/src/app/components/rbf-timeline/rbf-timeline.component.html @@ -16,9 +16,18 @@
-
+
- +
{{ cell.replacement.tx.fee / (cell.replacement.tx.vsize) | feeRounding }} sat/vB @@ -49,6 +58,11 @@
+ +