17 changed files with 331 additions and 64 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
@ -1,12 +0,0 @@ |
|||
import {Component} from "@angular/core"; |
|||
import {AbsListSelect} from "../../abstract/AbsListSelect"; |
|||
|
|||
@Component({ |
|||
selector: 'app-mesh-channel', |
|||
template: ` |
|||
` |
|||
}) |
|||
export class MeshChannelComponent extends AbsListSelect { |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,94 @@ |
|||
import {Component, OnInit} from "@angular/core"; |
|||
import {AbsListSelect} from "../../abstract/AbsListSelect"; |
|||
import {IOService} from "../../../services/IOService"; |
|||
import {MeshMessage, MeshtasticService, PUB_CH} from "../../../services/MeshtasticService"; |
|||
import {AppsService} from "../../../services/AppsService"; |
|||
import {ActivatedRoute} from "@angular/router"; |
|||
|
|||
@Component({ |
|||
selector: "app-mesh-messages", |
|||
template: ` |
|||
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 84%"> |
|||
<div style="width: 95%; overflow-y: hidden; height: 200px; scroll-behavior: smooth" id="msgs"> |
|||
<div class="secondary-color" style="margin-bottom: 5px;" *ngFor="let el of elements" [class.menu-selected]="isSelected(el) && currentSide == 'LEFT'" #menuItem> |
|||
<p style="margin: 0 0; font-size: 10px;"> |
|||
{{meshtastic.getNodeName(el.fr0m)}} |
|||
{{meshtastic.getMsgTo(el)}} |
|||
{{el.rx_time | date: 'HH:mm:ss dd/MM'}} |
|||
[{{el.hop_limit}}]</p> |
|||
<p style="margin: 0 0">{{el.msg}}</p> |
|||
</div> |
|||
</div> |
|||
<div style="width: 95%; height: 30px; align-items: center; display: flex; flex-direction: row; justify-content: center"> |
|||
<div style="margin-left: 2%; margin-right: 2%" *ngFor="let el of elementsRight" [class.menu-selected]="el == selectedRight && currentSide == 'RIGHT'"> |
|||
<p style="margin: 0 0">{{el.name}}</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
` |
|||
})//todo maybe view any msg shit
|
|||
export class MeshMessagesComponent extends AbsListSelect<MeshMessage, any> implements OnInit { |
|||
constructor(public io: IOService, |
|||
public meshtastic: MeshtasticService, |
|||
protected apps: AppsService, |
|||
protected route: ActivatedRoute) { |
|||
super(); |
|||
} |
|||
|
|||
override elementsRight:any[] = [ |
|||
{name: "Reply to DM", action: () => {}}, |
|||
{name: "Reply", action: () => {}}, |
|||
]; |
|||
|
|||
override selectedRight = this.elementsRight[0]; |
|||
private currentIndex:any; |
|||
|
|||
override ngOnInit() { |
|||
this.route.params.subscribe( |
|||
(params) => { |
|||
this.currentIndex = params["index"]; |
|||
let upd = () => {}; |
|||
switch (params["index"]) { |
|||
case "-1": { |
|||
upd = () => this.elements = this.meshtastic.messages; |
|||
break; |
|||
} |
|||
default: { |
|||
upd = () => this.elements = this.meshtastic.messages.filter((msg) => msg.to == PUB_CH && msg.channel == parseInt(params["index"])); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
upd(); |
|||
this.meshtastic.messagesChange.subscribe((msg) => { |
|||
if (msg) { |
|||
upd() |
|||
} |
|||
}) |
|||
|
|||
if (this.elements) |
|||
this.selected = this.elements[this.elements.length] |
|||
} |
|||
) |
|||
this.createSub(); |
|||
} |
|||
|
|||
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) |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue