Skip to content

Commit f49908d

Browse files
388235982: (fix) setting and callout fixes (#1070)
1 parent 04507c7 commit f49908d

2 files changed

Lines changed: 45 additions & 6 deletions

File tree

modules/ui/src/app/components/callout/callout.component.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,16 @@
8787
}
8888

8989
.callout-action-container {
90+
display: flex;
9091
margin-left: auto;
9192
}
9293

94+
@media (max-width: 800px) {
95+
.callout-action-container {
96+
flex-direction: column;
97+
}
98+
}
99+
93100
.callout-action {
94101
color: inherit;
95102
padding: 10px 16px;

modules/ui/src/app/pages/settings/settings.component.ts

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,23 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
16+
import {
17+
ChangeDetectionStrategy,
18+
Component,
19+
OnDestroy,
20+
OnInit,
21+
} from '@angular/core';
1722
import { MatToolbarModule } from '@angular/material/toolbar';
1823
import { CommonModule } from '@angular/common';
1924
import { MatTabChangeEvent, MatTabsModule } from '@angular/material/tabs';
20-
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
25+
import {
26+
ActivatedRoute,
27+
NavigationEnd,
28+
Router,
29+
RouterModule,
30+
} from '@angular/router';
2131
import { Routes } from '../../model/routes';
32+
import { filter, Subject, takeUntil } from 'rxjs';
2233

2334
@Component({
2435
selector: 'app-settings',
@@ -27,8 +38,9 @@ import { Routes } from '../../model/routes';
2738
styleUrls: ['./settings.component.scss'],
2839
changeDetection: ChangeDetectionStrategy.OnPush,
2940
})
30-
export class SettingsComponent implements OnInit {
41+
export class SettingsComponent implements OnInit, OnDestroy {
3142
private routes = [Routes.General, Routes.Certificates];
43+
private destroy$: Subject<boolean> = new Subject<boolean>();
3244
selectedIndex = 0;
3345
constructor(
3446
private router: Router,
@@ -37,13 +49,33 @@ export class SettingsComponent implements OnInit {
3749

3850
ngOnInit(): void {
3951
const currentRoute = this.router.url;
40-
this.selectedIndex = this.routes.findIndex(route =>
41-
currentRoute.includes(route)
42-
);
52+
this.setSelectedIndex(currentRoute);
53+
54+
this.router.events
55+
.pipe(
56+
takeUntil(this.destroy$),
57+
filter(event => event instanceof NavigationEnd)
58+
)
59+
.subscribe(event => {
60+
if (event.url !== currentRoute) {
61+
this.setSelectedIndex(event.url);
62+
}
63+
});
4364
}
4465

4566
onTabChange(event: MatTabChangeEvent): void {
4667
const index = event.index;
4768
this.router.navigate([this.routes[index]], { relativeTo: this.route });
4869
}
70+
71+
private setSelectedIndex(currentRoute: string): void {
72+
this.selectedIndex = this.routes.findIndex(route =>
73+
currentRoute.includes(route)
74+
);
75+
}
76+
77+
ngOnDestroy() {
78+
this.destroy$.next(true);
79+
this.destroy$.unsubscribe();
80+
}
4981
}

0 commit comments

Comments
 (0)