Standards domain models shuffling and renaming
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import {
|
||||
Standards,
|
||||
type Standard,
|
||||
type StandardsConfig,
|
||||
type StandardsParameters,
|
||||
} from "@blade-and-brawn/calculator";
|
||||
import {
|
||||
Activity,
|
||||
@@ -17,7 +17,7 @@
|
||||
selected: {
|
||||
activity: Activity;
|
||||
metrics: Metrics;
|
||||
cfg: StandardsConfig;
|
||||
params: StandardsParameters;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<div>
|
||||
<div class="flex items-center">
|
||||
<p class="text-xs label">
|
||||
{#if selected.cfg.activity[selected.activity].enableGeneration && allStandards
|
||||
{#if selected.params.activity[selected.activity].enableGeneration && allStandards
|
||||
.byActivity(selected.activity)
|
||||
.getMetadata().generators.length}
|
||||
(Generated data: {allStandards
|
||||
@@ -87,7 +87,7 @@
|
||||
? parseFloat(kgToLb(standard.metrics.weight).toFixed(2))
|
||||
: "None"}</th
|
||||
>
|
||||
{#each range(selected.cfg.global.maxLevel).map((i) => ++i) as lvl}
|
||||
{#each range(selected.params.global.maxLevel).map((i) => ++i) as lvl}
|
||||
<td>{getLvlValue(activity, standard, lvl)}</td>
|
||||
{/each}
|
||||
</tr>
|
||||
@@ -99,7 +99,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Body weight</th>
|
||||
{#each range(selected.cfg.global.maxLevel).map((i) => ++i) as lvl}
|
||||
{#each range(selected.params.global.maxLevel).map((i) => ++i) as lvl}
|
||||
<td>{lvl}</td>
|
||||
{/each}
|
||||
</tr>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import {
|
||||
DEFAULT_STANDARDS_DATA,
|
||||
Standards,
|
||||
type StandardsConfig,
|
||||
type StandardsParameters,
|
||||
} from "@blade-and-brawn/calculator";
|
||||
import {
|
||||
Activity,
|
||||
@@ -24,7 +24,7 @@
|
||||
age: null as number | null,
|
||||
weight: null as number | null, // lb
|
||||
},
|
||||
cfg: structuredClone(defaultStandards.cfg) as StandardsConfig,
|
||||
params: structuredClone(defaultStandards.params) as StandardsParameters,
|
||||
});
|
||||
|
||||
const selected = $derived({
|
||||
@@ -34,11 +34,11 @@
|
||||
age: input.metrics.age ?? 0,
|
||||
weight: lbToKg(input.metrics.weight ?? 0),
|
||||
} as Metrics,
|
||||
cfg: input.cfg,
|
||||
params: input.params,
|
||||
});
|
||||
|
||||
const allStandards = $derived(
|
||||
new Standards(DEFAULT_STANDARDS_DATA, selected.cfg),
|
||||
new Standards(DEFAULT_STANDARDS_DATA, selected.params),
|
||||
);
|
||||
|
||||
$effect(() => {
|
||||
@@ -86,7 +86,7 @@
|
||||
min="1"
|
||||
max="100"
|
||||
placeholder="5"
|
||||
bind:value={input.cfg.global.maxLevel}
|
||||
bind:value={input.params.global.maxLevel}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
@@ -102,7 +102,7 @@
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={
|
||||
input.cfg.activity[selected.activity]
|
||||
input.params.activity[selected.activity]
|
||||
.enableGeneration
|
||||
}
|
||||
class="toggle toggle-lg m-auto"
|
||||
@@ -118,10 +118,10 @@
|
||||
step=".05"
|
||||
placeholder=".1"
|
||||
bind:value={
|
||||
input.cfg.activity[selected.activity]
|
||||
input.params.activity[selected.activity]
|
||||
.weightModifier
|
||||
}
|
||||
disabled={!selected.cfg.activity[selected.activity]
|
||||
disabled={!selected.params.activity[selected.activity]
|
||||
.enableGeneration}
|
||||
/>
|
||||
</label>
|
||||
@@ -137,7 +137,7 @@
|
||||
<!-- inputSelected.cfg.activity[selected.activity] -->
|
||||
<!-- .weightSkew -->
|
||||
<!-- } -->
|
||||
<!-- disabled={!selected.cfg.activity[selected.activity] -->
|
||||
<!-- disabled={!selected.params.activity[selected.activity] -->
|
||||
<!-- .enableGeneration} -->
|
||||
<!-- /> -->
|
||||
<!-- </label> -->
|
||||
@@ -150,10 +150,10 @@
|
||||
max="1"
|
||||
step=".05"
|
||||
bind:value={
|
||||
input.cfg.activity[selected.activity]
|
||||
input.params.activity[selected.activity]
|
||||
.difficultyModifier
|
||||
}
|
||||
disabled={!selected.cfg.activity[selected.activity]
|
||||
disabled={!selected.params.activity[selected.activity]
|
||||
.enableGeneration}
|
||||
/>
|
||||
</label>
|
||||
@@ -166,10 +166,10 @@
|
||||
max="1"
|
||||
step=".05"
|
||||
bind:value={
|
||||
input.cfg.activity[selected.activity]
|
||||
input.params.activity[selected.activity]
|
||||
.ageModifier
|
||||
}
|
||||
disabled={!selected.cfg.activity[selected.activity]
|
||||
disabled={!selected.params.activity[selected.activity]
|
||||
.enableGeneration}
|
||||
/>
|
||||
</label>
|
||||
@@ -182,9 +182,9 @@
|
||||
max="100"
|
||||
step="1"
|
||||
bind:value={
|
||||
input.cfg.activity[selected.activity].peakAge
|
||||
input.params.activity[selected.activity].peakAge
|
||||
}
|
||||
disabled={!selected.cfg.activity[selected.activity]
|
||||
disabled={!selected.params.activity[selected.activity]
|
||||
.enableGeneration}
|
||||
/>
|
||||
</label>
|
||||
@@ -202,10 +202,10 @@
|
||||
max="10"
|
||||
step="1"
|
||||
bind:value={
|
||||
input.cfg.activity[selected.activity]
|
||||
input.params.activity[selected.activity]
|
||||
.stretch.lower
|
||||
}
|
||||
disabled={!selected.cfg.activity[
|
||||
disabled={!selected.params.activity[
|
||||
selected.activity
|
||||
].enableGeneration}
|
||||
/>
|
||||
@@ -219,10 +219,10 @@
|
||||
max="10"
|
||||
step="1"
|
||||
bind:value={
|
||||
input.cfg.activity[selected.activity]
|
||||
input.params.activity[selected.activity]
|
||||
.stretch.upper
|
||||
}
|
||||
disabled={!selected.cfg.activity[
|
||||
disabled={!selected.params.activity[
|
||||
selected.activity
|
||||
].enableGeneration}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user