feat: dashboard
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
/* eslint-disable @typescript-eslint/member-ordering */
|
||||
import {
|
||||
CUSTOM_ELEMENTS_SCHEMA,
|
||||
Component,
|
||||
computed,
|
||||
inject,
|
||||
signal
|
||||
} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { NgIcon, provideIcons } from '@ng-icons/core';
|
||||
import {
|
||||
lucideArrowLeft,
|
||||
lucideSearch,
|
||||
lucideUsers
|
||||
} from '@ng-icons/lucide';
|
||||
|
||||
import { UserSearchListComponent } from '../user-search-list/user-search-list.component';
|
||||
import { ServersRailComponent } from '../../../../features/servers/servers-rail/servers-rail.component';
|
||||
import { ViewportService } from '../../../../core/platform';
|
||||
import { selectAllUsers } from '../../../../store/users/users.selectors';
|
||||
import { selectSavedRooms } from '../../../../store/rooms/rooms.selectors';
|
||||
|
||||
/**
|
||||
* Dedicated people-discovery page. Wraps {@link UserSearchListComponent} with a search
|
||||
* field and an onboarding empty state for accounts that have not joined any servers yet.
|
||||
* On mobile the page is mounted inside a Swiper slide alongside the servers rail so the
|
||||
* primary navigation stays reachable, matching the chat-room and DM workspace layouts.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-find-people',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
RouterLink,
|
||||
NgIcon,
|
||||
UserSearchListComponent,
|
||||
ServersRailComponent
|
||||
],
|
||||
viewProviders: [provideIcons({ lucideArrowLeft, lucideSearch, lucideUsers })],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
templateUrl: './find-people.component.html'
|
||||
})
|
||||
export class FindPeopleComponent {
|
||||
private store = inject(Store);
|
||||
private readonly viewport = inject(ViewportService);
|
||||
|
||||
readonly isMobile = this.viewport.isMobile;
|
||||
searchQuery = signal('');
|
||||
private users = this.store.selectSignal(selectAllUsers);
|
||||
private savedRooms = this.store.selectSignal(selectSavedRooms);
|
||||
|
||||
/** True when the account has any people to surface (known users or server members). */
|
||||
hasDiscoverablePeople = computed(() => {
|
||||
if (this.users().length > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.savedRooms().some((room) => (room.members?.length ?? 0) > 0);
|
||||
});
|
||||
|
||||
onSearchChange(query: string): void {
|
||||
this.searchQuery.set(query);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user