2025-06-20 23:52:22 -05:00
|
|
|
import { Component, inject } from '@angular/core';
|
2025-06-12 02:45:17 -05:00
|
|
|
import { Subject, takeUntil } from 'rxjs';
|
|
|
|
|
|
|
|
import { InfoBarService } from '../../common/services/editor/info-bar/info-bar.service';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'info-bar',
|
|
|
|
standalone: true,
|
|
|
|
imports: [
|
|
|
|
],
|
|
|
|
templateUrl: './info-bar.component.html',
|
|
|
|
styleUrl: './info-bar.component.css',
|
|
|
|
host: {
|
|
|
|
'class': 'row info-bar'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
export class InfoBarComponent {
|
2025-06-20 23:52:22 -05:00
|
|
|
private unsubscribe: Subject<void> = new Subject();
|
|
|
|
|
|
|
|
private infoBarService: InfoBarService = inject(InfoBarService);
|
2025-06-12 02:45:17 -05:00
|
|
|
|
|
|
|
fpath: string = "";
|
|
|
|
path: string = "";
|
|
|
|
cursorPos: string = "";
|
|
|
|
encodeing: string = "";
|
|
|
|
ftype: string = "";
|
|
|
|
|
|
|
|
|
2025-06-20 23:52:22 -05:00
|
|
|
constructor() {}
|
2025-06-12 02:45:17 -05:00
|
|
|
|
|
|
|
|
|
|
|
public ngAfterViewInit(): void {
|
|
|
|
this.loadSubscribers();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
loadSubscribers() {
|
|
|
|
|
|
|
|
this.infoBarService.updateInfoBarFPath$().pipe(
|
|
|
|
takeUntil(this.unsubscribe)
|
|
|
|
).subscribe((fpath: string) => {
|
|
|
|
this.fpath = fpath;
|
|
|
|
let _path = fpath;
|
|
|
|
|
|
|
|
if (fpath?.length > 67) {
|
|
|
|
_path = "..." + fpath.slice(fpath.length - 67, fpath.length);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.path = _path;
|
|
|
|
});
|
|
|
|
|
|
|
|
this.infoBarService.updateInfoBarCursorPos$().pipe(
|
|
|
|
takeUntil(this.unsubscribe)
|
|
|
|
).subscribe((cursorPos: any) => {
|
|
|
|
this.cursorPos = `${cursorPos.row + 1}:${cursorPos.column}`;
|
|
|
|
});
|
|
|
|
|
|
|
|
this.infoBarService.updateInfoBarEncodeing$().pipe(
|
|
|
|
takeUntil(this.unsubscribe)
|
|
|
|
).subscribe((encodeing: string) => {
|
|
|
|
this.encodeing = encodeing;
|
|
|
|
});
|
|
|
|
|
|
|
|
this.infoBarService.updateInfoBarFType$().pipe(
|
|
|
|
takeUntil(this.unsubscribe)
|
|
|
|
).subscribe((ftype: string) => {
|
|
|
|
let mode = ftype.split("/");
|
|
|
|
this.ftype = mode[ mode.length - 1 ];
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|