btc_horse/btc-UI/src/app/components/shared-table/shared-table.component.ts

36 lines
1.2 KiB
TypeScript

// shared-table.component.ts
import { Component, Input, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SelectionData } from '../selection.service/selection.service';
import { FormatNumbersPipe } from '../../../format-numbers.pipe';
import { WebsocketService } from '../../service/websocket.service'; // Adjust path as needed
@Component({
selector: 'app-shared-table',
standalone: true,
imports: [CommonModule, FormatNumbersPipe],
templateUrl: './shared-table.component.html',
styleUrls: ['./shared-table.component.css'],
})
export class SharedTableComponent implements OnInit {
@Input() summaryRows: { col1: string; col2: number; col3: number }[] = [];
@Input() rows: SelectionData[] = [];
@Input() totalAmount: string = '';
message = '';
isConnected = false;
constructor(private websocketService: WebsocketService) {}
ngOnInit() {
this.websocketService.message$.subscribe((msg) => {
this.message = msg;
console.log('[SHARED TABLE] WebSocket message:', msg);
});
this.websocketService.isConnected$.subscribe((status) => {
this.isConnected = status;
console.log('[SHARED TABLE] WebSocket connection status:', status);
});
}
}