Get most of the Untyped item implemented and functioning

This commit is contained in:
Oliver-Akins 2024-03-21 21:18:51 -06:00
parent a383225b8c
commit 6a355e63c0
7 changed files with 180 additions and 37 deletions

View file

@ -48,12 +48,32 @@
"actor": {
"v2": {
"stat-not-chosen": "Select a dice to see the {name} skills",
"skill-roll-locked": "@dotdungeon.trainingLevel.locked"
"skill-roll-locked": "@dotdungeon.trainingLevel.locked",
"toggle-item-information": "Toggle the item's extra information visibility"
}
},
"item": {
"untyped": {
"quantity": "Quantity",
"usage": "Usage Cost",
"rarity": "Tier",
"no-description": "This item hasn't been described yet..."
}
}
},
"rarity": {
"simple": "Simple",
"greater": "Greater",
"rare": "Rare",
"legendary": "Legendary"
},
"default": {
"name": "(Unnamed @TYPES.{document}.{type})"
},
"common": {
"send-to-chat": "Send to Chat",
"edit": "Edit",
"delete": "Delete"
}
},
"TYPES": {

View file

@ -118,8 +118,9 @@ export class GenericActorSheet extends ActorSheet {
};
async openEmbeddedSheet($event) {
const data = $event.target.dataset;
const data = $event.currentTarget.dataset;
let item = await fromUuid(data.embeddedEdit);
console.log(data)
item?.sheet.render(true);
};

View file

@ -1,6 +1,8 @@
import { localizerConfig } from "../config.mjs";
export function localizer(key, args = {}, depth = 0) {
if (key instanceof Handlebars.SafeString) key = key.toString();
/** @type {string} */
let localized = game.i18n.format(key, args);
const subkeys = localized.matchAll(localizerConfig.subKeyPattern);

View file

@ -94,7 +94,6 @@
}
}
.item-list {
.material-list {
display: grid;
grid-template-columns: 1fr 1fr;
@ -106,7 +105,6 @@
gap: 8px;
flex-direction: column;
}
}
.material {
@include material.elevate(1);
@ -140,6 +138,10 @@
@include material.elevate(4);
color: var(--inventory-material-hover-color);
}
&:focus-visible {
box-shadow: 0 0 10px var(--color-shadow-highlight);
}
}
&__input {
@ -173,8 +175,15 @@
gap: 8px;
align-items: center;
&:hover {
cursor: pointer;
}
button {
color: var(--inventory-material-color);
&:focus-visible {
box-shadow: 0 0 10px var(--color-shadow-highlight);
}
}
}
&__name {
@ -185,45 +194,86 @@
&__content {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr)) min-content;
grid-template-rows: repeat(3, min-content) auto;
grid-template-columns: repeat(3, minmax(0, 1fr)) 2.25rem;
grid-template-rows: repeat(3, 2.25rem) auto;
gap: 8px;
padding: 4px;
}
&__button {
@include material.elevate(2);
padding: 0px;
&:hover {
@include material.elevate(4);
}
&:focus-visible {
box-shadow: 0 0 10px var(--color-shadow-highlight);
}
&--send-to-chat {
@extend .untyped__button;
color: var(--inventory-untyped-send-to-chat-color);
}
&--edit {
@extend .untyped__button;
color: var(--inventory-untyped-edit-color);
}
&--delete {
@extend .untyped__button;
color: var(--inventory-untyped-delete-color);
background: var(--inventory-untyped-delete-bg);
&:hover {
background: var(--inventory-untyped-delete-bg-hover);
}
}
}
&__usage, &__tier {
@include material.elevate(1);
color: var(--inventory-untyped-card-color);
padding: 8px;
display: flex;
align-items: center
}
button {
@include material.elevate(2);
&:hover {
@include material.elevate(4);
}
align-items: center;
justify-content: space-between;
border-radius: 4px;
}
&__quantity--edit {
@include material.elevate(1);
display: grid;
grid-template-columns: minmax(0, 1fr) 40px;
max-width: 100%;
display: flex;
flex-direction: row;
align-items: center;
padding: 8px;
justify-content: space-between;
padding: 0px 8px;
gap: 4px;
border-radius: 4px;
> :first-child {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
input {
@include material.elevate(2);
font-family: var(--input-font);
font-size: var(--inventory-untyped-quantity-font-size);
width: 50px;
text-align: center;
border-radius: 4px;
padding: 5px 7px;
color: inherit;
}
}
&__description {
@include material.elevate(1);
color: var(--inventory-untyped-description-color);
margin: 0;
grid-row: span 3;
grid-column: span 3;
padding: 8px;
border-radius: 4px;
}
}
}

View file

@ -4,10 +4,12 @@ $background: #0a0a0a;
$surface: #121212;
$primary: #005300;
$secondary: #6c056c;
$danger: red;
$on-background: $t;
$on-surface: white;
$on-primary: $t;
$on-secondary: $t;
$on-danger: black;
$title-font: 'Pixelify Sans', sans-serif;
$body-font: sans-serif;
@ -56,5 +58,14 @@ $body-font: sans-serif;
--inventory-material-focus-color: white;
/* Untyped (custom) inventory item details */
--inventory-untyped-color: white;
--inventory-untyped-description-color: white;
--inventory-untyped-card-color: white;
--inventory-untyped-send-to-chat-color: white;
--inventory-untyped-edit-color: white;
--inventory-untyped-delete-color: white;
--inventory-untyped-delete-bg: color-mix(in lab, #{$danger} 30%, #{$surface});
--inventory-untyped-delete-bg-hover: color-mix(in lab, #{$danger} 37%, #{$surface});;
--inventory-untyped-quantity-font-size: 14px;
--inventory-untyped-quantity-color: white;
--inventory-untyped-quantity-input-color: white;
}

View file

@ -62,6 +62,10 @@
}
}
span.placeholder {
opacity: 60%;
}
.page-content {
padding: 16px;
padding-bottom: 69px;

View file

@ -7,7 +7,8 @@
type="button"
class="equal-padding reduced-padding"
data-collapse-id="{{item.uuid}}"
aria-label="Toggle the extra information's visibility"
tabindex="0"
aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}"
>
<div aria-hidden="true" class="icon icon--12">
{{#if (dd-set-has meta.expanded item.uuid)}}
@ -28,20 +29,74 @@
<hr>
<div class="untyped__content">
<div class="untyped__quantity--edit">
<label for="">
<label for="{{meta.idp}}-{{item.uuid}}-quantity">
Quantity
</label>
<input
type="number"
min="0"
id="{{meta.idp}}-{{item.uuid}}-quantity"
value="{{item.system.quantity}}"
data-embedded-id="{{item.uuid}}"
data-embedded-update="system.quantity"
data-embedded-update-on="blur"
>
</div>
<div class="untyped__usage">Usage Cost</div>
<div class="untyped__tier">Tier</div>
<button type="button">C</button>
<p class="untyped__description">Description</p>
<button type="button">E</button>
<button type="button">D</button>
<div class="untyped__usage">
<span>Usage Cost:</span>
<span>
{{dd-empty-state item.system.usage}}
</span>
</div>
<div class="untyped__tier">
<span>Tier:</span>
<span>{{dd-i18n (concat "dotdungeon.rarity." item.system.tier)}}</span>
</div>
<button
type="button"
aria-label="{{dd-i18n 'dotdungeon.common.send-to-chat'}}"
data-tooltip="{{dd-i18n 'dotdungeon.common.send-to-chat'}}"
data-tooltip-direction="RIGHT"
class="untyped__button--send-to-chat"
>
<div aria-hidden="true" class="icon icon--20">
{{{ icons.chat-bubble }}}
</div>
</button>
<p class="untyped__description">
{{#if item.system.description}}
{{item.system.description}}
{{else}}
<span class="placeholder">
This item hasn't been described yet...
</span>
{{/if}}
</p>
<button
type="button"
aria-label="{{dd-i18n 'dotdungeon.common.edit'}}"
data-tooltip="{{dd-i18n 'dotdungeon.common.edit'}}"
data-tooltip-direction="RIGHT"
class="untyped__button--edit"
data-embedded-edit="{{item.uuid}}"
>
<div aria-hidden="true" class="icon icon--20">
{{{ icons.edit }}}
</div>
</button>
<button
type="button"
aria-label="{{dd-i18n 'dotdungeon.common.delete'}}"
data-tooltip="{{dd-i18n 'dotdungeon.common.delete'}}"
data-tooltip-direction="RIGHT"
class="untyped__button--delete"
data-embedded-delete
data-embedded-id="{{item.uuid}}"
>
<div aria-hidden="true" class="icon icon--20">
{{{ icons.garbage-bin }}}
</div>
</button>
</div>
{{/if}}
</section>