NPC: restyling

pull/12/head
Matheus Clemente 2024-03-30 20:58:44 -03:00
parent 6416a4462b
commit c4c8f5a68b
4 changed files with 28 additions and 42 deletions

View File

@ -38,7 +38,7 @@ export class CompendiumBrowserVueApplication extends Application {
template: "modules/compendium-browser/templates/vue-compendium-browser.html", template: "modules/compendium-browser/templates/vue-compendium-browser.html",
id: "compendium-browser", id: "compendium-browser",
title: game.i18n.localize("CMPBrowser.compendiumBrowser"), title: game.i18n.localize("CMPBrowser.compendiumBrowser"),
width: 800, width: 600,
height: 730, height: 730,
resizable: true, resizable: true,
}; };

View File

@ -1570,20 +1570,12 @@ class CompendiumBrowser extends Application {
Hooks.once("init", () => { Hooks.once("init", () => {
game.compendiumBrowser = new CompendiumBrowser(); game.compendiumBrowser = new CompendiumBrowser();
}); preloadTemplates();
// @todo hooks are never async.
Hooks.once("init", async () => {
await preloadTemplates();
}); });
Hooks.once("setup", () => { Hooks.once("setup", () => {
registerSettings(); registerSettings();
}); game.compendiumBrowser.setup();
// @todo hooks are never async.
Hooks.once("setup", async () => {
await game.compendiumBrowser.setup();
}); });
/* ---------------------------------------------- */ /* ---------------------------------------------- */

View File

@ -16,7 +16,7 @@
overflow-y: hidden !important; overflow-y: hidden !important;
max-width: 1100px; max-width: 1100px;
max-height: 90vh; max-height: 90vh;
min-width: 630px; min-width: 600px;
min-height: 500px; min-height: 500px;
.window-content { .window-content {
overflow-y: hidden !important; overflow-y: hidden !important;
@ -61,12 +61,7 @@
} }
.control-area { .control-area {
position: sticky; position: sticky;
display: block;
min-width: 250px;
max-width: 45%;
width: 350px;
height: 100%; height: 100%;
padding-right: 5px;
overflow: auto; overflow: auto;
button { button {
background: rgba(0, 0, 0, 0.05); background: rgba(0, 0, 0, 0.05);
@ -132,12 +127,8 @@
} }
.list-area { .list-area {
position: sticky; position: sticky;
display: flex;
min-width: 250px;
max-width: 55%;
width: 400px;
height: 100%; height: 100%;
padding-right: 5px; flex: 2;
.loading { .loading {
flex: 0; flex: 0;
text-align: center; text-align: center;
@ -322,21 +313,19 @@
.npc-line { .npc-line {
line-height: 25px; line-height: 25px;
padding: 9px 0 5px 5px; padding: 9px 0 5px 5px;
}
.npc-name { .npc-name {
font-weight: bold; font-weight: bold;
font-size: 16px; font-size: 16px;
} }
.cr { .npc-tags {
display: inline-block; .bold {
width: 55px; font-weight: bold;
} }
.size { .details {
display: inline-block; flex: 2;
width: 75px; }
} }
.type {
display: inline-block;
} }
} }
} }

View File

@ -90,13 +90,18 @@
<div class="npc-line"> <div class="npc-line">
<!-- First row is the title. --> <!-- First row is the title. -->
<div class="npc-name"> <div class="npc-name">
<a>{{ entry.name }}</a> <a>[{{ game.dnd5e.utils.formatCR(entry.system.details.cr) }}] {{ entry.name }}</a>
</div> </div>
<!-- Second row is supplemental info. --> <!-- Second row is supplemental info. -->
<div class="npc-tags"> <div class="npc-tags flexrow">
<span class="cr" :data-tooltip="game.i18n.localize('Challenge rating')">{{ game.dnd5e.utils.formatCR(entry.system.details.cr) }}</span> <div class="numbers flexrow">
<span class="size">{{ CONFIG.DND5E.actorSizes?.[entry.system.traits.size].label ?? entry.system.traits.size }}</span> <!-- <span class="cr" :data-tooltip="game.i18n.localize('Challenge rating')">CR {{ game.dnd5e.utils.formatCR(entry.system.details.cr) }}</span> -->
<span class="type">{{ CONFIG.DND5E.creatureTypes?.[entry.system.details.type.value]?.label ?? entry.system.details.type.value }}</span> <span class="hp"><span class="bold">HP:</span> {{ entry.system.attributes.hp.max }}</span>
<span class="ac"><span class="bold">AC:</span> {{ entry.system.attributes.ac.flat }}</span>
</div>
<div class="details flexrow">
<span>{{ CONFIG.DND5E.actorSizes?.[entry.system.traits.size].label ?? entry.system.traits.size }} {{ CONFIG.DND5E.creatureTypes?.[entry.system.details.type.value]?.label ?? entry.system.details.type.value }}</span>
</div>
</div> </div>
</div> </div>
</li> </li>