Skip to content

Commit

Permalink
Restyled by prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits committed Apr 21, 2020
1 parent 43655ac commit 5669afd
Show file tree
Hide file tree
Showing 20 changed files with 260 additions and 126 deletions.
27 changes: 16 additions & 11 deletions Phonebook.Frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
InitTheme,
SetTheme,
SetSendFeedback,
SetDisplayedNotificationVersion
SetDisplayedNotificationVersion,
} from 'src/app/shared/states/App.state';
import { ReleaseInfoService } from './services/release-info.service';
import { runtimeEnvironment } from 'src/environments/runtime-environment';
Expand All @@ -27,7 +27,7 @@ import { DialogService } from 'src/app/services/dialog.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
styleUrls: ['./app.component.scss'],
})
export class AppComponent implements OnInit, OnDestroy {
//get url params
Expand Down Expand Up @@ -107,15 +107,17 @@ export class AppComponent implements OnInit, OnDestroy {
this.store.dispatch(new SetDisplayedNotificationVersion(DisplayNotificationDialog.version));
}
//subscribe on query param changes, if changed open snackbar
this.activatedRoute.queryParamMap.pipe(untilComponentDestroyed(this)).subscribe((queryParamMap) => {
if (queryParamMap.get('skip_dialog') === 'true') {
if (!this.skippedDialogs) {
this.openJustSkippedDialogsSnackBar();
} else {
this.openSkippedDialogsSnackBar();
this.activatedRoute.queryParamMap
.pipe(untilComponentDestroyed(this))
.subscribe((queryParamMap) => {
if (queryParamMap.get('skip_dialog') === 'true') {
if (!this.skippedDialogs) {
this.openJustSkippedDialogsSnackBar();
} else {
this.openSkippedDialogsSnackBar();
}
}
}
});
});

// Ask for Permission to send Bug reports, don't show dialog if dialogs should be skipped
if (
Expand All @@ -126,7 +128,10 @@ export class AppComponent implements OnInit, OnDestroy {
this.dialogService.displayDialog('bug-report-consent');
}

if (DisplayNotificationDialog.version > (this.store.selectSnapshot(AppState.displayedNotificationVersion) | 0)) {
if (
DisplayNotificationDialog.version >
(this.store.selectSnapshot(AppState.displayedNotificationVersion) | 0)
) {
this.dialogService.displayDialog('notification');
} else if (!this.skippedDialogs) {
// Display the Release Dialog only if no notification Dialog is shown, in order to not overwhelm the user with dialogs.
Expand Down
25 changes: 14 additions & 11 deletions Phonebook.Frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
CommonPersonsState,
LastPersonsState,
SearchState,
TableState
TableState,
} from 'src/app/shared/states';
import { environment } from 'src/environments/environment';
// Services
Expand All @@ -65,7 +65,7 @@ declare const require;
NavigationComponent,
OnlineBarComponent,
DialogsComponent,
DialogViewComponent
DialogViewComponent,
],
imports: [
BrowserModule,
Expand All @@ -81,12 +81,15 @@ declare const require;
FeatureFlagModule.forRoot(),
NotImplementedModule,
MatBadgeModule,
NgxsModule.forRoot([AppState, BookmarksState, LastPersonsState, CommonPersonsState, SearchState, TableState], {
// TODO: Fix https://github.com/T-Systems-MMS/phonebook/issues/95 first.
// developmentMode: !environment.production
}),
NgxsModule.forRoot(
[AppState, BookmarksState, LastPersonsState, CommonPersonsState, SearchState, TableState],
{
// TODO: Fix https://github.com/T-Systems-MMS/phonebook/issues/95 first.
// developmentMode: !environment.production
}
),
NgxsStoragePluginModule.forRoot({
key: ['appstate', 'bookmarks', 'commonpersons', 'lastpersons', 'tablestate']
key: ['appstate', 'bookmarks', 'commonpersons', 'lastpersons', 'tablestate'],
}),
NgxsRouterPluginModule.forRoot(),
NgxsLoggerPluginModule.forRoot({ disabled: environment.production }),
Expand All @@ -100,7 +103,7 @@ declare const require;
IeWarningModule,
PlatformModule,
// Pages
UserPagesModule
UserPagesModule,
],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: HttpRedirectToLogin, multi: true },
Expand All @@ -115,16 +118,16 @@ declare const require;
// },
{
provide: MAT_DIALOG_DEFAULT_OPTIONS,
useValue: { panelClass: ['mat-dialog-override', 'mat-typography'] }
useValue: { panelClass: ['mat-dialog-override', 'mat-typography'] },
},
WINDOW_PROVIDER,
ServiceWorkerService,
WindowRef,
MailService,
FloorplanService,
ReleaseInfoService,
ThemeService
ThemeService,
],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
})
export class AppModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ describe('DialogViewComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DialogViewComponent ]
})
.compileComponents();
declarations: [DialogViewComponent],
}).compileComponents();
}));

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import {
ComponentRef,
ComponentFactoryResolver,
ComponentFactory,
ChangeDetectorRef
ChangeDetectorRef,
} from '@angular/core';
import { DialogItem } from 'src/app/dialogs/dialog-item';

@Component({
selector: 'app-dialog-view',
templateUrl: './dialog-view.component.html',
styleUrls: ['./dialog-view.component.scss']
styleUrls: ['./dialog-view.component.scss'],
})
export class DialogViewComponent {
@Input() title: string;
Expand All @@ -27,7 +27,9 @@ export class DialogViewComponent {
ngAfterViewInit(): void {
//Called after ngAfterContentInit when the component's view has been initialized. Applies to components only.
//Add 'implements AfterViewInit' to the class.
const factory: ComponentFactory<any> = this.resolver.resolveComponentFactory(this.content.component);
const factory: ComponentFactory<any> = this.resolver.resolveComponentFactory(
this.content.component
);
this.componentRef = this.container.createComponent(factory);
this.componentRef.instance.data = this.data;
this.cdRef.detectChanges();
Expand Down
7 changes: 6 additions & 1 deletion Phonebook.Frontend/src/app/dialogs/dialogs.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ <h1 mat-dialog-title>
</h1>
</div>
<div mat-dialog-content>
<app-dialog-view #appdialogview [title]="title" [content]="content" [data]="data"></app-dialog-view>
<app-dialog-view
#appdialogview
[title]="title"
[content]="content"
[data]="data"
></app-dialog-view>
</div>
</div>
4 changes: 2 additions & 2 deletions Phonebook.Frontend/src/app/dialogs/dialogs.component.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.github-icon {
margin: 0 16px 0 0;
margin: 0 16px 0 0;
}

.close-button {
float: right;
float: right;
}
5 changes: 2 additions & 3 deletions Phonebook.Frontend/src/app/dialogs/dialogs.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ describe('DialogsComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DialogsComponent ]
})
.compileComponents();
declarations: [DialogsComponent],
}).compileComponents();
}));

beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion Phonebook.Frontend/src/app/dialogs/dialogs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DialogItem } from 'src/app/dialogs/dialog-item';
@Component({
selector: 'app-dialogs',
templateUrl: './dialogs.component.html',
styleUrls: ['./dialogs.component.scss']
styleUrls: ['./dialogs.component.scss'],
})
export class DialogsComponent implements OnInit {
title: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { DialogService } from 'src/app/services/dialog.service';
@Component({
selector: 'app-profile-picture',
templateUrl: './profile-picture.component.html',
styleUrls: ['./profile-picture.component.scss']
styleUrls: ['./profile-picture.component.scss'],
})
export class ProfilePictureComponent implements OnInit, OnDestroy {
@Input()
Expand Down
18 changes: 9 additions & 9 deletions Phonebook.Frontend/src/app/services/dialog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ProfilePictureEnlargeDialog } from 'src/app/modules/profile-picture/com
import { IeWarningComponent } from 'src/app/shared/dialogs/ie-warning/ie-warning.component';
import { IncorrectUserInformationComponent } from 'src/app/shared/dialogs/user-information/incorrect-user-information.component';
@Injectable({
providedIn: 'root'
providedIn: 'root',
})
export class DialogService {
constructor(
Expand All @@ -35,31 +35,31 @@ export class DialogService {
case 'release-notes':
dialogConfig.data = {
title: "We've updated to a newer Version!",
content: new DialogItem(ReleaseNotificationDialog)
content: new DialogItem(ReleaseNotificationDialog),
};
this.dialog.open(DialogsComponent, dialogConfig);
break;

case 'feedback':
dialogConfig.data = {
title: 'Leave Feedback, report a Bug or suggest a new Idea',
content: new DialogItem(FeedbackDrawerSheetComponent)
content: new DialogItem(FeedbackDrawerSheetComponent),
};
this.dialog.open(DialogsComponent, dialogConfig);
break;

case 'notification':
dialogConfig.data = {
title: 'Welcome to the new Phonebook!',
content: new DialogItem(DisplayNotificationDialog)
content: new DialogItem(DisplayNotificationDialog),
};
this.dialog.open(DialogsComponent, dialogConfig);
break;

case 'bug-report-consent':
dialogConfig.data = {
title: 'Leave Feedback, report a Bug or suggest a new Idea',
content: new DialogItem(BugReportConsentComponent)
content: new DialogItem(BugReportConsentComponent),
};
const matDialogRef = this.dialog.open(DialogsComponent, dialogConfig);
matDialogRef.afterClosed().subscribe((consent) => {
Expand All @@ -73,16 +73,16 @@ export class DialogService {
content: new DialogItem(ProfilePictureEnlargeDialog),
inputData: {
imageUrl: inputData[0],
text: inputData[1]
}
text: inputData[1],
},
};
this.dialog.open(DialogsComponent, dialogConfig);
break;

case 'ie-warning':
dialogConfig.data = {
title: 'This Website may not function properly in Internet Explorer',
content: new DialogItem(IeWarningComponent)
content: new DialogItem(IeWarningComponent),
};
dialogConfig.panelClass = 'color-warn';
this.dialog.open(DialogsComponent, dialogConfig);
Expand All @@ -92,7 +92,7 @@ export class DialogService {
dialogConfig.data = {
title: 'Incorrect User Information',
content: new DialogItem(IncorrectUserInformationComponent),
inputData: inputData
inputData: inputData,
};
this.dialog.open(DialogsComponent, dialogConfig);
break;
Expand Down
9 changes: 6 additions & 3 deletions Phonebook.Frontend/src/app/services/release-info.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { VERSION } from 'src/environments/version';
import { DialogService } from 'src/app/services/dialog.service';

@Injectable({
providedIn: 'root'
providedIn: 'root',
})
export class ReleaseInfoService {
public newUpdate: boolean = false; //shows that the application was updated
Expand Down Expand Up @@ -59,7 +59,7 @@ export class ReleaseInfoService {
$localize`:ReleaseInfoService|Snack Bar display for a feature update@@ReleaseInfoServiceSnackBarUpdateTitle:We've fixed some Bugs and added some new Features for you, with ❤`,
$localize`:ReleaseInfoService|Snack Bar display Action Button for a feature update@@ReleaseInfoServiceSnackBarUpdateButton:Fixed what?`,
{
duration: 8000
duration: 8000,
}
)
.onAction()
Expand All @@ -73,7 +73,10 @@ export class ReleaseInfoService {
* @param previousVersion
* @param nextVersion
*/
public static whatVersionIncrement(previousVersion: string, nextVersion: string): VersionIncrement {
public static whatVersionIncrement(
previousVersion: string,
nextVersion: string
): VersionIncrement {
const versionRegex = new RegExp('^(\\d*)\\.(\\d*)\\.(\\d*)$');
const matchedPreviousVersion = versionRegex.exec(previousVersion);
const matchedNextVersion = versionRegex.exec(nextVersion);
Expand Down
Loading

0 comments on commit 5669afd

Please sign in to comment.