diff --git a/assets/icons/chevron.svg b/assets/icons/chevron.svg new file mode 100644 index 0000000..40bf6e2 --- /dev/null +++ b/assets/icons/chevron.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/module/apps/PlayerSheet.mjs b/module/apps/PlayerSheet.mjs index 056e6eb..f27fa0c 100644 --- a/module/apps/PlayerSheet.mjs +++ b/module/apps/PlayerSheet.mjs @@ -241,7 +241,14 @@ export class PlayerSheet extends }); }; - ctx.totalWeight = toPrecision(totalWeight, 2) + weightUnit; + totalWeight = toPrecision(totalWeight, 2); + ctx.totalWeight = totalWeight + weightUnit; + console.log({ + totalWeight, + carryCapacity: this.actor.system.carryCapacity, + percent: Math.round(totalWeight / this.actor.system.carryCapacity * 100), + }); + ctx.carryCapacityPercent = Math.round(totalWeight / this.actor.system.carryCapacity * 100); }; async _prepareItem(item) { @@ -319,19 +326,19 @@ export class PlayerSheet extends * @this {PlayerSheet} */ static async #toggleExpand(event, target) { - if (event.srcElement instanceof HTMLInputElement) { return }; - - const { itemUuid } = target.closest(`[data-item-uuid]`)?.dataset ?? {}; + const element = target.closest(`[data-item-uuid]`); + const { itemUuid } = element?.dataset ?? {}; if (!itemUuid) { return }; const expanded = this.#expandedItems.has(itemUuid); - if (expanded) { - this.#expandedItems.delete(itemUuid); - target.nextElementSibling.dataset.expanded = false; - } else { - this.#expandedItems.add(itemUuid); - target.nextElementSibling.dataset.expanded = true; - } + const newExpanded = !expanded; + + this.#expandedItems[newExpanded ? `add` : `delete`]?.(itemUuid); + target.dataset.expanded = newExpanded; + const collapses = element.querySelectorAll(`[data-expanded]`); + collapses.forEach(el => { + el.dataset.expanded = newExpanded; + }); }; // #endregion Actions }; diff --git a/styles/Apps/PlayerSheet.css b/styles/Apps/PlayerSheet.css index cb2e44c..95a3a5e 100644 --- a/styles/Apps/PlayerSheet.css +++ b/styles/Apps/PlayerSheet.css @@ -37,7 +37,21 @@ } } + .item-list-header { + display: flex; + flex-direction: row; + gap: 8px; + border-radius: 6px 6px 0 0; + padding: 4px; + margin-bottom: 2px; + background: var(--item-list-header-background); + color: var(--item-list-header-color); + } + .item-list { + display: flex; + flex-direction: column; + gap: 2px; list-style: none; margin: 0; padding: 0; @@ -46,8 +60,8 @@ .item { background: var(--item-card-background); color: var(--item-card-color); - border-radius: 4px; overflow: hidden; + margin-bottom: 0; .summary { display: grid; @@ -79,13 +93,27 @@ opacity: 90%; } - input { + input, button { background: var(--item-card-header-input-background); color: var(--item-card-header-input-color); text-align: center; } } + .expand-button { + border: none; + aspect-ratio: 1; + + &:focus-visible { + filter: brightness(150%); + outline: none; + } + + &[data-expanded="true"] { + rotate: 180deg; + } + } + .full-details { padding: 4px; @@ -93,6 +121,10 @@ display: none; } } + + &:last-child { + border-radius: 0 0 6px 6px; + } } .content { diff --git a/styles/resets/button.css b/styles/resets/button.css index d04ae6e..98ba86d 100644 --- a/styles/resets/button.css +++ b/styles/resets/button.css @@ -1,3 +1,8 @@ .taf > .window-content button { height: initial; + + &:focus { + outline: none; + box-shadow: none; + } } diff --git a/styles/themes/dark.css b/styles/themes/dark.css index 780ecb1..8eb098a 100644 --- a/styles/themes/dark.css +++ b/styles/themes/dark.css @@ -7,6 +7,8 @@ --tab-button-active-border: rebeccapurple; --tab-button-hover-bg: var(--color-cool-3); + --item-list-header-background: #171e26; + --item-list-header-color: white; --item-card-background: #1d262f; --item-card-color: white; --item-card-header-background: #242d38; diff --git a/styles/themes/variables.css b/styles/themes/variables.css new file mode 100644 index 0000000..62c2148 --- /dev/null +++ b/styles/themes/variables.css @@ -0,0 +1,3 @@ +:root { + --steel-650: #2b3642; +} diff --git a/templates/PlayerSheet/item-lists.hbs b/templates/PlayerSheet/item-lists.hbs index 56585e4..f736ad3 100644 --- a/templates/PlayerSheet/item-lists.hbs +++ b/templates/PlayerSheet/item-lists.hbs @@ -3,14 +3,23 @@ data-group="primary" data-tab="items" > - Total Weight: {{totalWeight}} -