From 8067c2a846a6fbb15f5bc3dd2c7f88732e74a743 Mon Sep 17 00:00:00 2001 From: Kyle Kemp Date: Thu, 15 Aug 2024 18:27:58 -0500 Subject: [PATCH] improve effect picker --- .../input-effect/input-effect.component.html | 8 ++++++++ .../input-effect/input-effect.component.ts | 14 ++++++++++++-- .../items-editor/items-editor.component.html | 18 +++++++++++++----- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/app/shared/components/input-effect/input-effect.component.html b/src/app/shared/components/input-effect/input-effect.component.html index 41787cd..380e290 100644 --- a/src/app/shared/components/input-effect/input-effect.component.html +++ b/src/app/shared/components/input-effect/input-effect.component.html @@ -2,6 +2,14 @@ + +
+
+ {{ item.value }} +
+
+
+
diff --git a/src/app/shared/components/input-effect/input-effect.component.ts b/src/app/shared/components/input-effect/input-effect.component.ts index 9f037b3..3ce7ec5 100644 --- a/src/app/shared/components/input-effect/input-effect.component.ts +++ b/src/app/shared/components/input-effect/input-effect.component.ts @@ -4,6 +4,7 @@ import { inject, input, model, + OnInit, output, } from '@angular/core'; import { ElectronService } from '../../../services/electron.service'; @@ -14,12 +15,13 @@ import { ModService } from '../../../services/mod.service'; templateUrl: './input-effect.component.html', styleUrl: './input-effect.component.scss', }) -export class InputEffectComponent { +export class InputEffectComponent implements OnInit { private electronService = inject(ElectronService); private modService = inject(ModService); - public effect = model.required(); + public effect = model(); public label = input('Effect'); + public defaultValue = input(); public change = output(); public values = computed(() => { @@ -52,6 +54,14 @@ export class InputEffectComponent { this.electronService.requestJSON('effect-data'); } + ngOnInit() { + const defaultItem = this.defaultValue(); + if (defaultItem) { + const foundItem = this.values().find((i) => i.value === defaultItem); + this.effect.set(foundItem as unknown as string); + } + } + public itemCompare( itemA: { value: string; desc: string }, itemB: { value: string; desc: string } diff --git a/src/app/tabs/items/items-editor/items-editor.component.html b/src/app/tabs/items/items-editor/items-editor.component.html index bd80c62..520d235 100644 --- a/src/app/tabs/items/items-editor/items-editor.component.html +++ b/src/app/tabs/items/items-editor/items-editor.component.html @@ -415,10 +415,11 @@
-
+ @if(editingData.useEffect!.name) {
Use Potency Can Apply Use Effect Via Thief Apply
+ }
- +
+ @if(editingData.strikeEffect!.name) {
Strike Potency
+ }
-
+ @if(editingData.equipEffect!.name) {
Equip Potency
+ }
-
+ @if(editingData.breakEffect!.name) {
Break Potency
+ }