15 changed files with 225 additions and 17 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,12 @@ |
|||
import {Component} from "@angular/core"; |
|||
import {AbsListSelect} from "../../abstract/AbsListSelect"; |
|||
|
|||
@Component({ |
|||
selector: 'app-mesh-channel', |
|||
template: ` |
|||
` |
|||
}) |
|||
export class MeshChannelComponent extends AbsListSelect { |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,77 @@ |
|||
import {Component, ElementRef, OnInit, QueryList, ViewChildren} from "@angular/core"; |
|||
import {IOService} from "../../../services/IOService"; |
|||
import {MeshtasticService} from "../../../services/MeshtasticService"; |
|||
import {AbsListSelect} from "../../abstract/AbsListSelect"; |
|||
import {MatDialog} from "@angular/material/dialog"; |
|||
import {AppsService} from "../../../services/AppsService"; |
|||
import {RadioControl} from "../Radio/radio.component"; |
|||
|
|||
@Component({ |
|||
selector: 'app-mesh-list-node', |
|||
template: ` |
|||
<div style="display: flex; flex-direction: row; justify-content: center; height: 84%"> |
|||
<div style="width: 45%; overflow-y: hidden; height: 230px; scroll-behavior: smooth" id="nodes"> |
|||
<div *ngFor="let el of elements" [class.menu-selected]="isSelected(el) && currentSide == 'LEFT'" #menuItem> |
|||
<p style="margin: 0 0">{{el.name}}</p> |
|||
</div> |
|||
</div> |
|||
<div style="width: 2.5%; display: flex; flex-direction: column"></div> |
|||
<div style="width: 45%; display: flex; flex-direction: column" id="info"> |
|||
<div style="text-align: center; height: 125px; margin-bottom: 10px" class="secondary-color"> |
|||
<p>{{selected?.name}}</p> |
|||
</div> |
|||
<div *ngFor="let el of elementsRight" [class.menu-selected]="el == selectedRight && currentSide == 'RIGHT'"> |
|||
<p style="margin: 0 0">{{el.name}}</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
` |
|||
}) |
|||
export class MeshListNodeComponent extends AbsListSelect implements OnInit { |
|||
constructor(public io: IOService, |
|||
public meshtastic: MeshtasticService, |
|||
protected dialog: MatDialog, |
|||
protected apps: AppsService) { |
|||
super(); |
|||
} |
|||
|
|||
override elementsRight:any[] = [ |
|||
{name: "Написать", action: () => {this.apps.openKeyboard().subscribe((res) => {console.log(res); this.apps.inApp = false})}}, |
|||
{name: "Сообщения", action: () => {}}, |
|||
{name: "Трасировка*", action: () => {}} |
|||
] |
|||
|
|||
override selectedRight:any = this.elementsRight[0] |
|||
|
|||
createSub() { |
|||
this.sub = this.io.keys.subscribe((code) => { |
|||
if (this.apps.inApp) return; |
|||
switch (code) { |
|||
case "KeyA": { |
|||
this.currentSide = "LEFT" |
|||
break |
|||
} |
|||
case "KeyD": { |
|||
this.currentSide = "RIGHT"; |
|||
break |
|||
} |
|||
default: { |
|||
super.choiceItem(code) |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
override ngOnInit() { |
|||
this.createSub() |
|||
this.elements = this.meshtastic.nodes; |
|||
this.meshtastic.nodesChange.subscribe( |
|||
(listen:any) => { |
|||
this.elements = this.meshtastic.nodes; |
|||
if (this.selected == undefined) { |
|||
this.selected = this.elements[0]; |
|||
} |
|||
} |
|||
) |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
import {Component} from "@angular/core"; |
|||
|
|||
@Component({ |
|||
selector: 'app-mesh-my-node', |
|||
template: ` |
|||
` |
|||
}) |
|||
export class MeshMyNodeComponent { |
|||
|
|||
} |
|||
@ -1,8 +1,23 @@ |
|||
import {Injectable} from "@angular/core"; |
|||
import {MatDialog} from "@angular/material/dialog"; |
|||
import {Observable} from "rxjs"; |
|||
import {KeyboardAppComponent} from "../components/apps/keyboard-app.component"; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root' |
|||
}) |
|||
export class AppsService { |
|||
inApp: boolean = false; |
|||
constructor(private dialog: MatDialog) { |
|||
} |
|||
|
|||
openApp(app: any, data: any = {}):Observable<any> { |
|||
this.inApp = true; |
|||
const ref = this.dialog.open(app, {width: '100%', height: '100%', disableClose: true, data: data}); |
|||
return ref.afterClosed() |
|||
} |
|||
|
|||
openKeyboard(): Observable<any> { |
|||
return this.openApp(KeyboardAppComponent); |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue