diff --git a/src/app/app.html b/src/app/app.html index a58ea90..cb1e78c 100644 --- a/src/app/app.html +++ b/src/app/app.html @@ -15,3 +15,6 @@ + + + diff --git a/src/app/app.ts b/src/app/app.ts index 760f212..ba5c1e1 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -11,10 +11,15 @@ import { ExternalLinkService } from './core/services/external-link.service'; import { ServersRailComponent } from './features/servers/servers-rail.component'; import { TitleBarComponent } from './features/shell/title-bar.component'; import { FloatingVoiceControlsComponent } from './features/voice/floating-voice-controls/floating-voice-controls.component'; +import { SettingsModalComponent } from './features/settings/settings-modal/settings-modal.component'; import { UsersActions } from './store/users/users.actions'; import { RoomsActions } from './store/rooms/rooms.actions'; import { selectCurrentRoom } from './store/rooms/rooms.selectors'; -import { ROOM_URL_PATTERN, STORAGE_KEY_CURRENT_USER_ID, STORAGE_KEY_LAST_VISITED_ROUTE } from './core/constants'; +import { + ROOM_URL_PATTERN, + STORAGE_KEY_CURRENT_USER_ID, + STORAGE_KEY_LAST_VISITED_ROUTE, +} from './core/constants'; /** * Root application component. @@ -24,7 +29,14 @@ import { ROOM_URL_PATTERN, STORAGE_KEY_CURRENT_USER_ID, STORAGE_KEY_LAST_VISITED */ @Component({ selector: 'app-root', - imports: [CommonModule, RouterOutlet, ServersRailComponent, TitleBarComponent, FloatingVoiceControlsComponent], + imports: [ + CommonModule, + RouterOutlet, + ServersRailComponent, + TitleBarComponent, + FloatingVoiceControlsComponent, + SettingsModalComponent, + ], templateUrl: './app.html', styleUrl: './app.scss', }) diff --git a/src/app/core/services/index.ts b/src/app/core/services/index.ts index 6dbe7e5..e51e1bb 100644 --- a/src/app/core/services/index.ts +++ b/src/app/core/services/index.ts @@ -7,3 +7,4 @@ export * from './server-directory.service'; export * from './voice-session.service'; export * from './voice-activity.service'; export * from './external-link.service'; +export * from './settings-modal.service'; diff --git a/src/app/core/services/settings-modal.service.ts b/src/app/core/services/settings-modal.service.ts new file mode 100644 index 0000000..3d74557 --- /dev/null +++ b/src/app/core/services/settings-modal.service.ts @@ -0,0 +1,39 @@ +import { Injectable, signal } from '@angular/core'; + +/** + * Pages available in the unified settings modal. + * Network & Voice are always visible; server-specific pages + * require an active room and admin role. + */ +export type SettingsPage = 'network' | 'voice' | 'server' | 'members' | 'bans' | 'permissions'; + +/** + * Global service controlling the unified settings modal. + * Any component can open the modal to a specific page via `open()`. + */ +@Injectable({ providedIn: 'root' }) +export class SettingsModalService { + /** Whether the modal is currently visible. */ + readonly isOpen = signal(false); + /** The currently active page within the side-nav. */ + readonly activePage = signal('network'); + /** Optional server/room ID to pre-select in admin tabs. */ + readonly targetServerId = signal(null); + + /** Open the modal to a specific page, optionally targeting a server. */ + open(page: SettingsPage = 'network', serverId?: string): void { + this.activePage.set(page); + this.targetServerId.set(serverId ?? null); + this.isOpen.set(true); + } + + /** Close the modal. */ + close(): void { + this.isOpen.set(false); + } + + /** Navigate to a different page while the modal remains open. */ + navigate(page: SettingsPage): void { + this.activePage.set(page); + } +} diff --git a/src/app/features/room/chat-room/chat-room.component.html b/src/app/features/room/chat-room/chat-room.component.html index 52e4921..6ea7bc6 100644 --- a/src/app/features/room/chat-room/chat-room.component.html +++ b/src/app/features/room/chat-room/chat-room.component.html @@ -5,15 +5,6 @@ # {{ activeChannelName }}
- @if (isAdmin()) { - - } @@ -29,19 +20,6 @@ - - @if (showAdminPanel() && isAdmin()) { - - } -