Fix some styles and initial routing (again)

This commit is contained in:
William Brawner 2020-10-07 00:03:38 +00:00
parent ff18e47036
commit 2c48722dec
2 changed files with 20 additions and 6 deletions

View file

@ -33,15 +33,19 @@ export class AppComponent {
private updates: SwUpdate, private updates: SwUpdate,
private changeDetector: ChangeDetectorRef, private changeDetector: ChangeDetectorRef,
) { ) {
const unauthenticatedRoutes = [
'/',
'/login',
'/register'
]
if (this.cookieService.check('Authorization')) { if (this.cookieService.check('Authorization')) {
this.twigsService.getProfile().subscribe(user => { this.twigsService.getProfile().subscribe(user => {
this.user.next(user); this.user.next(user);
if (this.activatedRoute.snapshot.url.length == 0) { if (this.router.url == '/') {
this.router.navigateByUrl("/budgets"); this.router.navigateByUrl("/budgets");
} }
}); });
} else if (this.activatedRoute.snapshot.url.length > 0) { } else if (unauthenticatedRoutes.indexOf(this.router.url) == -1) {
console.log(this.activatedRoute.snapshot.url)
this.router.navigateByUrl("/login"); this.router.navigateByUrl("/login");
} }

View file

@ -3,7 +3,7 @@
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: center; justify-content: center;
padding: 1em; padding: 0 1em;
} }
.dashboard>mat-card { .dashboard>mat-card {
@ -73,14 +73,24 @@ a.view-all {
@media (min-width: 1160px) { @media (min-width: 1160px) {
mat-card { mat-card {
box-sizing: border-box; box-sizing: border-box;
height: 386px;
} }
app-category-list { .category-info {
height: 313px;
overflow: auto; overflow: auto;
} }
} }
@media (max-width: 610px) {
.dashboard {
padding: 0;
}
.dashboard>mat-card {
margin: 1em auto;
}
}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
.dashboard { .dashboard {
color: #F1F1F1; color: #F1F1F1;