diff --git a/src/src/app/app.config.ts b/src/src/app/app.config.ts index 35d91ad..dee9a4b 100644 --- a/src/src/app/app.config.ts +++ b/src/src/app/app.config.ts @@ -5,15 +5,20 @@ import { routes } from './app.routes'; import { provideAnimationsAsync } from '@angular/platform-browser/animations/async'; import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from "@angular/common/http"; import { BearerTokenInterceptor } from "./middleware/bearer-token-interceptor"; +import {MAT_SNACK_BAR_DEFAULT_OPTIONS} from "@angular/material/snack-bar"; export const noopInterceptorProvider: Provider = {provide: HTTP_INTERCEPTORS, useClass: BearerTokenInterceptor, multi: true}; +export const materialSnackbarDefaults: Provider = + {provide: MAT_SNACK_BAR_DEFAULT_OPTIONS, useValue: {duration: 5 * 1000}}; + export const appConfig: ApplicationConfig = { providers: [ provideRouter(routes), provideAnimationsAsync(), provideHttpClient(withInterceptorsFromDi()), noopInterceptorProvider, + materialSnackbarDefaults ] }; diff --git a/src/src/app/common/components/success-snack-bar/success-snack-bar.component.html b/src/src/app/common/components/success-snack-bar/success-snack-bar.component.html deleted file mode 100644 index 9e3eca8..0000000 --- a/src/src/app/common/components/success-snack-bar/success-snack-bar.component.html +++ /dev/null @@ -1,3 +0,0 @@ - - 'hi' - diff --git a/src/src/app/common/components/success-snack-bar/success-snack-bar.component.scss b/src/src/app/common/components/success-snack-bar/success-snack-bar.component.scss deleted file mode 100644 index 1eb9d6b..0000000 --- a/src/src/app/common/components/success-snack-bar/success-snack-bar.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.success { - color: green; -} diff --git a/src/src/app/common/components/success-snack-bar/success-snack-bar.component.spec.ts b/src/src/app/common/components/success-snack-bar/success-snack-bar.component.spec.ts deleted file mode 100644 index ea0a957..0000000 --- a/src/src/app/common/components/success-snack-bar/success-snack-bar.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SuccessSnackBarComponent } from './success-snack-bar.component'; - -describe('SuccessSnackBarComponent', () => { - let component: SuccessSnackBarComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [SuccessSnackBarComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(SuccessSnackBarComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/src/app/common/components/success-snack-bar/success-snack-bar.component.ts b/src/src/app/common/components/success-snack-bar/success-snack-bar.component.ts deleted file mode 100644 index cf9fad9..0000000 --- a/src/src/app/common/components/success-snack-bar/success-snack-bar.component.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-success-snack-bar', - standalone: true, - imports: [], - templateUrl: './success-snack-bar.component.html', - styleUrl: './success-snack-bar.component.scss' -}) -export class SuccessSnackBarComponent { - -} diff --git a/src/src/app/view/twitch/twitch-bot-config/twitch-bot-config.component.ts b/src/src/app/view/twitch/twitch-bot-config/twitch-bot-config.component.ts index 48d6292..b775652 100644 --- a/src/src/app/view/twitch/twitch-bot-config/twitch-bot-config.component.ts +++ b/src/src/app/view/twitch/twitch-bot-config/twitch-bot-config.component.ts @@ -51,6 +51,9 @@ export class TwitchBotConfigComponent implements OnInit, OnDestroy { if (this.timerId !== -1) { clearTimeout(this.timerId); } + + // Close any open notifications when we move to a different screen. + this.snackBar.dismiss(); } ngOnInit(): void { @@ -62,9 +65,9 @@ export class TwitchBotConfigComponent implements OnInit, OnDestroy { if (Errors.TwitchAccountHasNoEmail === errorNum) { this.onLoginFailed('Your Twitch account must have a valid e-mail address, please add one and try again', false) } else if (Errors.TwitchErrorWithToken === errorNum) { - this.onLoginFailed('Twitch failed to give us a valid token, please add one and try again', false) + this.onLoginFailed('Twitch failed to log you in successfully, please try again', false) } else { - this.onLoginFailed('Sorry we did something wrong trying to log you in, please add one and try again', false) + this.onLoginFailed('Sorry we did something wrong trying to log you in, please try again', false) } return; @@ -167,7 +170,7 @@ export class TwitchBotConfigComponent implements OnInit, OnDestroy { }, error: err => { console.error(err); - this.snackBar.open('Failed to save config, please try again...', undefined, { + this.snackBar.open('Failed to save, please try again', undefined, { panelClass: ['snackbar-failure'] }); }