Skip to content

Commit 628069c

Browse files
committed
[DSC-2434] Replace third-party ui-switch with switch component
1 parent 5d9f535 commit 628069c

4 files changed

Lines changed: 25 additions & 8 deletions

File tree

src/app/accessibility/accessibility-settings.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('accessibilitySettingsService', () => {
3131
let cookieService: CookieServiceMock;
3232
let authService: AuthServiceStub;
3333
let ePersonService: EPersonDataService;
34-
let klaroService: KlaroServiceStub;
34+
let klaroService: any;
3535
let appConfig: AppConfig;
3636

3737
beforeEach(() => {

src/app/info/accessibility-settings/accessibility-settings.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ <h2>{{ 'info.accessibility-settings.title' | translate }}</h2>
88
</label>
99

1010
<div class="col-sm-4">
11-
<ui-switch [id]="'disableNotificationTimeOutInput'"
12-
[(ngModel)]="formValues.notificationTimeOutEnabled"
13-
[ngModelOptions]="{ standalone: true }"
14-
></ui-switch>
11+
<ds-switch
12+
[options]="switchOptions"
13+
[(selectedValue)]="formValues.notificationTimeOutEnabled">
14+
</ds-switch>
1515
</div>
1616

1717
<div *dsContextHelp="{

src/app/info/accessibility-settings/accessibility-settings.component.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
TranslateModule,
1111
TranslateService,
1212
} from '@ngx-translate/core';
13-
import { UiSwitchModule } from 'ngx-ui-switch';
1413
import {
1514
BehaviorSubject,
1615
Subscription,
@@ -20,7 +19,6 @@ import {
2019
distinctUntilChanged,
2120
map,
2221
} from 'rxjs/operators';
23-
import { AlertType } from 'src/app/shared/alert/alert-type';
2422

2523
import {
2624
AccessibilitySetting,
@@ -29,13 +27,19 @@ import {
2927
} from '../../accessibility/accessibility-settings.service';
3028
import { AuthService } from '../../core/auth/auth.service';
3129
import { AlertComponent } from '../../shared/alert/alert.component';
30+
import { AlertType } from '../../shared/alert/alert-type';
3231
import { ContextHelpDirective } from '../../shared/context-help.directive';
3332
import { KlaroService } from '../../shared/cookies/klaro.service';
3433
import {
3534
hasValue,
3635
isEmpty,
3736
} from '../../shared/empty.util';
3837
import { NotificationsService } from '../../shared/notifications/notifications.service';
38+
import {
39+
SwitchColor,
40+
SwitchComponent,
41+
SwitchOption,
42+
} from '../../shared/switch/switch.component';
3943

4044
/**
4145
* Component providing the form where users can update accessibility settings.
@@ -47,9 +51,9 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
4751
CommonModule,
4852
TranslateModule,
4953
FormsModule,
50-
UiSwitchModule,
5154
ContextHelpDirective,
5255
AlertComponent,
56+
SwitchComponent,
5357
],
5458
standalone: true,
5559
})
@@ -62,6 +66,15 @@ export class AccessibilitySettingsComponent implements OnInit, OnDestroy {
6266
isAuthenticated: BehaviorSubject<boolean> = new BehaviorSubject(false);
6367
cookieIsAccepted: BehaviorSubject<boolean> = new BehaviorSubject(false);
6468

69+
/**
70+
* The custom options for the 'ds-switch' component
71+
*/
72+
switchOptions: SwitchOption[] = [
73+
{ value: true, labelColor: SwitchColor.Success, backgroundColor: SwitchColor.Success ,
74+
label: 'info.accessibility-settings.notificationTimeOutEnabled.label.enabled' },
75+
{ value: false, label: 'info.accessibility-settings.notificationTimeOutEnabled.label.disabled' },
76+
];
77+
6578
private subscriptions: Subscription[] = [];
6679

6780
constructor(

src/assets/i18n/en.json5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2957,6 +2957,10 @@
29572957

29582958
"info.accessibility-settings.liveRegionTimeOut.invalid": "Live region time out must be greater than 0",
29592959

2960+
"info.accessibility-settings.notificationTimeOutEnabled.label.disabled": "Disabled",
2961+
2962+
"info.accessibility-settings.notificationTimeOutEnabled.label.enabled": "Enabled",
2963+
29602964
"info.accessibility-settings.notificationTimeOut.label": "Notification time out (in seconds)",
29612965

29622966
"info.accessibility-settings.notificationTimeOut.hint": "The duration after which a notification disappears.",

0 commit comments

Comments
 (0)