-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite frontend to use signals (#12)
- rewrite frontend to use signals - bump version - minor UI tweaks - switch keybind generator select checkbox color to mat-accent - make error snackbars consistent - fix vertical overflow of header buttons on mobile - update some texts and snackbars - add alt tag to avatar in header - fix local playback button incorrectly appearing on random buttons - typography improvements: ditch title case, always refer to the Discord guild as server - switch to new functional guards API
- Loading branch information
Showing
77 changed files
with
1,416 additions
and
1,674 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "discord-soundboard-bot" | ||
version = "0.3.3" | ||
version = "0.4.0-dev" | ||
authors = ["Dominik Kus <[email protected]>"] | ||
edition = "2021" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
<ng-container *ngIf="loggedIn$ | async; else needsLogin"> | ||
<router-outlet></router-outlet> | ||
<ng-container *appDataLoad="data$; callback: loadedData$" [ngSwitch]="apiService.user() != null"> | ||
<router-outlet *ngSwitchCase="true"></router-outlet> | ||
<app-login *ngSwitchCase="false"></app-login> | ||
</ng-container> | ||
|
||
<ng-template #needsLogin> | ||
<app-login></app-login> | ||
</ng-template> | ||
|
||
<app-error-box></app-error-box> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
import { Component } from '@angular/core'; | ||
import { LoginService } from './services/login.service'; | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { forkJoin, of, Subject } from 'rxjs'; | ||
import { catchError } from 'rxjs/operators'; | ||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; | ||
import { ApiService, AppInfo, User } from './services/api.service'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class AppComponent { | ||
state: 'loading' | 'finished' | 'error' = 'loading'; | ||
get loggedIn$() { | ||
return this.loginService.loggedIn$; | ||
} | ||
readonly data$ = forkJoin([this.apiService.loadAppInfo(), this.apiService.loadUser().pipe(catchError(() => of(null)))]); | ||
readonly loadedData$ = new Subject<[AppInfo, User]>(); | ||
|
||
constructor(private loginService: LoginService) {} | ||
constructor(protected apiService: ApiService) { | ||
this.loadedData$.pipe(takeUntilDestroyed()).subscribe(data => { | ||
this.apiService.appInfo.set(data[0]); | ||
this.apiService.user.set(data[1]); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { ChangeDetectionStrategy, Component, EventEmitter, Output } from '@angular/core'; | ||
|
||
@Component({ | ||
template: ` | ||
<div class="error-box"> | ||
<mat-icon>error</mat-icon> | ||
<div>There was an error loading the required data. Please try again later.</div> | ||
</div> | ||
<button mat-button (click)="retry.emit()"><mat-icon>refresh</mat-icon> Retry</button> | ||
`, | ||
styles: [ | ||
` | ||
@use '@angular/material' as mat; | ||
:host { | ||
@include mat.elevation(4); | ||
background-color: rgba(255, 0, 0, 0.2); | ||
border-radius: 5px; | ||
display: block; | ||
max-width: 400px; | ||
margin: 16px auto; | ||
padding: 16px; | ||
} | ||
.error-box { | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: 8px; | ||
gap: 8px; | ||
mat-icon { | ||
flex-shrink: 0; | ||
} | ||
} | ||
`, | ||
], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class DataLoadErrorComponent { | ||
@Output() retry = new EventEmitter<void>(); | ||
} |
Oops, something went wrong.