hide amounts in goal composition if all items are 1x
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
export let ignoreZeroWeight: boolean = false;
|
||||
|
||||
let list: CompositionItem[] = [];
|
||||
let allOnes: boolean = false;
|
||||
|
||||
function calculateAmount(log: LogResult, unweighted: boolean) {
|
||||
let amount = 0;
|
||||
@@ -83,12 +84,16 @@
|
||||
|
||||
list = Object.keys(map).sort((a, b) => map[b].amount - map[a].amount).map(k => map[k]).filter(e => e.amount > 0);
|
||||
}
|
||||
|
||||
$: allOnes = list.find(l => l.amount !== 1) == null;
|
||||
</script>
|
||||
|
||||
<div class="composition">
|
||||
{#each list as item}
|
||||
<div class="item">
|
||||
<span class="amount">{item.amount}x </span>
|
||||
{#if !allOnes}
|
||||
<span class="amount">{item.amount}x </span>
|
||||
{/if}
|
||||
<Link to={item.link}>{item.name}</Link>
|
||||
</div>
|
||||
{/each}
|
||||
@@ -102,7 +107,7 @@
|
||||
}
|
||||
|
||||
div.item {
|
||||
padding: 0.125em 0.5ch;
|
||||
padding: 0.125em 0.75ch;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user