diff --git a/daggerheart.mjs b/daggerheart.mjs index 55a7d0bf..7a2ac93f 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -63,6 +63,7 @@ CONFIG.ui.combat = applications.ui.DhCombatTracker; CONFIG.ui.chat = applications.ui.DhChatLog; CONFIG.ui.hotbar = applications.ui.DhHotbar; CONFIG.ui.sidebar = applications.sidebar.DhSidebar; +CONFIG.ui.actors = applications.sidebar.DhActorDirectory; CONFIG.ui.daggerheartMenu = applications.sidebar.DaggerheartMenu; CONFIG.ui.resources = applications.ui.DhFearTracker; CONFIG.ui.countdowns = applications.ui.DhCountdowns; diff --git a/lang/en.json b/lang/en.json index 781b736b..02704397 100755 --- a/lang/en.json +++ b/lang/en.json @@ -2702,6 +2702,12 @@ "documentIsMissing": "The {documentType} is missing from the world." }, "Sidebar": { + "actorDirectory": { + "tier": "Tier {tier} {type}", + "character": "Level {level} Character", + "companion": "Level {level} - {partner}", + "companionNoPartner": "No Partner" + }, "daggerheartMenu": { "title": "Daggerheart Menu", "startSession": "Start Session", diff --git a/module/applications/sidebar/_module.mjs b/module/applications/sidebar/_module.mjs index f19f697c..1f3207bc 100644 --- a/module/applications/sidebar/_module.mjs +++ b/module/applications/sidebar/_module.mjs @@ -1,2 +1,3 @@ export { default as DaggerheartMenu } from './tabs/daggerheartMenu.mjs'; +export { default as DhActorDirectory } from './tabs/actorDirectory.mjs'; export { default as DhSidebar } from './sidebar.mjs'; diff --git a/module/applications/sidebar/tabs/actorDirectory.mjs b/module/applications/sidebar/tabs/actorDirectory.mjs new file mode 100644 index 00000000..4a528e74 --- /dev/null +++ b/module/applications/sidebar/tabs/actorDirectory.mjs @@ -0,0 +1,20 @@ +export default class DhActorDirectory extends foundry.applications.sidebar.tabs.ActorDirectory { + static DEFAULT_OPTIONS = { + renderUpdateKeys: ['system.levelData.level.current', 'system.partner', 'system.tier'] + }; + + static _entryPartial = 'systems/daggerheart/templates/ui/sidebar/actor-document-partial.hbs'; + + async _prepareDirectoryContext(context, options) { + await super._prepareDirectoryContext(context, options); + const adversaryTypes = CONFIG.DH.ACTOR.allAdversaryTypes(); + const environmentTypes = CONFIG.DH.ACTOR.environmentTypes; + context.getTypeLabel = document => { + return document.type === 'adversary' + ? game.i18n.localize(adversaryTypes[document.system.type]?.label ?? 'TYPES.Actor.adversary') + : document.type === 'environment' + ? game.i18n.localize(environmentTypes[document.system.type]?.label ?? 'TYPES.Actor.environment') + : null; + }; + } +} diff --git a/styles/less/ui/sidebar/tabs.less b/styles/less/ui/sidebar/tabs.less index ec4bbe9f..e220a228 100644 --- a/styles/less/ui/sidebar/tabs.less +++ b/styles/less/ui/sidebar/tabs.less @@ -13,3 +13,16 @@ } } } + +.actors-sidebar { + .directory-item.actor .entry-name:has(.entry-subtitle) { + display: flex; + flex-direction: column; + line-height: 1rem; + padding-top: 0.125rem; + .entry-subtitle { + color: var(--color-text-subtle); + font-size: var(--font-size-12); + } + } +} \ No newline at end of file diff --git a/templates/ui/sidebar/actor-document-partial.hbs b/templates/ui/sidebar/actor-document-partial.hbs new file mode 100644 index 00000000..ec261f85 --- /dev/null +++ b/templates/ui/sidebar/actor-document-partial.hbs @@ -0,0 +1,19 @@ +