clone function cus why not

main^2
Midnight 3 years ago
parent f894d80c22
commit f28e5e2265

@ -164,6 +164,14 @@
save();
}
function copy(commission: Commission) {
let newCommission = { ...commission };
newCommission.name = "Commission " + number;
commissions.push(newCommission);
commissions = commissions;
save();
}
function remove(name: string) {
commissions = commissions.filter(value => {
return value.name != name;
@ -192,7 +200,7 @@
</div>
<div class="w-full flex justify-end gap-3">
<span><Button on:click={save}>💾 Save to Clipboard</Button></span>
<span><Button on:click={load}> Load from Clipboard</Button></span>
<span><Button on:click={load}>📋 Load from Clipboard</Button></span>
</div>
</div>
@ -240,6 +248,7 @@
<div class="flex justify-between">
<h3 class="text-xl font-bold flex gap-5">{commission.name}<p class="bg-green-500 py-1 text-sm px-5 rounded-lg">${commission.price}</p></h3>
<span>
<Button on:click={() => {copy(commission)}}>⤴️</Button>
<Button on:click={() => {remove(commission.name)}}>🗑️</Button>
</span>
</div>

Loading…
Cancel
Save