Skip to content

Commit

Permalink
feat(settings): Toggle to disable animations completely (#611)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmeku authored Mar 29, 2019
1 parent d04ab01 commit 56afb95
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 52 deletions.
7 changes: 6 additions & 1 deletion apps/angular-console/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<div fxLayout="column" fxFlex class="content-container">
<div
fxLayout="column"
fxFlex
class="content-container"
[@.disabled]="settings.useDisableAnimations()"
>
<ui-contextual-action-bar></ui-contextual-action-bar>

<div
Expand Down
2 changes: 1 addition & 1 deletion apps/angular-console/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class AppComponent implements OnInit, OnDestroy {
}

constructor(
settings: Settings,
readonly settings: Settings,
private readonly contextualActionBarService: ContextualActionBarService,
private readonly titleService: Title,
router: Router
Expand Down
2 changes: 1 addition & 1 deletion apps/electron/src/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angular-console",
"description": "Angular Console",
"version": "7.4.3",
"version": "7.4.6",
"author": {
"name": "Narwhal Technologies Inc",
"email": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion apps/vscode/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "angular-console",
"displayName": "Angular Console",
"description": "Angular Console for Visual Studio Code. The user interface app for the Angular CLI",
"version": "7.4.3",
"version": "7.4.6",
"repository": {
"type": "git",
"url": "https://github.com/nrwl/angular-console"
Expand Down
30 changes: 21 additions & 9 deletions libs/feature-settings/src/lib/settings/settings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h4 mat-line>Send anonymous usage data</h4>
</div>
<mat-slide-toggle
(change)="toggleDataCollection($event.checked)"
[checked]="canCollectionData()"
[checked]="settings.canCollectData()"
></mat-slide-toggle>
</div>
<div fxLayout="row wrap" fxFill fxLayoutAlign="start top">
Expand All @@ -25,8 +25,8 @@ <h4 mat-line>Auto Update Channel</h4>

<mat-form-field appearance="outline" floatLabel="auto">
<mat-select
(selectionChange)="setChannel($event.value)"
[value]="getChannel()"
(selectionChange)="settings.setChannel($event.value)"
[value]="settings.getChannel()"
>
<mat-option value="latest"> Latest </mat-option>
<mat-option value="beta">Beta </mat-option>
Expand All @@ -36,6 +36,18 @@ <h4 mat-line>Auto Update Channel</h4>
</div>

<h3>Features</h3>
<div fxLayout="row wrap" fxFill fxLayoutAlign="start center">
<div fxFlex>
<h4 mat-line>Disable Animations</h4>
<p mat-line>
Disable all animations for a snappier feel
</p>
</div>
<mat-slide-toggle
(change)="settings.setDisableAnimations($event.checked)"
[checked]="settings.useDisableAnimations()"
></mat-slide-toggle>
</div>
<div fxLayout="row wrap" fxFill fxLayoutAlign="start center">
<div fxFlex>
<h4 mat-line>Use detailed status</h4>
Expand All @@ -44,8 +56,8 @@ <h4 mat-line>Use detailed status</h4>
</p>
</div>
<mat-slide-toggle
(change)="toggleDetailedStatus($event.checked)"
[checked]="enableDetailedStatus()"
(change)="settings.setEnableDetailedStatus($event.checked)"
[checked]="settings.enableDetailedStatus()"
></mat-slide-toggle>
</div>
<div fxLayout="row wrap" fxFill fxLayoutAlign="start center">
Expand All @@ -56,8 +68,8 @@ <h4 mat-line>Use WSL (Windows users only)</h4>
</p>
</div>
<mat-slide-toggle
(change)="toggleIsWsl($event.checked)"
[checked]="isWsl()"
(change)="settings.setIsWsl($event.checked)"
[checked]="settings.isWsl()"
></mat-slide-toggle>
</div>
<div fxLayout="row wrap" fxFill fxLayoutAlign="start center">
Expand All @@ -68,8 +80,8 @@ <h4 mat-line>Use NVM (Supports OS X, Linux and WSL)</h4>
</p>
</div>
<mat-slide-toggle
(change)="toggleUseNvm($event.checked)"
[checked]="useNvm()"
(change)="settings.setUseNvm($event.checked)"
[checked]="settings.useNvm()"
></mat-slide-toggle>
</div>
</div>
Expand Down
40 changes: 2 additions & 38 deletions libs/feature-settings/src/lib/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,12 @@ import { ChangeDetectionStrategy, Component, Inject } from '@angular/core';
})
export class SettingsComponent {
constructor(
private readonly settingsService: Settings,
readonly settings: Settings,
@Inject('telemetry') private readonly telemetry: Telemetry
) {}

canCollectionData() {
return this.settingsService.canCollectData();
}

toggleDataCollection(x: boolean) {
this.settingsService.setCanCollectData(x);
this.settings.setCanCollectData(x);
this.telemetry.reportDataCollectionEvent(x);
}

enableDetailedStatus() {
return this.settingsService.enableDetailedStatus();
}

toggleDetailedStatus(x: boolean) {
this.settingsService.setEnableDetailedStatus(x);
}

setChannel(channel: 'latest' | 'beta' | 'alpha') {
this.settingsService.setChannel(channel);
}

getChannel() {
return this.settingsService.getChannel();
}

isWsl() {
return this.settingsService.isWsl();
}

useNvm() {
return this.settingsService.useNvm();
}

toggleUseNvm(x: boolean) {
this.settingsService.setUseNvm(x);
}

toggleIsWsl(x: boolean) {
this.settingsService.setIsWsl(x);
}
}
13 changes: 13 additions & 0 deletions libs/schema/src/lib/generated/graphql-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export interface Settings {

isConnectUser?: Maybe<boolean>;

disableAnimations?: Maybe<boolean>;

showSupportPlugin?: Maybe<boolean>;

installNodeManually?: Maybe<boolean>;
Expand Down Expand Up @@ -665,6 +667,12 @@ export namespace SettingsResolvers {

isConnectUser?: IsConnectUserResolver<Maybe<boolean>, TypeParent, Context>;

disableAnimations?: DisableAnimationsResolver<
Maybe<boolean>,
TypeParent,
Context
>;

showSupportPlugin?: ShowSupportPluginResolver<
Maybe<boolean>,
TypeParent,
Expand Down Expand Up @@ -714,6 +722,11 @@ export namespace SettingsResolvers {
Parent = any,
Context = any
> = Resolver<R, Parent, Context>;
export type DisableAnimationsResolver<
R = Maybe<boolean>,
Parent = any,
Context = any
> = Resolver<R, Parent, Context>;
export type ShowSupportPluginResolver<
R = Maybe<boolean>,
Parent = any,
Expand Down
1 change: 1 addition & 0 deletions libs/server/src/assets/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ type WorkspaceDefinition {
type Settings {
canCollectData: Boolean!
isConnectUser: Boolean
disableAnimations: Boolean
showSupportPlugin: Boolean
installNodeManually: Boolean
enableDetailedStatus: Boolean
Expand Down
1 change: 1 addition & 0 deletions libs/utils/src/lib/graphql/settings.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ query Settings {
installNodeManually
enableDetailedStatus
channel
disableAnimations
isConnectUser
recent {
path
Expand Down
9 changes: 9 additions & 0 deletions libs/utils/src/lib/settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class Settings {
enableDetailedStatus: true,
isConnectUser: false,
channel: 'latest',
disableAnimations: true,
isWsl: false,
useNvm: false
};
Expand Down Expand Up @@ -108,6 +109,14 @@ export class Settings {
return this.settings.channel;
}

setDisableAnimations(disableAnimations: boolean): void {
this.store({ ...this.settings, disableAnimations });
}

useDisableAnimations() {
return this.settings.disableAnimations;
}

showConnectPlugin(): boolean {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-console",
"version": "7.4.3",
"version": "7.4.6",
"private": true,
"publisher": "nrwl",
"author": {
Expand Down

0 comments on commit 56afb95

Please sign in to comment.