From 6930dc51ad0355769b1abceb5ba81ea8eeb86a38 Mon Sep 17 00:00:00 2001 From: moliloo Date: Mon, 21 Jul 2025 20:53:05 -0300 Subject: [PATCH] requested changes --- module/applications/dialogs/_module.mjs | 1 - .../dialogs/costSelectionDialog.mjs | 66 ------------------- module/applications/dialogs/d20RollDialog.mjs | 2 +- module/systemRegistration/handlebars.mjs | 3 +- .../less/dialog/dice-roll/roll-selection.less | 1 + styles/less/global/elements.less | 47 +++++++++++++ templates/dialogs/dice-roll/costSelection.hbs | 49 ++++++++------ templates/dialogs/dice-roll/rollSelection.hbs | 10 +-- 8 files changed, 85 insertions(+), 94 deletions(-) delete mode 100644 module/applications/dialogs/costSelectionDialog.mjs diff --git a/module/applications/dialogs/_module.mjs b/module/applications/dialogs/_module.mjs index 0722c747..bbffb791 100644 --- a/module/applications/dialogs/_module.mjs +++ b/module/applications/dialogs/_module.mjs @@ -1,5 +1,4 @@ export { default as BeastformDialog } from './beastformDialog.mjs'; -export { default as costSelectionDialog } from './costSelectionDialog.mjs'; export { default as d20RollDialog } from './d20RollDialog.mjs'; export { default as DamageDialog } from './damageDialog.mjs'; export { default as DamageReductionDialog } from './damageReductionDialog.mjs'; diff --git a/module/applications/dialogs/costSelectionDialog.mjs b/module/applications/dialogs/costSelectionDialog.mjs deleted file mode 100644 index abb79e6a..00000000 --- a/module/applications/dialogs/costSelectionDialog.mjs +++ /dev/null @@ -1,66 +0,0 @@ -const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api; - -export default class CostSelectionDialog extends HandlebarsApplicationMixin(ApplicationV2) { - constructor(costs, uses, action, resolve) { - super({}); - this.costs = costs; - this.uses = uses; - this.action = action; - this.resolve = resolve; - } - - static DEFAULT_OPTIONS = { - tag: 'form', - classes: ['daggerheart', 'dialog', 'dh-style', 'views', 'damage-selection'], - position: { - width: 400, - height: 'auto' - }, - actions: { - sendCost: this.sendCost - }, - form: { - handler: this.updateForm, - submitOnChange: true, - closeOnSubmit: false - } - }; - - /** @override */ - static PARTS = { - costSelection: { - id: 'costSelection', - template: 'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs' - } - }; - - /* -------------------------------------------- */ - - /** @inheritDoc */ - get title() { - return `Cost Options`; - } - - async _prepareContext(_options) { - const updatedCosts = this.action.calcCosts(this.costs), - updatedUses = this.action.calcUses(this.uses); - return { - costs: updatedCosts, - uses: updatedUses, - canUse: this.action.hasCost(updatedCosts) && this.action.hasUses(updatedUses) - }; - } - - static async updateForm(event, _, formData) { - const data = foundry.utils.expandObject(formData.object); - this.costs = foundry.utils.mergeObject(this.costs, data.costs); - this.uses = foundry.utils.mergeObject(this.uses, data.uses); - this.render(true); - } - - static sendCost(event) { - event.preventDefault(); - this.resolve({ costs: this.action.getRealCosts(this.costs), uses: this.uses }); - this.close(); - } -} diff --git a/module/applications/dialogs/d20RollDialog.mjs b/module/applications/dialogs/d20RollDialog.mjs index 03e00157..53fc9d69 100644 --- a/module/applications/dialogs/d20RollDialog.mjs +++ b/module/applications/dialogs/d20RollDialog.mjs @@ -22,7 +22,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio id: 'roll-selection', classes: ['daggerheart', 'dialog', 'dh-style', 'views', 'roll-selection'], position: { - width: 550 + width: 'auto' }, window: { icon: 'fa-solid fa-dice' diff --git a/module/systemRegistration/handlebars.mjs b/module/systemRegistration/handlebars.mjs index b15bf820..fc6decd3 100644 --- a/module/systemRegistration/handlebars.mjs +++ b/module/systemRegistration/handlebars.mjs @@ -30,6 +30,7 @@ export const preloadHandlebarsTemplates = async function () { 'systems/daggerheart/templates/ui/chat/parts/target-chat.hbs', 'systems/daggerheart/templates/ui/tooltip/parts/tooltipChips.hbs', 'systems/daggerheart/templates/ui/tooltip/parts/tooltipTags.hbs', - 'systems/daggerheart/templates/dialogs/downtime/activities.hbs' + 'systems/daggerheart/templates/dialogs/downtime/activities.hbs', + 'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs' ]); }; diff --git a/styles/less/dialog/dice-roll/roll-selection.less b/styles/less/dialog/dice-roll/roll-selection.less index af6c3c20..075054bb 100644 --- a/styles/less/dialog/dice-roll/roll-selection.less +++ b/styles/less/dialog/dice-roll/roll-selection.less @@ -13,6 +13,7 @@ display: flex; flex-direction: column; gap: 12px; + max-width: 550px; .dices-section { display: flex; diff --git a/styles/less/global/elements.less b/styles/less/global/elements.less index 6fd4ccc4..29a2c1dd 100755 --- a/styles/less/global/elements.less +++ b/styles/less/global/elements.less @@ -15,6 +15,10 @@ color: light-dark(@dark-blue, @golden); border: 1px solid light-dark(@dark, @beige); + &::placeholder { + color: light-dark(@dark-40, @beige-50); + } + &:hover[type='text'], &:hover[type='number'], &:focus[type='text'], @@ -48,6 +52,24 @@ } } + input[type='range'] { + &::-webkit-slider-runnable-track { + background: light-dark(@dark-blue-40, @golden-40); + } + &::-moz-range-track { + background: light-dark(@dark-blue-40, @golden-40); + } + &::-webkit-slider-thumb { + background: light-dark(@dark-blue, @golden); + border: none; + border-radius: 50%; + + &:hover { + box-shadow: 0 0 8px light-dark(@dark-blue, @golden); + } + } + } + button { background: light-dark(transparent, @golden); border: 1px solid light-dark(@dark-blue, @dark-blue); @@ -296,6 +318,31 @@ } } + .scalable-input { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; + + .form-group { + width: fit-content; + .nest-inputs { + width: fit-content; + } + } + + label { + font-family: @font-body; + font-size: 14px; + font-weight: 400; + + &.modifier-label { + width: 6ch; + text-align: end; + } + } + } + &:has(.list-w-img) { gap: 0; } diff --git a/templates/dialogs/dice-roll/costSelection.hbs b/templates/dialogs/dice-roll/costSelection.hbs index 91d0229f..d376c749 100644 --- a/templates/dialogs/dice-roll/costSelection.hbs +++ b/templates/dialogs/dice-roll/costSelection.hbs @@ -1,21 +1,30 @@ -
- {{#if uses}} -
-
- - +
+ {{localize 'DAGGERHEART.GENERAL.Cost.single'}} +
    + {{#if uses}} +
  • +
    +
    + + +
    +
    + +
  • + {{/if}} + {{#each costs as | cost index |}} +
  • +
    +
    + + +
    -
- {{/if}} - {{#each costs as | cost index |}} -
-
- - - {{#if scalable}} - - {{/if}} -
-
- {{/each}} -
\ No newline at end of file + {{#if scalable}} + + {{/if}} + + + {{/each}} + + \ No newline at end of file diff --git a/templates/dialogs/dice-roll/rollSelection.hbs b/templates/dialogs/dice-roll/rollSelection.hbs index 91af7de2..6c26df2f 100644 --- a/templates/dialogs/dice-roll/rollSelection.hbs +++ b/templates/dialogs/dice-roll/rollSelection.hbs @@ -135,11 +135,8 @@ {{#if (eq @root.rollType 'DualityRoll')}}{{localize "DAGGERHEART.GENERAL.situationalBonus"}}{{/if}} - {{#if costs}} -
- {{localize 'DAGGERHEART.General.Cost.single'}} - {{> 'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs'}} -
+ {{#if (or costs uses)}} + {{> 'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs'}} {{/if}} {{/unless}} {{localize "DAGGERHEART.GENERAL.formula"}}: {{@root.formula}} @@ -153,6 +150,9 @@
{{else}} + {{#if (or costs uses)}} + {{> 'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs'}} + {{/if}}