Start implementing direct messaging and continued developing the chatnav

This commit is contained in:
2026-04-09 08:47:56 +02:00
parent 3fb1145c6b
commit c5bc817efe
27 changed files with 428 additions and 27 deletions

View File

@@ -2,12 +2,19 @@ import {Component, inject, input, OnInit, signal} from '@angular/core';
import {ChatService} from '@chatenium/chatenium-sdk/services/chatService';
import {IndexedDB} from '../../storage/indexed-db';
import {Chat} from '@chatenium/chatenium-sdk/domain/chatService.schema';
import {JsonPipe} from '@angular/common';
import {TuiButton} from '@taiga-ui/core';
import {Oimg} from '../elements/oimg/oimg';
import {Router, RouterLink} from '@angular/router';
import {TranslatePipe} from '@ngx-translate/core';
import {LoadStatus, ServiceManager} from '../../service-manager';
@Component({
selector: 'app-dm-list',
imports: [
JsonPipe
TuiButton,
Oimg,
RouterLink,
TranslatePipe
],
templateUrl: './dm-list.html',
styleUrl: './dm-list.scss',
@@ -17,19 +24,17 @@ export class DmList implements OnInit {
token = input<string>("")
indexedDb = inject(IndexedDB)
service: ChatService | null = null
chats = signal<Chat[]>([])
chatsStatus = 0
router = inject(Router)
serviceManager = inject(ServiceManager)
async ngOnInit() {
this.service = new ChatService(this.userid(), this.token(), this.indexedDb.getApi(), () => {})
this.serviceManager.chatService = new ChatService(this.userid(), this.token(), this.indexedDb.getApi(), () => {})
try {
this.chats.set(await this.service.get())
this.chatsStatus = 1
this.serviceManager.chats.set(await this.serviceManager.chatService.get())
this.serviceManager.chatsStatus.set(LoadStatus.loaded)
} catch (e) {
console.error(e)
this.chatsStatus = 2
this.serviceManager.chatsStatus.set(LoadStatus.error)
}
}
}