Skip to content

Commit

Permalink
refactor(builder): improve user experience
Browse files Browse the repository at this point in the history
The user experience of the builder was absolutely abysmal, this commit aims to improve the UI of the rotation builder.

Implements #7
  • Loading branch information
SargoDarya committed Aug 23, 2021
1 parent 448e917 commit 771d8f2
Show file tree
Hide file tree
Showing 27 changed files with 691 additions and 285 deletions.
124 changes: 111 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
"@angular/compiler": "~12.1.0-",
"@angular/core": "~12.1.0-",
"@angular/forms": "~12.1.0-",
"@angular/material": "^12.1.0-",
"@angular/platform-browser": "~12.1.0-",
"@angular/platform-browser-dynamic": "~12.1.0-",
"@angular/router": "~12.1.0-",
"@fortawesome/angular-fontawesome": "^0.9.0",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"rxjs": "~6.6.0",
"tslib": "^2.2.0",
"zone.js": "~0.11.4"
Expand Down
11 changes: 10 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import {AppRoutingModule} from "./app-routing.module";
import {HttpClientModule} from "@angular/common/http";
import {communicationLayerServiceProvider} from "./modules/act/services/communication-layer.service.provider";
import {ReactiveFormsModule} from "@angular/forms";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {OverlayModule} from "@angular/cdk/overlay";
import {MAT_TOOLTIP_DEFAULT_OPTIONS, MatTooltipDefaultOptions, MatTooltipModule} from "@angular/material/tooltip";
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';

@NgModule({
declarations: [
Expand All @@ -15,9 +19,14 @@ import {ReactiveFormsModule} from "@angular/forms";
HttpClientModule,
AppRoutingModule,
ReactiveFormsModule,
BrowserAnimationsModule,
OverlayModule,
MatTooltipModule,
FontAwesomeModule
],
providers: [
communicationLayerServiceProvider
communicationLayerServiceProvider,
{provide: MAT_TOOLTIP_DEFAULT_OPTIONS, useValue: <MatTooltipDefaultOptions>{position: "above"}}
],
bootstrap: [AppComponent]
})
Expand Down
16 changes: 16 additions & 0 deletions src/app/core/services/rotation.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';

import { RotationService } from './rotation.service';

describe('RotationService', () => {
let service: RotationService;

beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(RotationService);
});

it('should be created', () => {
expect(service).toBeTruthy();
});
});
21 changes: 21 additions & 0 deletions src/app/core/services/rotation.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {Injectable} from '@angular/core';
import {Observable, ReplaySubject, Subject} from "rxjs";
import {Rotation} from "../../modules/api/interfaces/rotation";
import {ApiService} from "../../modules/api/services/api.service";
import {RotationCreate} from "../../modules/api/interfaces/rotation-create";

@Injectable({
providedIn: 'root'
})
export class RotationService {

public readonly activeRotation$: Subject<Rotation | null> = new ReplaySubject(1);

public constructor(private readonly apiService: ApiService) {
}

public saveRotation(rotation: RotationCreate): Observable<Rotation> {
return this.apiService.createRotation(rotation);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
[cdkDragData]="actionId"
cdkDragPreviewContainer="global"
[action]="actionId | actionById"
[showCooldowns]="showCooldowns"
[showComboIndicator]="showComboIndicator"
[displayRecastTime]="displayRecastTime"
[canShowCooldowns]="canShowCooldown"
[canShowComboIndicator]="canShowComboIndicator"
[canShowRecastTime]="displayRecastTime"
[canShowTooltip]="canShowTooltip"
[canShowCost]="canShowCost"
(cdkDragStarted)="disableTooltips()"
(cdkDragEnded)="enableTooltips()"
(click)="triggerAction()"></rh-action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ export class ActionSlotComponent implements OnChanges {
@Input() actionId?: number;
@Input() displayRecastTime = false;
@Input() keyBindingLabel?: string;
@Input() showCooldowns = false;
@Input() showComboIndicator = false;
@Input() canShowCooldown = false;
@Input() canShowComboIndicator = false;
@Input() canShowTooltip = true;
@Input() canShowCost = false;

@HostBinding('class.empty')
private isEmpty: boolean = false;
Expand All @@ -46,8 +48,6 @@ export class ActionSlotComponent implements OnChanges {
switchMap(() => of(false).pipe(delay(200), startWith(true)))
);

public isDraggingAction = false;

constructor(
private readonly keyBindingService: KeyBindingService,
private readonly hotbarService: HotbarService,
Expand Down
14 changes: 6 additions & 8 deletions src/app/modules/actions/components/action/action.component.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<rh-action-icon
*ngIf="action"
[action]="action">
</rh-action-icon>
<rh-action-icon [action]="action"></rh-action-icon>

<rh-cooldown-view
*ngIf="showCooldowns"
*ngIf="canShowCooldowns"
[action]="action"
[displayRecastTime]="displayRecastTime">
[displayRecastTime]="canShowRecastTime">
</rh-cooldown-view>
<div
class="rh-action__combo-indicator"
*ngIf="showComboIndicator && isComboAction">
*ngIf="canShowComboIndicator && isComboAction">
</div>
<div class="rh-action__action-cost" *ngIf="action && action.PrimaryCostValue">
<div class="rh-action__action-cost"
*ngIf="canShowCost && action.PrimaryCostValue">
{{ action.PrimaryCostValue }}
</div>

Expand Down
11 changes: 6 additions & 5 deletions src/app/modules/actions/components/action/action.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import {ActionTooltipComponent} from "../action-tooltip/action-tooltip.component
})
export class ActionComponent {
@Input() public action!: Action;
@Input() public showCooldowns = false;
@Input() public showComboIndicator = false;
@Input() public displayRecastTime = false;
@Input() public canShowCooldowns = false;
@Input() public canShowComboIndicator = false;
@Input() public canShowRecastTime = false;
@Input() public canShowCost = false;
@Input() public canShowTooltip = true;

public isComboAction = false;
Expand Down Expand Up @@ -63,8 +64,8 @@ export class ActionComponent {
}

@HostListener('mouseover')
public showTooltip() {
if (this.tooltipInstance) return;
private showTooltip() {
if (this.canShowTooltip && this.tooltipInstance) return;

this.tooltipInstance = createPopper(
this.elementRef.nativeElement,
Expand Down
Loading

0 comments on commit 771d8f2

Please sign in to comment.