Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Aug 21, 2022
1 parent cafeb13 commit c90f570
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
28 changes: 28 additions & 0 deletions src/applications/merchant-app/MerchantCurrencyColumn.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<script>
export let currency;
let name = currency.name;
let img = currency.img;
let abbreviation = currency.abbreviation;
let quantity = currency.quantity;
</script>

<div class="item-piles-flexrow item-piles-item-row" style="flex:0 1 auto; margin: 0.5rem 0.25rem;">

<div class="item-piles-img-container">
<img class="item-piles-img" src="{$img}"/>
</div>

<div class="item-piles-name item-piles-text" style="flex:0 1 auto;">
<div class="item-piles-name-container">
{#if abbreviation}
{abbreviation.replace("{#}", $quantity)}
{:else}
{$name} (x{$quantity})
{/if}
</div>
</div>

</div>
12 changes: 8 additions & 4 deletions src/applications/merchant-app/MerchantPopulateItemsTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
export let store;
let tables = Array.from(game.tables);
let selectedTable = tables?.[0].id;
let selectedTable = tables?.[0]?.id;
let timesToRoll = "1d10";
let timesRolled = "";
let keepRolled = false;
Expand All @@ -29,6 +29,7 @@
async function rollItems() {
const table = game.tables.get(selectedTable);
if (!table) return;
const roll = new Roll(timesToRoll ?? 1).evaluate({ async: false });
if (!keepRolled) {
itemsRolled.set([]);
Expand Down Expand Up @@ -109,10 +110,13 @@
{#each tables as table (table.id)}
<option value={table.id}>{table.name}</option>
{/each}
{#if !tables.length}
<option value="">No roll tables exist, create one to get started</option>
{/if}
</select>
<input type="text" bind:value={timesToRoll} placeholder="2d6+4"
style="height: 30px; padding: 0 0.5rem; flex:0.5; margin-left:0.5rem;"/>
style="height: 30px; padding: 0 0.5rem; flex:0.5; min-width: 50px; margin-left:0.5rem;"/>
<button style="flex:0; padding: 0 1rem; margin-left:0.5rem;" on:click={rollItems}>
Roll
Expand Down Expand Up @@ -208,15 +212,15 @@
align-items: center;
}
.item-piles-keep-rolled{
.item-piles-keep-rolled {
align-items: center;
justify-content: flex-end;
font-size: 0.75rem;
text-align: right;
flex: 0 1 auto;
input {
height:14px;
height: 14px;
}
}
Expand Down
19 changes: 2 additions & 17 deletions src/applications/merchant-app/MerchantRightPane.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import MerchantSellTab from "./MerchantSellTab.svelte";
import MerchantPopulateItemsTab from "./MerchantPopulateItemsTab.svelte";
import { get, writable } from "svelte/store";
import MerchantCurrencyColumn from "./MerchantCurrencyColumn.svelte";
export let store;
export let recipientStore;
Expand Down Expand Up @@ -55,23 +56,7 @@

{#each $currencies as currency (currency.identifier)}

<div class="item-piles-flexrow item-piles-item-row" style="flex:0 1 auto; margin: 0.5rem 0.25rem;">

<div class="item-piles-img-container">
<img class="item-piles-img" src="{get(currency.img)}"/>
</div>

<div class="item-piles-name item-piles-text" style="flex:0 1 auto;">
<div class="item-piles-name-container">
{#if currency.abbreviation}
{currency.abbreviation.replace("{#}", get(currency.quantity))}
{:else}
{get(currency.name)} (x{get(currency.quantity)})
{/if}
</div>
</div>

</div>
<MerchantCurrencyColumn {currency}/>

{/each}

Expand Down

0 comments on commit c90f570

Please sign in to comment.