Skip to content

Commit b53a2df

Browse files
author
Salma Alam-Naylor
committed
Fix route guard with same logic as schematic and make sure base note is always selected when necessary
1 parent 6b4b65e commit b53a2df

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

apps/fretonator-web/src/app/common/chips/chip/chip.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class ChipComponent implements DoCheck {
1818
@Input() mode: Mode;
1919
@Input() selectedColor: SelectedColor = SelectedColor.default;
2020
@Input() rounded = false;
21+
@Input() isBaseNote = false;
2122
SelectedColor = SelectedColor;
2223
selected = false;
2324

@@ -33,6 +34,8 @@ export class ChipComponent implements DoCheck {
3334

3435
if (data.note !== this.note) {
3536
return false;
37+
} else if (data.note === this.note && this.isBaseNote) {
38+
return true;
3639
}
3740

3841
if (data.noteExtender !== this.noteExtender) {

apps/fretonator-web/src/app/common/is-valid-mode-configuration/is-valid-mode-configuration.guard.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ export class IsValidModeConfigurationGuard implements CanActivate {
1818
return home;
1919
}
2020

21-
if(!NoteSymbol[note + NoteExtenderSymbol[noteExtender]]) {
21+
const extenderSymbol = NoteExtenderSymbol[noteExtender];
22+
const validCombination = Object.values(NoteSymbol).find(value => value === `${note}${extenderSymbol}`)
23+
24+
if(!validCombination) {
2225
return home;
2326
}
2427

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ <h2 class="modeSelector__label">Starting note</h2>
3434
<app-chips>
3535
<app-chip *ngFor="let thisNote of octave"
3636
[note]="thisNote"
37-
[noteExtender]="noteExtenderString"
37+
[noteExtender]="'natural'"
3838
[mode]="mode"
39+
[isBaseNote]="true"
3940
rounded="true"
4041
selectedColor="default">{{thisNote | titlecase}}</app-chip>
4142
</app-chips>

0 commit comments

Comments
 (0)