Skip to content

Commit 35e331b

Browse files
1. Made 'learn' configuration an enum
2. Fixed button borders on fretboard config
1 parent 360f639 commit 35e331b

File tree

8 files changed

+25
-26
lines changed

8 files changed

+25
-26
lines changed

apps/fretonator-web/src/app/common/fretonator/fretboard-config/fretboard-config.component.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
border-color: var(--fretboard-toggle-button-border-color);
2525
border-radius: 0;
2626
padding: pxToRem($grid-unit * 1.5);
27+
border-right-width: 0;
2728
}
2829

2930
.fretboard__toggleButton--active {
@@ -41,4 +42,5 @@
4142
border-top-right-radius: var(--border-radius-chip);
4243
border-bottom-right-radius: var(--border-radius-chip);
4344
border-left-width: calc(var(--border-width-button) / 2);
45+
border-right-width: var(--border-width-button);
4446
}

apps/fretonator-web/src/app/common/fretonator/fretboard/fretboard.component.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<ng-container *ngFor="let fret of frets">
1616
<div
1717
class="fretboard__cell"
18-
[class.learn__theme]="configuration === 'learn'"
18+
[class.learn__theme]="configuration === FretboardConfigurations.learn"
1919
[class.fretboard__cell--string]="fret === 0"
2020
[class.fretboard__cell--selected]="fretMap | getFretFromFretMap: string.name:fret:stringNamesAreCaseSensitive"
2121
[attr.data-string-name]="fret === 0 ? string.name : null"
@@ -42,7 +42,7 @@
4242
</div>
4343

4444
<div class="controlPanel">
45-
<div class="controlPanel__row" *ngIf="configuration !== 'learn'">
45+
<div class="controlPanel__row" *ngIf="configuration !== FretboardConfigurations.learn">
4646
<div class="controlPanel__section">
4747
<h4 class="controlPanel__title">Highlight scale degrees</h4>
4848
<app-scale-degrees
@@ -79,23 +79,21 @@ <h4 class="controlPanel__title">Fretboard</h4>
7979
></app-fretboard-config>
8080
</div>
8181

82-
<div class="controlPanel__column" *ngIf="configuration !== 'learn'">
82+
<div class="controlPanel__column" *ngIf="configuration !== FretboardConfigurations.learn">
8383
<h4 class="controlPanel__title">Guitar tuning</h4>
8484
<div class="fretboard__tuningGroup">
8585
<button class="fretboard__changeTuning"
86-
[class.tuning--active]="tuning === Tunings.standard"
86+
[class.fretboard__changeTuning--active]="tuning === Tunings.standard"
8787
(click)="setTuning(Tunings.standard)">Standard
8888
</button>
8989
<button class="fretboard__changeTuning"
90-
[class.tuning--active]="tuning === Tunings.dropd"
90+
[class.fretboard__changeTuning--active]="tuning === Tunings.dropd"
9191
(click)="setTuning(Tunings.dropd)">Drop D
9292
</button>
9393
<button class="fretboard__changeTuning"
94-
[class.tuning--active]="tuning === Tunings.dadgad"
94+
[class.fretboard__changeTuning--active]="tuning === Tunings.dadgad"
9595
(click)="setTuning(Tunings.dadgad)">DADGAD
9696
</button>
9797
</div>
9898
</div>
9999
</div>
100-
101-

apps/fretonator-web/src/app/common/fretonator/fretboard/fretboard.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ $note-height: 36;
556556
border-color: var(--fretboard-toggle-button-border-color);
557557
}
558558

559-
.tuning--active {
559+
.fretboard__changeTuning--active {
560560
background-color: var(--chip-background-color-active);
561561
color: var(--chip-foreground-color-active);
562562
border-color: var(--chip-border-color-active);

apps/fretonator-web/src/app/common/fretonator/fretboard/fretboard.component.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
1-
import {
2-
ChangeDetectorRef,
3-
Component,
4-
ElementRef,
5-
EventEmitter,
6-
Input,
7-
OnChanges,
8-
OnInit,
9-
Output,
10-
ViewChild
11-
} from '@angular/core';
1+
import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core';
122
import { FretMap, Mode } from '../../../util/types';
133
import { NotePlaybackService } from '../../playback/note-playback.service';
144
import { AbstractDataService } from '../../abstract-data/abstract-data.service';
155
import { ScaleDegrees } from '../../../util/constants';
16-
import { BehaviorSubject, Subject } from 'rxjs';
17-
import { map } from 'rxjs/operators';
6+
7+
export enum FretboardConfigurations {
8+
learn = 'learn'
9+
}
1810

1911
export enum FretModes {
2012
twelve = 'twelve',
@@ -108,7 +100,7 @@ export class FretboardComponent implements OnChanges, OnInit {
108100
this.loadPropFromStorage(StorageKeys.orientation, 'orientation', Orientations.right);
109101
this.loadPropFromStorage(StorageKeys.noteNameDisplay, 'noteNameDisplay', NoteDisplays.noteNames);
110102

111-
if (this.configuration !== 'learn') {
103+
if (this.configuration !== FretboardConfigurations.learn) {
112104
this.loadPropFromStorage(StorageKeys.tuning, 'tuning', Tunings.standard);
113105
}
114106

@@ -123,6 +115,10 @@ export class FretboardComponent implements OnChanges, OnInit {
123115
}
124116
}
125117

118+
get FretboardConfigurations() {
119+
return FretboardConfigurations;
120+
}
121+
126122
get FretModes() {
127123
return FretModes;
128124
}

apps/fretonator-web/src/app/common/svgs/chevron-right/chevron-right.module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { CommonModule } from '@angular/common';
33
import { ChevronRightComponent } from './chevron-right.component';
44

55

6-
76
@NgModule({
87
declarations: [ChevronRightComponent],
98
exports: [

apps/fretonator-web/src/app/pages/home/home-index/home-index.component.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
22
import { HomeIndexComponent } from './home-index.component';
33
import { Component } from '@angular/core';
44
import { HomeModule } from '../home.module';
5-
import { By } from '@angular/platform-browser';
65
import { BrowserTestingModule } from '@angular/platform-browser/testing';
76
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
87
import { RouterTestingModule } from '@angular/router/testing';

apps/fretonator-web/src/app/pages/learn/patterns-index/patterns-index.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ <h5 class="patterns__smallTitle">Choose a pattern</h5>
3636

3737
<div class="fretboard__container">
3838
<app-fretboard
39-
[configuration]="'learn'"
39+
[configuration]="FretboardConfigurations.learn"
4040
[fretMap]="selectedFretMap"
4141
[stringNamesAreCaseSensitive]="true"
4242
[(loadExpanded)]="shouldExpand"></app-fretboard>

apps/fretonator-web/src/app/pages/learn/patterns-index/patterns-index.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
22
import { PatternFretMaps, PatternModeSelectors } from '../../../util/constants';
33
import { Mode } from '../../../util/types';
44
import { MetaService } from '../../../common/meta/meta.service';
5+
import { FretboardConfigurations } from '../../../common/fretonator/fretboard/fretboard.component';
56

67
@Component({
78
selector: 'app-patterns-index',
@@ -29,6 +30,10 @@ export class PatternsIndexComponent implements OnInit {
2930
this.metaService.updateAllGenericMeta(this.pageUrl, this.pageTitle, this.pageDescription);
3031
}
3132

33+
get FretboardConfigurations() {
34+
return FretboardConfigurations;
35+
}
36+
3237
setPattern(mode: Mode) {
3338
this.selectedMode = mode;
3439
this.selectedFretMap = PatternFretMaps[mode];

0 commit comments

Comments
 (0)