Skip to content

Commit

Permalink
prettier-all-the-things
Browse files Browse the repository at this point in the history
  • Loading branch information
randallmeeker authored and GrandSchtroumpf committed Sep 25, 2021
1 parent b7c14bc commit c846b74
Show file tree
Hide file tree
Showing 89 changed files with 508 additions and 365 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"karma-jasmine-html-reporter": "^1.5.0",
"karma-mocha-reporter": "^2.2.5",
"ng-packagr": "^12.0.0",
"prettier": "^2.4.1",
"ts-node": "~7.0.0",
"tslint": "~6.1.0",
"typescript": "^4.2.3"
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { Component } from '@angular/core';

@Component({
selector: 'app-root',
template: '<router-outlet></router-outlet>'
template: '<router-outlet></router-outlet>',
})
export class AppComponent {}
77 changes: 46 additions & 31 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,51 @@ import { environment } from 'src/environments/environment';
AngularFireAuthModule,
AngularFireDatabaseModule,
// Routers
RouterModule.forRoot([
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{
path: 'movies',
loadChildren: () => import('./collection/movie.module').then(m => m.MovieModule)
},
{
path: 'catalog',
loadChildren: () => import('./many-active/catalog.module').then(m => m.CatalogModule)
},
{
path: 'company',
loadChildren: () => import('./collection-group/company.module').then(m => m.CompanyModule)
},
{
path: 'organization',
loadChildren: () => import('./sync-many-ids/organization.module').then(m => m.OrganizationModule)
},
{
path: 'marketplace',
loadChildren: () => import('./dynamic-store/marketplace.module').then(m => m.MarketplaceModule)
},
{
path: 'vehicle',
loadChildren: () => import('./real-time/vehicle.module').then(m => m.VehicleModule)
}
], { paramsInheritanceStrategy: 'always', relativeLinkResolution: 'legacy' }),
AkitaNgRouterStoreModule
RouterModule.forRoot(
[
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{
path: 'movies',
loadChildren: () =>
import('./collection/movie.module').then((m) => m.MovieModule),
},
{
path: 'catalog',
loadChildren: () =>
import('./many-active/catalog.module').then((m) => m.CatalogModule),
},
{
path: 'company',
loadChildren: () =>
import('./collection-group/company.module').then(
(m) => m.CompanyModule
),
},
{
path: 'organization',
loadChildren: () =>
import('./sync-many-ids/organization.module').then(
(m) => m.OrganizationModule
),
},
{
path: 'marketplace',
loadChildren: () =>
import('./dynamic-store/marketplace.module').then(
(m) => m.MarketplaceModule
),
},
{
path: 'vehicle',
loadChildren: () =>
import('./real-time/vehicle.module').then((m) => m.VehicleModule),
},
],
{ paramsInheritanceStrategy: 'always', relativeLinkResolution: 'legacy' }
),
AkitaNgRouterStoreModule,
],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
2 changes: 1 addition & 1 deletion src/app/auth/+state/auth.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export function createProfile(profile: Partial<Profile>): Profile {
photoURL: '',
organizationIds: [],
email: '',
...profile
...profile,
};
}
2 changes: 0 additions & 2 deletions src/app/auth/+state/auth.query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { AuthStore, AuthState } from './auth.store';

@Injectable({ providedIn: 'root' })
export class AuthQuery extends Query<AuthState> {

constructor(protected store: AuthStore) {
super(store);
}

}
3 changes: 1 addition & 2 deletions src/app/auth/+state/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import { AuthStore, AuthState } from './auth.store';
@Injectable({ providedIn: 'root' })
@CollectionConfig({ path: 'users' })
export class AuthService extends FireAuthService<AuthState> {

constructor(store: AuthStore) {
super(store);
}

createProfile(user, ctx) {
return {
email: user.email
email: user.email,
} as any;
}

Expand Down
1 change: 0 additions & 1 deletion src/app/auth/+state/auth.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ export class AuthStore extends Store<AuthState> {
super(initialState);
}
}

6 changes: 3 additions & 3 deletions src/app/auth/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { MatInputModule } from '@angular/material/input';
MatButtonModule,
MatFormFieldModule,
MatInputModule,
RouterModule
]
RouterModule,
],
})
export class AuthModule { }
export class AuthModule {}
34 changes: 23 additions & 11 deletions src/app/auth/signin/signin.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,45 @@ <h3 *ngIf="(profile$ | async)?.email as email">Welcome {{ email }}</h3>
</div>
</ng-container>
<ng-template #signinTemplate>
<button mat-raised-button color="primary" (click)="signin()">Signin with Google</button>
<button mat-raised-button color="primary" (click)="signin()">
Signin with Google
</button>
<div>
<h4><em>Signup</em> with email and password</h4>
<mat-form-field>
<mat-label>Email</mat-label>
<input matInput type="email" [formControl]="signupForm.get('email')">
<input matInput type="email" [formControl]="signupForm.get('email')" />
</mat-form-field>
<br>
<br />
<mat-form-field>
<mat-label>Password</mat-label>
<input matInput type="password" [formControl]="signupForm.get('password')">
<input
matInput
type="password"
[formControl]="signupForm.get('password')"
/>
</mat-form-field>
<br>
<br />
<button mat-raised-button (click)="signup()" color="accent">Signup</button>
</div>
<div>
<h4><em>Signin</em> with email and password</h4>
<mat-form-field>
<mat-label>Email</mat-label>
<input matInput type="email" [formControl]="signinForm.get('email')">
<input matInput type="email" [formControl]="signinForm.get('email')" />
</mat-form-field>
<br>
<br />
<mat-form-field>
<mat-label>Password</mat-label>
<input matInput type="password" [formControl]="signinForm.get('password')">
<input
matInput
type="password"
[formControl]="signinForm.get('password')"
/>
</mat-form-field>
<br>
<button mat-raised-button (click)="signupWithEmail()" color="accent">Signin</button>
<br />
<button mat-raised-button (click)="signupWithEmail()" color="accent">
Signin
</button>
</div>
</ng-template>
</ng-template>
35 changes: 22 additions & 13 deletions src/app/auth/signin/signin.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,27 @@ import { map } from 'rxjs/operators';
@Component({
selector: 'auth-signin',
templateUrl: './signin.component.html',
styleUrls: ['./signin.component.scss']
styleUrls: ['./signin.component.scss'],
})
export class SigninComponent implements OnInit, OnDestroy {

private sub: Subscription;
public profile$: Observable<Profile>;

signupForm = new FormGroup({
email: new FormControl(),
password: new FormControl()
password: new FormControl(),
});

signinForm = new FormGroup({
email: new FormControl(),
password: new FormControl()
password: new FormControl(),
});

isLoggedIn = this.query.select('profile').pipe(map(value => !!value?.email));
isLoggedIn = this.query
.select('profile')
.pipe(map((value) => !!value?.email));

constructor(
private service: AuthService,
private query: AuthQuery
) { }
constructor(private service: AuthService, private query: AuthQuery) {}

ngOnInit() {
this.sub = this.service.sync().subscribe();
Expand All @@ -45,13 +43,24 @@ export class SigninComponent implements OnInit, OnDestroy {
}

signupWithEmail() {
this.service.signin(this.signinForm.get('email').value, this.signinForm.get('password').value);
this.service.signin(
this.signinForm.get('email').value,
this.signinForm.get('password').value
);
}

signup() {
this.service.signup(this.signupForm.get('email').value, this.signupForm.get('password').value).then(() => {
this.service.signin(this.signupForm.get('email').value, this.signupForm.get('password').value);
});
this.service
.signup(
this.signupForm.get('email').value,
this.signupForm.get('password').value
)
.then(() => {
this.service.signin(
this.signupForm.get('email').value,
this.signupForm.get('password').value
);
});
}

signout() {
Expand Down
2 changes: 0 additions & 2 deletions src/app/collection-group/+state/company.query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { CompanyStore, CompanyState } from './company.store';

@Injectable({ providedIn: 'root' })
export class CompanyQuery extends QueryEntity<CompanyState> {

constructor(protected store: CompanyStore) {
super(store);
}

}
1 change: 0 additions & 1 deletion src/app/collection-group/+state/company.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ export class CompanyService extends CollectionGroupService<CompanyState> {
constructor(store: CompanyStore) {
super(store);
}

}
14 changes: 9 additions & 5 deletions src/app/collection-group/+state/company.store.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { Injectable } from '@angular/core';
import { EntityState, ActiveState, EntityStore, StoreConfig } from '@datorama/akita';
import {
EntityState,
ActiveState,
EntityStore,
StoreConfig,
} from '@datorama/akita';
import { Stakeholder } from 'src/app/subcollection/+state';

export interface CompanyState extends EntityState<Stakeholder, string>, ActiveState<string> {}
export interface CompanyState
extends EntityState<Stakeholder, string>,
ActiveState<string> {}

@Injectable({ providedIn: 'root' })
@StoreConfig({ name: 'company' })
export class CompanyStore extends EntityStore<CompanyState> {

constructor() {
super();
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ import { Stakeholder } from 'src/app/subcollection/+state';
@Component({
selector: 'company-list',
templateUrl: './company-list.component.html',
styleUrls: ['./company-list.component.css']
styleUrls: ['./company-list.component.css'],
})
export class CompanyListComponent implements OnInit, OnDestroy {

private sub: Subscription;
companies$: Observable<Stakeholder[]>;

constructor(
private service: CompanyService,
private query: CompanyQuery
) { }
constructor(private service: CompanyService, private query: CompanyQuery) {}

ngOnInit() {
this.sub = this.service.syncCollection().subscribe();
Expand Down
8 changes: 4 additions & 4 deletions src/app/collection-group/company.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { MatListModule } from '@angular/material/list';
MatListModule,
RouterModule.forChild([
{ path: '', redirectTo: 'list', pathMatch: 'full' },
{ path: 'list', component: CompanyListComponent }
])
]
{ path: 'list', component: CompanyListComponent },
]),
],
})
export class CompanyModule { }
export class CompanyModule {}
2 changes: 1 addition & 1 deletion src/app/collection/+state/movie.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export function createMovie(params: Partial<Movie>) {
id: '',
title: '',
description: '',
...params
...params,
} as Movie;
}
2 changes: 0 additions & 2 deletions src/app/collection/+state/movie.query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { MovieStore, MovieState } from './movie.store';

@Injectable({ providedIn: 'root' })
export class MovieQuery extends QueryEntity<MovieState> {

constructor(protected store: MovieStore) {
super(store);
}

}
Loading

0 comments on commit c846b74

Please sign in to comment.