feat: Add pm
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import {
|
||||
Component,
|
||||
DestroyRef,
|
||||
Type,
|
||||
computed,
|
||||
effect,
|
||||
inject,
|
||||
@@ -72,6 +73,7 @@ export class ServersRailComponent {
|
||||
currentRoom = this.store.selectSignal(selectCurrentRoom);
|
||||
|
||||
showMenu = signal(false);
|
||||
dmRailComponent = signal<Type<unknown> | null>(null);
|
||||
menuX = signal(72);
|
||||
menuY = signal(100);
|
||||
contextRoom = signal<Room | null>(null);
|
||||
@@ -86,6 +88,13 @@ export class ServersRailComponent {
|
||||
),
|
||||
{ initialValue: this.router.url.startsWith('/search') }
|
||||
);
|
||||
isOnDirectMessage = toSignal(
|
||||
this.router.events.pipe(
|
||||
filter((navigationEvent): navigationEvent is NavigationEnd => navigationEvent instanceof NavigationEnd),
|
||||
map((navigationEvent) => navigationEvent.urlAfterRedirects.startsWith('/dm/'))
|
||||
),
|
||||
{ initialValue: this.router.url.startsWith('/dm/') }
|
||||
);
|
||||
bannedServerName = signal('');
|
||||
showBannedDialog = signal(false);
|
||||
showPasswordDialog = signal(false);
|
||||
@@ -135,6 +144,10 @@ export class ServersRailComponent {
|
||||
});
|
||||
|
||||
constructor() {
|
||||
void import('../../../domains/direct-message/feature/dm-rail/dm-rail.component').then((module) => {
|
||||
this.dmRailComponent.set(module.DmRailComponent);
|
||||
});
|
||||
|
||||
effect(() => {
|
||||
const rooms = this.savedRooms();
|
||||
const currentUser = this.currentUser();
|
||||
@@ -296,6 +309,10 @@ export class ServersRailComponent {
|
||||
}
|
||||
|
||||
isSelectedRoom(room: Room): boolean {
|
||||
if (this.isOnDirectMessage()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.currentRoom()?.id === room.id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user