mcgilman commented on code in PR #9076:
URL: https://github.com/apache/nifi/pull/9076#discussion_r1676358897
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/app.module.ts:
##########
@@ -51,6 +55,14 @@ import { loadingInterceptor } from
'./service/interceptors/loading.interceptor';
import { LoginConfigurationEffects } from
'./state/login-configuration/login-configuration.effects';
import { BannerTextEffects } from './state/banner-text/banner-text.effects';
+const entry = localStorage.getItem('disable-animations');
+let disableAnimations: string = entry !== null ? JSON.parse(entry).item : '';
+
+// honor OS settings if user has not explicitly disabled animations for the
application
+if (disableAnimations !== 'true' && disableAnimations !== 'false') {
+ disableAnimations = window.matchMedia('(prefers-reduced-motion:
reduce)').matches.toString();
Review Comment:
In the navigation component, we ensure that `matchMedia` is available
because attempting to use it. Is that check necessary here?
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/navigation/navigation.component.ts:
##########
@@ -154,4 +156,10 @@ export class Navigation implements OnInit, OnDestroy {
this.storage.setItem('theme', theme);
this.themingService.toggleTheme(!!this.darkModeOn, theme);
}
+
+ toggleAnimations(disableAnimations: string = '') {
+ this.disableAnimations = disableAnimations;
+ this.storage.setItem('disable-animations',
this.disableAnimations?.toString());
Review Comment:
With the `disableAnimations` parameter defaulting to empty string, I don't
think the optional chaining is needed here.
##########
nifi-frontend/src/main/frontend/apps/nifi-jolt-transform-ui/src/app/app.module.ts:
##########
@@ -30,6 +34,14 @@ import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from
'@angular/material/form-field';
import { EffectsModule } from '@ngrx/effects';
import { JoltTransformJsonUiEffects } from
'./pages/jolt-transform-json-ui/state/jolt-transform-json-ui/jolt-transform-json-ui.effects';
+const entry = localStorage.getItem('disable-animations');
+let disableAnimations: string = entry !== null ? JSON.parse(entry).item : '';
+
+// honor OS settings if user has not explicitly disabled animations for the
application
+if (disableAnimations !== 'true' && disableAnimations !== 'false') {
+ disableAnimations = window.matchMedia('(prefers-reduced-motion:
reduce)').matches.toString();
Review Comment:
Same question here about whether we should protect the call to `matchMedia`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]