Merged network view with chat sidenav and updated the look of the category/channel list to a threaded one
This commit is contained in:
@@ -24,6 +24,11 @@
|
||||
"glob": "**/*",
|
||||
"input": "public"
|
||||
},
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "node_modules/@taiga-ui/icons/src",
|
||||
"output": "assets/taiga-ui/icons"
|
||||
},
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "node_modules/@taiga-ui/icons/src",
|
||||
|
||||
3305
package-lock.json
generated
3305
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@@ -25,15 +25,17 @@
|
||||
"@fortawesome/free-solid-svg-icons": "^7.1.0",
|
||||
"@ngx-translate/core": "^17.0.0",
|
||||
"@ngx-translate/http-loader": "^17.0.0",
|
||||
"@taiga-ui/addon-charts": "^5.1.0",
|
||||
"@taiga-ui/addon-mobile": "^5.1.0",
|
||||
"@taiga-ui/addon-table": "^5.1.0",
|
||||
"@taiga-ui/cdk": "^5.1.0",
|
||||
"@taiga-ui/core": "^5.1.0",
|
||||
"@taiga-ui/addon-charts": "^5.25.0",
|
||||
"@taiga-ui/addon-commerce": "^5.25.0",
|
||||
"@taiga-ui/addon-doc": "^5.25.0",
|
||||
"@taiga-ui/addon-mobile": "^5.25.0",
|
||||
"@taiga-ui/addon-table": "^5.25.0",
|
||||
"@taiga-ui/cdk": "^5.25.0",
|
||||
"@taiga-ui/core": "^5.25.0",
|
||||
"@taiga-ui/i18n": "^5.2.0",
|
||||
"@taiga-ui/icons": "^5.1.0",
|
||||
"@taiga-ui/kit": "^5.1.0",
|
||||
"@taiga-ui/layout": "^5.1.0",
|
||||
"@taiga-ui/icons": "^5.25.0",
|
||||
"@taiga-ui/kit": "^5.25.0",
|
||||
"@taiga-ui/layout": "^5.25.0",
|
||||
"libphonenumber-js": "^1.12.41",
|
||||
"ngx-cookie-service": "^21.3.1",
|
||||
"rxjs": "~7.8.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "Chatenium Nexum 3.0 Beta 10 (April 27, 2026)",
|
||||
"version": "Chatenium Nexum 3.0 Beta 11 (October 4, 2026)",
|
||||
"ok": "Ok",
|
||||
"back": "Back",
|
||||
"aChatProgram": "A messaging platform that you can trust.",
|
||||
@@ -218,7 +218,8 @@
|
||||
"changeLogDialog": {
|
||||
"label": "Chatenium has been updated",
|
||||
"changeLog": {
|
||||
"1": "Fixed scrolling issues when sending or receiving new messages."
|
||||
"1": "The network UI have been merged with the left side navigation panel.",
|
||||
"2": "Categories and channels now have a threaded UI to align with recent changes"
|
||||
}
|
||||
},
|
||||
"chatnav": {
|
||||
|
||||
@@ -1,37 +1,39 @@
|
||||
import {provideTaiga} from '@taiga-ui/core';
|
||||
import {ApplicationConfig, provideBrowserGlobalErrorListeners, isDevMode} from '@angular/core';
|
||||
import {provideRouter, withRouterConfig} from '@angular/router';
|
||||
import { provideTaiga } from '@taiga-ui/core';
|
||||
import { ApplicationConfig, provideBrowserGlobalErrorListeners, isDevMode } from '@angular/core';
|
||||
import { provideRouter, withRouterConfig } from '@angular/router';
|
||||
|
||||
import {routes} from './app.routes';
|
||||
import {provideTranslateService} from '@ngx-translate/core';
|
||||
import {provideTranslateHttpLoader} from '@ngx-translate/http-loader';
|
||||
import {provideServiceWorker} from '@angular/service-worker';
|
||||
import {tuiInputPhoneInternationalOptionsProvider} from '@taiga-ui/kit';
|
||||
import {defer} from 'rxjs';
|
||||
import { routes } from './app.routes';
|
||||
import { provideTranslateService } from '@ngx-translate/core';
|
||||
import { provideTranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
import { provideServiceWorker } from '@angular/service-worker';
|
||||
import { tuiInputPhoneInternationalOptionsProvider } from '@taiga-ui/kit';
|
||||
import { defer } from 'rxjs';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
provideBrowserGlobalErrorListeners(),
|
||||
provideRouter(routes, withRouterConfig({
|
||||
paramsInheritanceStrategy: "always"
|
||||
})),
|
||||
provideRouter(
|
||||
routes,
|
||||
withRouterConfig({
|
||||
paramsInheritanceStrategy: 'always',
|
||||
}),
|
||||
),
|
||||
provideTaiga(),
|
||||
provideTranslateService({
|
||||
fallbackLang: "en",
|
||||
lang: "hu",
|
||||
fallbackLang: 'en',
|
||||
lang: 'hu',
|
||||
loader: provideTranslateHttpLoader({
|
||||
prefix: "/i18n/",
|
||||
suffix: ".json"
|
||||
})
|
||||
prefix: '/i18n/',
|
||||
suffix: '.json',
|
||||
}),
|
||||
}),
|
||||
provideServiceWorker('ngsw-worker.js', {
|
||||
enabled: !isDevMode(),
|
||||
registrationStrategy: 'registerWhenStable:30000'
|
||||
registrationStrategy: 'registerWhenStable:30000',
|
||||
}),
|
||||
tuiInputPhoneInternationalOptionsProvider({
|
||||
metadata: defer(async () =>
|
||||
import('libphonenumber-js/max/metadata').then((m) => m.default),
|
||||
),
|
||||
metadata: defer(async () => import('libphonenumber-js/max/metadata').then((m) => m.default)),
|
||||
}),
|
||||
provideTaiga(),
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
import {Routes} from '@angular/router';
|
||||
import {SignIn} from './signin/signin';
|
||||
import {Chat} from './chat/chat';
|
||||
import {Dm} from './chat/dm/dm';
|
||||
import {noAuthGuard} from './guards/no-auth-guard';
|
||||
import {authNeededGuard} from './guards/auth-needed-guard';
|
||||
import {Homepage} from './homepage/homepage';
|
||||
import {Privacy} from './privacy/privacy';
|
||||
import {TOS} from './tos/tos';
|
||||
import {Network} from './chat/network/network';
|
||||
import {Text} from './chat/network/channel/text/text';
|
||||
import {See} from './chat/picture/see/see';
|
||||
import { Routes } from '@angular/router';
|
||||
import { SignIn } from './signin/signin';
|
||||
import { Chat } from './chat/chat';
|
||||
import { Dm } from './chat/dm/dm';
|
||||
import { noAuthGuard } from './guards/no-auth-guard';
|
||||
import { authNeededGuard } from './guards/auth-needed-guard';
|
||||
import { Homepage } from './homepage/homepage';
|
||||
import { Privacy } from './privacy/privacy';
|
||||
import { TOS } from './tos/tos';
|
||||
import { Network } from './chat/network/network';
|
||||
import { Text } from './chat/network/channel/text/text';
|
||||
import { See } from './chat/picture/see/see';
|
||||
|
||||
export const routes: Routes = [
|
||||
{path: '', component: Homepage},
|
||||
{path: 'privacy', component: Privacy},
|
||||
{path: 'tos', component: TOS},
|
||||
{path: 'signin', component: SignIn, canActivate: [noAuthGuard]},
|
||||
{ path: '', component: Homepage },
|
||||
{ path: 'privacy', component: Privacy },
|
||||
{ path: 'tos', component: TOS },
|
||||
{ path: 'signin', component: SignIn, canActivate: [noAuthGuard] },
|
||||
{
|
||||
path: 'chat', component: Chat, canActivate: [authNeededGuard], children: [
|
||||
{path: 'dm/:chatid', component: Dm},
|
||||
{path: 'picture/:uploaderId', component: See},
|
||||
{
|
||||
path: 'network/:networkId', component: Network, children: [
|
||||
{path: ":categoryId/:channelId", component: Text}
|
||||
]
|
||||
},
|
||||
]
|
||||
path: 'chat',
|
||||
component: Chat,
|
||||
canActivate: [authNeededGuard],
|
||||
children: [
|
||||
{ path: 'dm/:chatid', component: Dm },
|
||||
{ path: 'picture/:uploaderId', component: See },
|
||||
{ path: 'network/:networkId/:categoryId/:channelId', component: Text },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { TuiRoot } from '@taiga-ui/core';
|
||||
import {Component, inject, OnInit, signal} from '@angular/core';
|
||||
import { Component, inject, OnInit, signal } from '@angular/core';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import { environment as env } from '../environments/environment';
|
||||
import {environment, SDKConfig} from '@chatenium/chatenium-sdk/core/environment';
|
||||
import {IndexedDB} from './storage/indexed-db';
|
||||
import { environment, SDKConfig } from '@chatenium/chatenium-sdk/core/environment';
|
||||
import { IndexedDB } from './storage/indexed-db';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
imports: [RouterOutlet, TuiRoot],
|
||||
imports: [RouterOutlet, TuiRoot, TuiRoot],
|
||||
templateUrl: './app.html',
|
||||
styleUrl: './app.scss',
|
||||
})
|
||||
export class App implements OnInit {
|
||||
indexedDb = inject(IndexedDB)
|
||||
indexedDb = inject(IndexedDB);
|
||||
|
||||
protected readonly title = signal('Chatenium-On-Web');
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<h3>{{ "version"|translate }}</h3>
|
||||
<ul>
|
||||
<li>{{ "chat.changeLogDialog.changeLog.1"|translate }}</li>
|
||||
<li>{{ "chat.changeLogDialog.changeLog.2"|translate }}</li>
|
||||
</ul>
|
||||
|
||||
<button tuiButton iconStart="@tui.check"
|
||||
@@ -10,33 +11,35 @@
|
||||
</button>
|
||||
</ng-template>
|
||||
|
||||
<ng-template [(tuiDialog)]="userSettingsOpen" [tuiDialogOptions]="{closable: false, appearance: 'taiga big'}" class="user-settings">
|
||||
<user-settings (close)="userSettingsOpen.set(false)"/>
|
||||
<ng-template [(tuiDialog)]="userSettingsOpen" [tuiDialogOptions]="{closable: false, appearance: 'taiga big'}"
|
||||
class="user-settings">
|
||||
<user-settings (close)="userSettingsOpen.set(false)" />
|
||||
</ng-template>
|
||||
|
||||
@if (serviceManager.currentSession() == null) {
|
||||
<main style="width: 100%; height: 100svh; display: flex; justify-content: center; align-items: center;">
|
||||
<tui-loader size="xl"/>
|
||||
<tui-loader size="xl" />
|
||||
</main>
|
||||
} @else {
|
||||
@if (breakpoint() != "mobile") {
|
||||
<main id="layout" tuiGroup [collapsed]="true">
|
||||
<main id="layout" tuiGroup [collapsed]="true" [class.expanded]="expandedSidenav()">
|
||||
<aside id="chatnav">
|
||||
<aside>
|
||||
<tui-segmented id="mode_switcher" [(activeItemIndex)]="navigationActiveIndex">
|
||||
<button>
|
||||
<tui-icon icon="@tui.message-circle"/>
|
||||
<button (click)="expandedSidenav.set(false)">
|
||||
<tui-icon icon="@tui.message-circle" />
|
||||
</button>
|
||||
<button>
|
||||
<tui-icon icon="@tui.network"/>
|
||||
<tui-icon icon="@tui.network" />
|
||||
</button>
|
||||
<button>
|
||||
<tui-icon icon="@tui.image"/>
|
||||
<button (click)="expandedSidenav.set(false)">
|
||||
<tui-icon icon="@tui.image" />
|
||||
</button>
|
||||
</tui-segmented>
|
||||
|
||||
<button id="bottom_btn" tuiButton [appearance]="userSettingsOpen() ? 'primary' : 'flat'" (click)="userSettingsOpen.set(true)">
|
||||
<tui-icon icon="@tui.cog"/>
|
||||
<button id="bottom_btn" tuiButton [appearance]="userSettingsOpen() ? 'primary' : 'flat'"
|
||||
(click)="userSettingsOpen.set(true)">
|
||||
<tui-icon icon="@tui.cog" />
|
||||
</button>
|
||||
</aside>
|
||||
|
||||
@@ -47,7 +50,9 @@
|
||||
[userid]="serviceManager.currentSession()!.userData.userid"></app-dm-list>
|
||||
}
|
||||
@case (1) {
|
||||
<network-list [token]="serviceManager.currentSession()!.token"
|
||||
<network-list
|
||||
[(expandedSidenav)]="expandedSidenav"
|
||||
[token]="serviceManager.currentSession()!.token"
|
||||
[userid]="serviceManager.currentSession()!.userData.userid"></network-list>
|
||||
}
|
||||
@case (2) {
|
||||
@@ -63,14 +68,14 @@
|
||||
@if (router.url.startsWith("/chat/dm") || router.url.startsWith("/chat/picture")) {
|
||||
<!-- To ensure data is loaded -->
|
||||
@defer (when serviceManager.chatsStatus() != LoadStatus.loading) {
|
||||
<router-outlet/>
|
||||
<router-outlet />
|
||||
}
|
||||
} @else if (router.url.startsWith("/chat/network")) {
|
||||
@defer (when serviceManager.networksStatus() != LoadStatus.loading) {
|
||||
<router-outlet/>
|
||||
<router-outlet />
|
||||
}
|
||||
} @else {
|
||||
<router-outlet/>
|
||||
<router-outlet />
|
||||
}
|
||||
</div>
|
||||
</main>
|
||||
@@ -86,7 +91,9 @@
|
||||
[userid]="serviceManager.currentSession()!.userData.userid"></app-dm-list>
|
||||
}
|
||||
@case (1) {
|
||||
<network-list [token]="serviceManager.currentSession()!.token"
|
||||
<network-list
|
||||
[(expandedSidenav)]="expandedSidenav"
|
||||
[token]="serviceManager.currentSession()!.token"
|
||||
[userid]="serviceManager.currentSession()!.userData.userid"></network-list>
|
||||
}
|
||||
@case (2) {
|
||||
@@ -94,7 +101,7 @@
|
||||
[userid]="serviceManager.currentSession()!.userData.userid"></app-picture-list>
|
||||
}
|
||||
@case (3) {
|
||||
<user-settings/>
|
||||
<user-settings />
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@@ -119,14 +126,14 @@
|
||||
@if (router.url.startsWith("/chat/dm") || router.url.startsWith("/chat/picture")) {
|
||||
<!-- To ensure data is loaded -->
|
||||
@defer (when serviceManager.chatsStatus() != LoadStatus.loading) {
|
||||
<router-outlet (activate)="routerOutletActive.set(true)" (deactivate)="routerOutletActive.set(false)"/>
|
||||
<router-outlet (activate)="routerOutletActive.set(true)" (deactivate)="routerOutletActive.set(false)" />
|
||||
}
|
||||
} @else if (router.url.startsWith("/chat/network")) {
|
||||
@defer (when serviceManager.networksStatus() != LoadStatus.loading) {
|
||||
<router-outlet (activate)="routerOutletActive.set(true)" (deactivate)="routerOutletActive.set(false)"/>
|
||||
<router-outlet (activate)="routerOutletActive.set(true)" (deactivate)="routerOutletActive.set(false)" />
|
||||
}
|
||||
} @else {
|
||||
<router-outlet (activate)="routerOutletActive.set(true)" (deactivate)="routerOutletActive.set(false)"/>
|
||||
<router-outlet (activate)="routerOutletActive.set(true)" (deactivate)="routerOutletActive.set(false)" />
|
||||
}
|
||||
</main>
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
#layout {
|
||||
transition: 0.3s ease;
|
||||
display: grid;
|
||||
grid-template-columns: 350px minmax(0, 1fr);
|
||||
height: 100svh;
|
||||
overflow: hidden;
|
||||
|
||||
&.expanded {
|
||||
grid-template-columns: 450px minmax(0, 1fr) !important;
|
||||
}
|
||||
|
||||
#chatnav {
|
||||
display: grid;
|
||||
@@ -44,11 +48,12 @@
|
||||
}
|
||||
|
||||
main {
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
background: var(--tui-background-base-alt);
|
||||
border-radius: 20px 0 0 20px;
|
||||
margin: 10px 0 10px 10px;
|
||||
padding: 15px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ export class Chat implements OnInit {
|
||||
breakpoint = inject(TUI_BREAKPOINT)
|
||||
router = inject(Router)
|
||||
|
||||
expandedSidenav = signal(false)
|
||||
|
||||
routerOutletActive = signal(false)
|
||||
userSettingsOpen = signal(false)
|
||||
|
||||
|
||||
@@ -1,19 +1,35 @@
|
||||
<button disabled tuiButton appearance="secondary" iconStart="@tui.plus">
|
||||
<div id="holder" [class.networkActive]="selectedNetwork() != null">
|
||||
<div id="networks">
|
||||
<button disabled tuiButton appearance="secondary" iconStart="@tui.plus">
|
||||
{{ "chat.chatnav.networkList.newNetwork"|translate }}
|
||||
</button>
|
||||
@if (serviceManager.networksStatus() == LoadStatus.updating) {
|
||||
</button>
|
||||
@if (serviceManager.networksStatus() == LoadStatus.updating) {
|
||||
<div id="loader">
|
||||
<tui-loader />
|
||||
{{"updating"|translate}}
|
||||
</div>
|
||||
}
|
||||
@for (network of serviceManager.networks(); track network.networkId) {
|
||||
}
|
||||
|
||||
@for (network of serviceManager.networks(); track network.networkId) {
|
||||
<button [class.enlarge]="breakpoint() == 'mobile'" tuiButton
|
||||
[appearance]="router.url.startsWith('/chat/network/' + network.networkId) ? 'primary' : 'flat'"
|
||||
[routerLink]="'/chat/network/' + network.networkId">
|
||||
appearance="flat"
|
||||
(click)="selectNetwork(network)">
|
||||
<oimg [src]="network.picture" height="35px" width="35px" [radius]="10"></oimg>
|
||||
<div class="info">
|
||||
<span>{{ network.name }}</span>
|
||||
</div>
|
||||
</button>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<div id="network">
|
||||
<div style="display: flex; align-items: center; gap: 1rem;">
|
||||
<button tuiButton appearance="secondary" iconStart="@tui.arrow-left" (click)="selectNetwork(null)"></button>
|
||||
@if (selectedNetwork() != null) {
|
||||
<oimg [src]="selectedNetwork()!.picture" height="35px" width="35px" [radius]="15"></oimg>
|
||||
<h3>{{ selectedNetwork()!.name }}</h3>
|
||||
}
|
||||
</div>
|
||||
<network [network]="selectedNetwork()!"></network>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,31 @@
|
||||
:host {
|
||||
#holder {
|
||||
position: relative;
|
||||
|
||||
&.networkActive {
|
||||
#networks {
|
||||
transform: translateX(100px);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#network {
|
||||
pointer-events: all;
|
||||
transform: translateX(0);
|
||||
opacity: 1;
|
||||
|
||||
network {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#networks {
|
||||
transition: 0.3s;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
@@ -25,4 +52,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#network {
|
||||
pointer-events: none;
|
||||
transform: translateX(-100px);
|
||||
opacity: 0;
|
||||
transition: 0.2s;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, inject, input, OnInit} from '@angular/core';
|
||||
import { Component, inject, input, model, OnInit, signal } from '@angular/core';
|
||||
import {IndexedDB} from '../../storage/indexed-db';
|
||||
import {Router, RouterLink} from '@angular/router';
|
||||
import {LoadStatus, ServiceManager} from '../../service-manager';
|
||||
@@ -6,43 +6,53 @@ import {TUI_BREAKPOINT, TuiButton, TuiLoader} from '@taiga-ui/core';
|
||||
import {NetworkService} from '@chatenium/chatenium-sdk/services/networkService';
|
||||
import {Oimg} from '../elements/oimg/oimg';
|
||||
import {TranslatePipe} from '@ngx-translate/core';
|
||||
import { Network as NetworkData } from '@chatenium/chatenium-sdk/domain/networkService.schema';
|
||||
import { Network } from '../network/network';
|
||||
|
||||
@Component({
|
||||
selector: 'network-list',
|
||||
imports: [
|
||||
Oimg,
|
||||
TranslatePipe,
|
||||
TuiButton,
|
||||
RouterLink,
|
||||
TuiLoader
|
||||
],
|
||||
imports: [Oimg, TranslatePipe, TuiButton, TuiLoader, Network],
|
||||
templateUrl: './network-list.html',
|
||||
styleUrl: './network-list.scss',
|
||||
})
|
||||
export class NetworkList implements OnInit {
|
||||
userid = input<string>("")
|
||||
token = input<string>("")
|
||||
userid = input<string>('');
|
||||
token = input<string>('');
|
||||
expandedSidenav = model.required<boolean>();
|
||||
|
||||
indexedDb = inject(IndexedDB)
|
||||
router = inject(Router)
|
||||
serviceManager = inject(ServiceManager)
|
||||
breakpoint = inject(TUI_BREAKPOINT)
|
||||
selectedNetwork = signal<NetworkData | null>(null);
|
||||
|
||||
indexedDb = inject(IndexedDB);
|
||||
router = inject(Router);
|
||||
serviceManager = inject(ServiceManager);
|
||||
breakpoint = inject(TUI_BREAKPOINT);
|
||||
|
||||
selectNetwork(network: NetworkData | null) {
|
||||
this.selectedNetwork.set(network);
|
||||
this.expandedSidenav.set(network !== null);
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.serviceManager.networkService = new NetworkService(this.userid(), this.token(), "", this.indexedDb.getApi(), () => {})
|
||||
this.serviceManager.networkService = new NetworkService(
|
||||
this.userid(),
|
||||
this.token(),
|
||||
'',
|
||||
this.indexedDb.getApi(),
|
||||
() => {},
|
||||
);
|
||||
if (this.serviceManager.networksStatus() != LoadStatus.loaded) {
|
||||
try {
|
||||
this.serviceManager.networks.set(await this.serviceManager.networkService.getQuick())
|
||||
this.serviceManager.networksStatus.set(LoadStatus.updating)
|
||||
this.serviceManager.networks.set(await this.serviceManager.networkService.getQuick());
|
||||
this.serviceManager.networksStatus.set(LoadStatus.updating);
|
||||
} catch (e) {
|
||||
console.warn(`Cache load failed: ${e}. Skipping cache load...`)
|
||||
console.warn(`Cache load failed: ${e}. Skipping cache load...`);
|
||||
}
|
||||
try {
|
||||
this.serviceManager.networks.set(await this.serviceManager.networkService.get())
|
||||
this.serviceManager.networksStatus.set(LoadStatus.loaded)
|
||||
this.serviceManager.networks.set(await this.serviceManager.networkService.get());
|
||||
this.serviceManager.networksStatus.set(LoadStatus.loaded);
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
this.serviceManager.networksStatus.set(LoadStatus.error)
|
||||
console.error(e);
|
||||
this.serviceManager.networksStatus.set(LoadStatus.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +1,19 @@
|
||||
@defer(when store) {
|
||||
<div id="layout" [class.routerOutletActive]="routerOutletActive()" [class.hideNetworkNav]="routerOutletActive() && breakpoint() == 'desktopSmall'">
|
||||
<div id="router">
|
||||
<router-outlet (activate)="routerOutletActive.set(true)" (deactivate)="routerOutletActive.set(false)"></router-outlet>
|
||||
</div>
|
||||
@defer (when store) {
|
||||
<div id="layout" [class.routerOutletActive]="routerOutletActive()"
|
||||
[class.hideNetworkNav]="routerOutletActive() && breakpoint() == 'desktopSmall'">
|
||||
<div id="network-data">
|
||||
<navbar backButtonDest="/chat" dataAlignment="center">
|
||||
<div class="data">
|
||||
<oimg [src]="store.networkData().picture" height="50px" width="50px" [radius]="15"></oimg>
|
||||
<h2>{{store.networkData().name}}</h2>
|
||||
</div>
|
||||
|
||||
<div class="items-right"></div>
|
||||
</navbar>
|
||||
|
||||
<tui-tabs [(activeItemIndex)]="tabActiveIndex">
|
||||
<button
|
||||
iconStart="@tui.hash"
|
||||
tuiTab
|
||||
type="button"
|
||||
>
|
||||
{{"chat.network.tabs.channels"|translate}}
|
||||
</button>
|
||||
|
||||
<button
|
||||
disabled
|
||||
iconStart="@tui.users"
|
||||
tuiTab
|
||||
type="button"
|
||||
>
|
||||
{{"chat.network.tabs.members"|translate}}
|
||||
</button>
|
||||
|
||||
<button
|
||||
iconStart="@tui.cog"
|
||||
tuiTab
|
||||
type="button"
|
||||
>
|
||||
{{"chat.network.tabs.settings"|translate}}
|
||||
</button>
|
||||
</tui-tabs>
|
||||
|
||||
<br/>
|
||||
|
||||
@switch (tabActiveIndex) {
|
||||
@case (0) {
|
||||
<main tuiGroup orientation="vertical" style="width: 100%">
|
||||
<main tuiGroup orientation="vertical" style="width: 100%; height: 80svh">
|
||||
@for (category of store.networkData().categories; track category) {
|
||||
<div class="category">
|
||||
<h2>{{category.name}}</h2>
|
||||
<h2>{{ category.name }}</h2>
|
||||
|
||||
<div tuiGroup orientation="vertical" style="width: 100%">
|
||||
<div class="channels">
|
||||
@for (channel of category.channels; track channel) {
|
||||
<button tuiButton class="channel" [appearance]="router.url.endsWith(channel.channelId) ? 'primary' : 'secondary'" [disabled]="channel.type != 'message'" [routerLink]="'/chat/network/'+store.networkData().networkId+'/'+category.categoryId+'/'+channel.channelId">
|
||||
<div class="channel">
|
||||
<button tuiButton
|
||||
[appearance]="router.url.endsWith(channel.channelId) ? 'secondary' : 'flat'"
|
||||
[disabled]="channel.type != 'message'"
|
||||
[routerLink]="'/chat/network/'+store.networkData().networkId+'/'+category.categoryId+'/'+channel.channelId">
|
||||
@switch (channel.type) {
|
||||
@case ("message") {
|
||||
<tui-icon icon="@tui.hash"></tui-icon>
|
||||
@@ -63,20 +25,19 @@
|
||||
<tui-icon icon="@tui.audio-lines"></tui-icon>
|
||||
}
|
||||
}
|
||||
<span>{{channel.name}}</span>
|
||||
<span>{{ channel.name }}</span>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</main>
|
||||
}
|
||||
@case (2) {
|
||||
<!-- @case (2) {
|
||||
<main id="settings">
|
||||
<network-settings [networkStore]="this.store"></network-settings>
|
||||
</main>
|
||||
}
|
||||
}
|
||||
}-->
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
overflow-y: scroll;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
grid-template-columns: 0 100%;
|
||||
overflow-x: hidden;
|
||||
padding: 15px;
|
||||
transition: 0.2s;
|
||||
@@ -13,20 +11,6 @@
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
&.routerOutletActive {
|
||||
overflow-y: hidden;
|
||||
padding: 0;
|
||||
grid-template-columns: 1fr 300px;
|
||||
|
||||
#router {
|
||||
background: var(--tui-background-neutral-1);
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
&.hideNetworkNav {
|
||||
grid-template-columns: 1fr;
|
||||
|
||||
@@ -38,7 +22,6 @@
|
||||
}
|
||||
|
||||
.category {
|
||||
background: var(--tui-background-base-alt);
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
|
||||
@@ -46,6 +29,31 @@
|
||||
display: flex;
|
||||
justify-content: start;
|
||||
}
|
||||
|
||||
.channels {
|
||||
position: relative;
|
||||
padding-left: 24px; /* Space for the line and spacing */
|
||||
border-left: 2px solid var(--tui-background-neutral-1-hover); /* Main vertical track */
|
||||
margin-left: 8px; /* Shifts child tracks slightly right */
|
||||
|
||||
.channel {
|
||||
height: 50px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.channel::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: -26px; /* Reaches backward to snap to the parent track */
|
||||
top: 10px; /* Aligns horizontally with the center of the user header */
|
||||
width: 22px; /* Defines width of the horizontal curve */
|
||||
height: 14px; /* Defines height of the vertical curve drop */
|
||||
|
||||
border-left: 2px solid var(--tui-background-neutral-1-hover);
|
||||
border-bottom: 2px solid var(--tui-background-neutral-1-hover);
|
||||
border-bottom-left-radius: 8px; /* Creates the smooth curved bend */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#settings {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, inject, OnInit, signal} from '@angular/core';
|
||||
import { Component, effect, inject, input, OnInit, signal } from '@angular/core';
|
||||
import {ActivatedRoute, Router, RouterLink, RouterOutlet} from '@angular/router';
|
||||
import {Chat} from '@chatenium/chatenium-sdk/domain/chatService.schema';
|
||||
import {Message} from '@chatenium/chatenium-sdk/domain/dmService.schema';
|
||||
@@ -15,9 +15,10 @@ import {TuiTab, TuiTabsHorizontal, TuiTabsWithMore} from '@taiga-ui/kit';
|
||||
import {TuiItem} from '@taiga-ui/cdk';
|
||||
import {TranslatePipe} from '@ngx-translate/core';
|
||||
import {Settings} from './settings/settings';
|
||||
import { toObservable } from '@angular/core/rxjs-interop';
|
||||
|
||||
@Component({
|
||||
selector: 'app-network',
|
||||
selector: 'network',
|
||||
imports: [
|
||||
RouterOutlet,
|
||||
Navbar,
|
||||
@@ -31,59 +32,61 @@ import {Settings} from './settings/settings';
|
||||
TuiTab,
|
||||
TranslatePipe,
|
||||
TuiTabsHorizontal,
|
||||
Settings
|
||||
Settings,
|
||||
],
|
||||
templateUrl: './network.html',
|
||||
styleUrl: './network.scss',
|
||||
})
|
||||
export class Network implements OnInit {
|
||||
serviceManager = inject(ServiceManager)
|
||||
route = inject(ActivatedRoute)
|
||||
indexedDb = inject(IndexedDB)
|
||||
breakpoint = inject(TUI_BREAKPOINT)
|
||||
router = inject(Router)
|
||||
export class Network {
|
||||
serviceManager = inject(ServiceManager);
|
||||
route = inject(ActivatedRoute);
|
||||
indexedDb = inject(IndexedDB);
|
||||
breakpoint = inject(TUI_BREAKPOINT);
|
||||
router = inject(Router);
|
||||
|
||||
tabActiveIndex = 0
|
||||
|
||||
routerOutletActive = signal(false)
|
||||
|
||||
networkId = ""
|
||||
get store() {
|
||||
return this.serviceManager.networkServices()[this.networkId]
|
||||
constructor() {
|
||||
effect(() => {
|
||||
if (this.network()) {
|
||||
this.setupNetwork();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe(async params => {
|
||||
console.log("Loading network...")
|
||||
const networkId = params['networkId'];
|
||||
this.networkId = networkId;
|
||||
network = input.required<NetworkData>();
|
||||
|
||||
routerOutletActive = signal(false);
|
||||
|
||||
get store() {
|
||||
return this.serviceManager.networkServices()[this.network().networkId];
|
||||
}
|
||||
|
||||
setupNetwork() {
|
||||
console.log(`Setting up NetworkView for ${this.network().networkId}`);
|
||||
const session = this.serviceManager.currentSession();
|
||||
const networkData = this.serviceManager.networks().find(c => c.networkId === networkId);
|
||||
|
||||
if (!session || !networkData) {
|
||||
console.warn(`Initialization deferred for ${networkId}: Session or NetworkData missing.`);
|
||||
if (!session) {
|
||||
console.warn(
|
||||
`Initialization deferred for ${this.network().networkId}: Session or NetworkData missing.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.serviceManager.networkServices()[networkId]) {
|
||||
if (!this.serviceManager.networkServices()[this.network().networkId]) {
|
||||
const newStore = {
|
||||
networkData: signal<NetworkData>(networkData),
|
||||
networkData: signal<NetworkData>(this.network()),
|
||||
textChannels: signal({}),
|
||||
wsListener: (action, data) => {
|
||||
},
|
||||
wsListener: (action, data) => {},
|
||||
} as NetworkStorage;
|
||||
|
||||
newStore.service = new NetworkService(
|
||||
session.userData.userid,
|
||||
session.token,
|
||||
networkId,
|
||||
this.network().networkId,
|
||||
this.indexedDb.getApi(),
|
||||
(action, data) => newStore.wsListener(action, data)
|
||||
(action, data) => newStore.wsListener(action, data),
|
||||
);
|
||||
|
||||
this.serviceManager.networkServices()[networkId] = newStore;
|
||||
this.serviceManager.networkServices()[this.network().networkId] = newStore;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const environment = {
|
||||
version: "3.0-beta10",
|
||||
version: "3.0-beta11",
|
||||
api_url: "http://localhost:3000",
|
||||
cdn_url: "http://localhost:4000",
|
||||
ws_url: "ws://localhost:3000",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const environment = {
|
||||
version: "3.0-beta10",
|
||||
version: "3.0-beta11",
|
||||
api_url: "https://api.chatenium.hu",
|
||||
cdn_url: "https://cdn.chatenium.hu",
|
||||
ws_url: "wss://api.chatenium.hu",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
|
||||
.drag-active * {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user