generated from maximegris/angular-electron
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
338 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
export function loadJSON(json: any) {} | ||
import * as fs from 'fs-extra'; | ||
|
||
import { baseUrl } from '../helpers'; | ||
|
||
export function loadJSON(json: any) { | ||
const file = `${baseUrl}/resources/json/${json}.json`; | ||
|
||
if (!fs.existsSync(file)) { | ||
throw new Error(`Attempting to load invalid or absent JSON: ${json}`); | ||
} | ||
|
||
return fs.readJsonSync(file); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/app/shared/components/input-class/input-class.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="relative"> | ||
<ng-select class="form-control" [items]="values" [(ngModel)]="playerClass" placeholder="Select player class..." | ||
(change)="change.emit($event)"></ng-select> | ||
|
||
<app-input-floating-label>{{ label() }}</app-input-floating-label> | ||
</div> |
Empty file.
21 changes: 21 additions & 0 deletions
21
src/app/shared/components/input-class/input-class.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Component, input, model, output } from '@angular/core'; | ||
import { BaseClassType } from '../../../../interfaces'; | ||
|
||
@Component({ | ||
selector: 'app-input-class', | ||
templateUrl: './input-class.component.html', | ||
styleUrl: './input-class.component.scss', | ||
}) | ||
export class InputClassComponent { | ||
public playerClass = model.required<BaseClassType | undefined>(); | ||
public label = input<string>('Class'); | ||
public change = output<BaseClassType | undefined>(); | ||
|
||
public values: BaseClassType[] = [ | ||
'Mage', | ||
'Thief', | ||
'Healer', | ||
'Warrior', | ||
'Traveller', | ||
]; | ||
} |
2 changes: 1 addition & 1 deletion
2
src/app/shared/components/input-damageclass/input-damageclass.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<div class="relative"> | ||
<ng-select class="form-control" [items]="values" groupBy="category" [(ngModel)]="damageClass" | ||
placeholder="Select damage class..." (change)="change.emit($event.value)"></ng-select> | ||
placeholder="Select damage class..." (change)="change.emit($event?.value)"></ng-select> | ||
|
||
<app-input-floating-label>Damage Class</app-input-floating-label> | ||
</div> |
17 changes: 17 additions & 0 deletions
17
src/app/shared/components/input-effect/input-effect.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div class="relative"> | ||
<ng-select class="form-control" [items]="values()" [(ngModel)]="effect" placeholder="Select effect..." | ||
(change)="change.emit($event?.value)"> | ||
|
||
<ng-template ng-option-tmp let-item="item"> | ||
<div class="relative"> | ||
<div class="text-white"> | ||
{{ item.value }} | ||
</div> | ||
|
||
<p class="text-white text-sm italic">{{ item.desc }}</p> | ||
</div> | ||
</ng-template> | ||
</ng-select> | ||
|
||
<app-input-floating-label>{{ label() }}</app-input-floating-label> | ||
</div> |
Empty file.
41 changes: 41 additions & 0 deletions
41
src/app/shared/components/input-effect/input-effect.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { | ||
Component, | ||
computed, | ||
inject, | ||
input, | ||
model, | ||
output, | ||
} from '@angular/core'; | ||
import { ElectronService } from '../../../services/electron.service'; | ||
import { ModService } from '../../../services/mod.service'; | ||
|
||
@Component({ | ||
selector: 'app-input-effect', | ||
templateUrl: './input-effect.component.html', | ||
styleUrl: './input-effect.component.scss', | ||
}) | ||
export class InputEffectComponent { | ||
private electronService = inject(ElectronService); | ||
private modService = inject(ModService); | ||
|
||
public effect = model.required<string>(); | ||
public label = input<string>('Effect'); | ||
public change = output<string>(); | ||
|
||
public values = computed(() => { | ||
const effectObj = this.modService.json()['effect-data'] as Record< | ||
string, | ||
any | ||
>; | ||
return Object.keys(effectObj ?? {}) | ||
.sort() | ||
.map((t) => ({ | ||
value: t, | ||
desc: effectObj[t].tooltip?.desc ?? 'No description', | ||
})); | ||
}); | ||
|
||
constructor() { | ||
this.electronService.requestJSON('effect-data'); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/app/shared/components/input-itemclass/input-itemclass.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<div class="relative"> | ||
<ng-select class="form-control" [clearable]="false" [items]="values" bindLabel="value" bindValue="value" | ||
groupBy="category" [(ngModel)]="itemClass" placeholder="Select item type..." | ||
(change)="change.emit($event.value)"></ng-select> | ||
(change)="change.emit($event?.value)"></ng-select> | ||
|
||
<app-input-floating-label>{{ label() }}</app-input-floating-label> | ||
</div> |
3 changes: 2 additions & 1 deletion
3
src/app/shared/components/input-skill/input-skill.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<div class="relative"> | ||
<ng-select class="form-control" [items]="values" [(ngModel)]="skill" placeholder="Select skill..."></ng-select> | ||
<ng-select class="form-control" [items]="values" [(ngModel)]="skill" placeholder="Select skill..." | ||
(change)="change.emit($event?.value)"></ng-select> | ||
|
||
<app-input-floating-label>{{ label() }}</app-input-floating-label> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/app/shared/components/input-trait/input-trait.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div class="relative"> | ||
<ng-select class="form-control" [items]="values()" [(ngModel)]="trait" bindLabel="value" bindValue="value" | ||
placeholder="Select trait..." (change)="change.emit($event)"> | ||
|
||
<ng-template ng-option-tmp let-item="item"> | ||
<div class="relative"> | ||
<div class="text-white"> | ||
{{ item.value }} | ||
</div> | ||
|
||
<p class="text-white text-sm italic">{{ item.desc }}</p> | ||
</div> | ||
</ng-template> | ||
</ng-select> | ||
|
||
<app-input-floating-label>{{ label() }}</app-input-floating-label> | ||
</div> |
Empty file.
35 changes: 35 additions & 0 deletions
35
src/app/shared/components/input-trait/input-trait.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
Component, | ||
computed, | ||
inject, | ||
input, | ||
model, | ||
output, | ||
} from '@angular/core'; | ||
import { ElectronService } from '../../../services/electron.service'; | ||
import { ModService } from '../../../services/mod.service'; | ||
|
||
@Component({ | ||
selector: 'app-input-trait', | ||
templateUrl: './input-trait.component.html', | ||
styleUrl: './input-trait.component.scss', | ||
}) | ||
export class InputTraitComponent { | ||
private electronService = inject(ElectronService); | ||
private modService = inject(ModService); | ||
|
||
public trait = model.required<string>(); | ||
public label = input<string>('Trait'); | ||
public change = output<string>(); | ||
|
||
public values = computed(() => { | ||
const traitObj = this.modService.json()['traits'] as Record<string, any>; | ||
return Object.keys(traitObj ?? {}) | ||
.sort() | ||
.map((t) => ({ value: t, desc: traitObj[t].desc ?? 'No description' })); | ||
}); | ||
|
||
constructor() { | ||
this.electronService.requestJSON('traits'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.