diff --git a/lang/en.json b/lang/en.json index 06ababf5..cb297398 100755 --- a/lang/en.json +++ b/lang/en.json @@ -231,7 +231,8 @@ "viewParty": "View Party", "InvalidOldCharacterImportTitle": "Old Character Import", "InvalidOldCharacterImportText": "Character data exported prior to system version 1.1 will not generate a complete character. Do you wish to continue?", - "cancelBeastform": "Cancel Beastform" + "cancelBeastform": "Cancel Beastform", + "sidebarFavoritesHint": "Drag items, features and domain cards from the sheet to here" }, "Companion": { "FIELDS": { diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs index e7733826..1be3c122 100644 --- a/module/applications/sheets/actors/character.mjs +++ b/module/applications/sheets/actors/character.mjs @@ -266,23 +266,24 @@ export default class CharacterSheet extends DHBaseActorSheet { async _prepareSidebarContext(context, _options) { context.isDeath = this.document.system.deathMoveViable; context.sidebarFavoritesEmpty = this.document.system.sidebarFavorites.length === 0; + context.showfavorites = !context.sidebarFavoritesEmpty || this.document.system.usedUnarmed; - const initialFavorites = this.document.system.usedUnarmed - ? { - equipment: { - label: 'DAGGERHEART.GENERAL.equipment', - items: [{ type: 'attack', value: this.document.system.usedUnarmed }] - } - } - : {}; - context.sidebarFavorites = this.document.system.sidebarFavorites.reduce((acc, item) => { - const type = item.type === 'domainCard' ? item.type : 'equipment'; - const label = type === 'domainCard' ? 'DAGGERHEART.GENERAL.loadout' : 'DAGGERHEART.GENERAL.equipment'; - if (!acc[type]) acc[type] = { label, items: [] }; - acc[type].items.push({ type: item.type, value: item }); + // const initialFavorites = this.document.system.usedUnarmed + // ? { + // equipment: { + // label: 'DAGGERHEART.GENERAL.equipment', + // items: [{ type: 'attack', value: this.document.system.usedUnarmed }] + // } + // } + // : {}; + // context.sidebarFavorites = this.document.system.sidebarFavorites.reduce((acc, item) => { + // const type = item.type === 'domainCard' ? item.type : 'equipment'; + // const label = type === 'domainCard' ? 'DAGGERHEART.GENERAL.loadout' : 'DAGGERHEART.GENERAL.equipment'; + // if (!acc[type]) acc[type] = { label, items: [] }; + // acc[type].items.push({ type: item.type, value: item }); - return acc; - }, initialFavorites); + // return acc; + // }, initialFavorites); } /** diff --git a/module/data/item/domainCard.mjs b/module/data/item/domainCard.mjs index 92d8828c..571d682c 100644 --- a/module/data/item/domainCard.mjs +++ b/module/data/item/domainCard.mjs @@ -45,6 +45,26 @@ export default class DHDomainCard extends BaseDataItem { /* -------------------------------------------- */ + /**@inheritdoc */ + async _preUpdate(data, options, user) { + const allowed = await super._preUpdate(data, options, user); + if (allowed === false) return; + + if (this.parent.parent?.type === 'character') { + if ( + data.system?.inVault && + !this.inVault && + this.parent.parent.system.sidebarFavorites.find(x => x?.id === this.parent.id) + ) { + this.parent.parent.update({ + 'system.sidebarFavorites': this.parent.parent.system.sidebarFavorites.filter( + x => x.id !== this.parent.id + ) + }); + } + } + } + /**@inheritdoc */ async _preCreate(data, options, user) { const allowed = await super._preCreate(data, options, user); diff --git a/styles/less/sheets/actors/character/sidebar.less b/styles/less/sheets/actors/character/sidebar.less index 976dffcd..0f710055 100644 --- a/styles/less/sheets/actors/character/sidebar.less +++ b/styles/less/sheets/actors/character/sidebar.less @@ -552,7 +552,6 @@ .shortcut-items-section { overflow-y: hidden; padding-top: 10px; - padding-bottom: 20px; mask-image: linear-gradient(0deg, transparent 0%, black 5%); scrollbar-gutter: stable; scrollbar-width: thin; @@ -565,16 +564,17 @@ .empty-favorites { width: 100%; display: flex; + flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box; - height: 40px; border: 1px dashed light-dark(@dark-blue-50, @beige-50); border-radius: 3px; color: light-dark(@dark-blue-50, @beige-50); text-align: center; margin-bottom: 10px; margin-left: 4px; + padding: 4px 0; span { width: 250px; diff --git a/templates/sheets/actors/character/sidebar.hbs b/templates/sheets/actors/character/sidebar.hbs index 58827518..e14daad2 100644 --- a/templates/sheets/actors/character/sidebar.hbs +++ b/templates/sheets/actors/character/sidebar.hbs @@ -96,10 +96,36 @@