diff --git a/main.ts b/main.ts index 637fcf2..65bcb40 100644 --- a/main.ts +++ b/main.ts @@ -22,7 +22,7 @@ const DEFAULT_SETTINGS: ObsidianPluginMtgSettings = { showCardNamesAsHyperlinks: true, showCardPreviews: true, showBuylist: true, - hidePrices: false, + showCardPrices: true, showManaCosts: true, }, }; @@ -220,13 +220,13 @@ class ObsidianPluginMtgSettingsTab extends PluginSettingTab { ); new Setting(containerEl) - .setName("Hide prices") - .setDesc("Toggles card prices in decklists") + .setName("Show card prices") + .setDesc("Enables card prices to be displayed in decklists") .addToggle((toggle) => toggle - .setValue(this.plugin.settings.decklist.hidePrices) + .setValue(this.plugin.settings.decklist.showCardPrices) .onChange(async (value: boolean) => { - this.plugin.settings.decklist.hidePrices = value; + this.plugin.settings.decklist.showCardPrices = value; await this.plugin.saveSettings(); }) ); diff --git a/src/collection.spec.ts b/src/collection.spec.ts index be37616..71ed370 100644 --- a/src/collection.spec.ts +++ b/src/collection.spec.ts @@ -52,7 +52,7 @@ describe("Collection", () => { showCardNamesAsHyperlinks: true, showCardPreviews: true, showBuylist: true, - hidePrices: false, + showCardPrices: true, showManaCosts: true, }, }; diff --git a/src/renderer.spec.ts b/src/renderer.spec.ts index a25c4ad..9a2be6e 100644 --- a/src/renderer.spec.ts +++ b/src/renderer.spec.ts @@ -32,7 +32,7 @@ describe("Renderer", () => { showCardNamesAsHyperlinks: true, showCardPreviews: true, showBuylist: true, - hidePrices: false, + showCardPrices: true, showManaCosts: true, }, }; @@ -57,7 +57,7 @@ describe("Renderer", () => { ...settings, decklist: { ...settings.decklist, - hidePrices: true, + showCardPrices: false, }, }, fakeFetcher diff --git a/src/renderer.ts b/src/renderer.ts index 6a5d3b7..ada054c 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -69,9 +69,9 @@ export const getCardPrice = ( const cardId = nameToId(cardName); const cardData = cardDataById[cardId]; const preferredCurrency = settings.decklist.preferredCurrency; - const hidePrices = settings.decklist.hidePrices; + const showCardPrices = settings.decklist.showCardPrices; - if (!cardData || hidePrices) { + if (!cardData || !showCardPrices) { return null; } else { if (preferredCurrency === "eur") { @@ -330,7 +330,7 @@ export const renderDecklist = async ( sectionListHeadRow.createEl("th", { text: "Cost" }); } - if (!settings.decklist.hidePrices) { + if (settings.decklist.showCardPrices) { sectionListHeadRow.createEl("th", { text: "Price" }); } @@ -404,7 +404,7 @@ export const renderDecklist = async ( let cardPrice; let cardPriceEl; - if (!settings.decklist.hidePrices) { + if (settings.decklist.showCardPrices) { const cardPriceCell = lineEl.createEl("td"); cardPriceEl = cardPriceCell.createSpan({ cls: "card-price" }); @@ -600,7 +600,7 @@ export const renderDecklist = async ( sectionListFootRow.createEl("td"); let totalCostEl; - if (hasCardInfo && !settings.decklist.hidePrices) { + if (hasCardInfo && settings.decklist.showCardPrices) { totalCostEl = sectionListFootRow.createEl("td", { cls: "decklist__section-totals__cost fit" }); } @@ -641,7 +641,7 @@ export const renderDecklist = async ( }, 0.0); // Value - if (hasCardInfo && !settings.decklist.hidePrices) { + if (hasCardInfo && settings.decklist.showCardPrices) { const totalValueOwned = sectionTotalCost[section] - totalMissingCostInSection; totalCostEl!.createSpan({ @@ -660,7 +660,7 @@ export const renderDecklist = async ( } else { totalCardsEl.textContent = `${sectionTotalCounts[section]}`; - if (!settings.decklist.hidePrices) { + if (settings.decklist.showCardPrices) { totalCostEl!.textContent = `${currencyMapping[settings.decklist.preferredCurrency] }${sectionTotalCost[section].toFixed(2)}`; } @@ -735,7 +735,7 @@ export const renderDecklist = async ( text: "cards", }); - if (hasCardInfo && !settings.decklist.hidePrices) { + if (hasCardInfo && settings.decklist.showCardPrices) { buylistLineEl.createSpan({ cls: "decklist__section-totals", text: `${currencyMapping[settings.decklist.preferredCurrency] diff --git a/src/settings.ts b/src/settings.ts index 504b48f..f638385 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -19,7 +19,7 @@ export interface ObsidianPluginMtgSettings { // Show buylist showBuylist: boolean; // Show prices - hidePrices: boolean; + showCardPrices: boolean; // Show mana costs showManaCosts: boolean; };