|
@@ -395,9 +395,6 @@ const displayPokemon = (pkmnName, target) => {
|
|
|
.map((part) => part.charAt(0).toUpperCase() + part.substr(1))
|
|
|
.join(" ");
|
|
|
|
|
|
- // TODO this will need to be reactive when we start actually pulling stats
|
|
|
- const { total, clusters } = currentScores.value[pkmnName][colorSpace.value];
|
|
|
-
|
|
|
U.template(
|
|
|
"pkmn-template",
|
|
|
({ image, name, score, totalBtn, cls1Btn, cls2Btn, cls3Btn, cls4Btn }) => {
|
|
@@ -415,22 +412,31 @@ const displayPokemon = (pkmnName, target) => {
|
|
|
score.innerText = rankingValues[pkmnName][colorSpace.value].toFixed(2);
|
|
|
});
|
|
|
|
|
|
- totalBtn.innerText = total.muHex;
|
|
|
- totalBtn.style = getColorButtonStyle(total.muHex);
|
|
|
+ U.reactive(() => {
|
|
|
+ const { total } = currentScores.value[pkmnName][colorSpace.value];
|
|
|
+ totalBtn.innerText = total.muHex;
|
|
|
+ totalBtn.style = getColorButtonStyle(total.muHex);
|
|
|
+ });
|
|
|
+ U.reactive(() => {
|
|
|
+ totalBtn.dataset.best = [
|
|
|
+ sortUseWholeImage.value,
|
|
|
+ sortUseTotalSize.value,
|
|
|
+ sortUseInverseTotalSize.value,
|
|
|
+ ].reduce((x, y) => x || y);
|
|
|
+ });
|
|
|
totalBtn.addEventListener("click", () => {
|
|
|
- targetColor.value = total.muHex;
|
|
|
+ targetColor.value = currentScores.value[pkmnName][colorSpace.value].total.muHex;
|
|
|
});
|
|
|
- totalBtn.dataset.best =
|
|
|
- sortUseWholeImage.value ||
|
|
|
- sortUseTotalSize.value ||
|
|
|
- sortUseInverseTotalSize.value;
|
|
|
|
|
|
+ // TODO this will need to be reactive when we start actually pulling stats
|
|
|
+ const { clusters } = currentScores.value[pkmnName][colorSpace.value];
|
|
|
[cls1Btn, cls2Btn, cls3Btn, cls4Btn].forEach((button, index) => {
|
|
|
if (index >= clusters.length) {
|
|
|
- button.remove();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ button.hidden = false;
|
|
|
+
|
|
|
const { muHex } = clusters[index];
|
|
|
button.innerText = muHex;
|
|
|
button.style = getColorButtonStyle(muHex);
|
|
@@ -446,7 +452,6 @@ const displayPokemon = (pkmnName, target) => {
|
|
|
});
|
|
|
|
|
|
// TODO stat dialog
|
|
|
- // TODO click name to copy?
|
|
|
|
|
|
return target;
|
|
|
}
|