From 3d31d62860b1c5ecb9688ca9a774cd7e8e42bd6e Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 9 Nov 2022 14:58:52 +0200 Subject: [PATCH] Completed folder stat grouping UI --- app/imports/api/properties/Attributes.js | 3 +- .../character/characterSheetTabs/StatsTab.vue | 133 ++++++++++-------- .../components/attributes/AttributeCard.vue | 71 +--------- .../attributes/AttributeCardContent.vue | 97 +++++++++++++ .../components/attributes/HealthBar.vue | 104 ++++++-------- .../components/attributes/HealthBarCard.vue | 8 +- .../components/attributes/ResourceCard.vue | 85 ++--------- .../attributes/ResourceCardContent.vue | 89 ++++++++++++ .../attributes/SpellSlotListTile.vue | 1 - .../components/buffs/BuffListItem.vue | 30 ++++ .../components/folders/FolderGroupCard.vue | 70 +++++++-- .../ActionGroupComponent.vue | 35 +++++ .../AttributeGroupComponent.vue | 95 +++++++++++++ .../folders/propertyComponentIndex.js | 30 ++-- .../components/inventory/ItemListTile.vue | 2 +- 15 files changed, 559 insertions(+), 294 deletions(-) create mode 100644 app/imports/ui/properties/components/attributes/AttributeCardContent.vue create mode 100644 app/imports/ui/properties/components/attributes/ResourceCardContent.vue create mode 100644 app/imports/ui/properties/components/buffs/BuffListItem.vue create mode 100644 app/imports/ui/properties/components/folders/folderGroupComponents/ActionGroupComponent.vue create mode 100644 app/imports/ui/properties/components/folders/folderGroupComponents/AttributeGroupComponent.vue diff --git a/app/imports/api/properties/Attributes.js b/app/imports/api/properties/Attributes.js index 28f79243..94e5d657 100644 --- a/app/imports/api/properties/Attributes.js +++ b/app/imports/api/properties/Attributes.js @@ -28,8 +28,7 @@ let AttributeSchema = createPropertySchema({ 'stat', // Speed, Armor Class 'modifier', // Proficiency Bonus, displayed as +x 'hitDice', // d12 hit dice - 'healthBar', // Hitpoints, Temporary Hitpoints, can take damage - 'bar', // Displayed as a health bar, can't take damage + 'healthBar', // Hitpoints, Temporary Hitpoints 'resource', // Rages, sorcery points 'spellSlot', // Level 1, 2, 3... spell slots 'utility', // Aren't displayed, Jump height, Carry capacity diff --git a/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue b/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue index 32f1b3c2..78847e45 100644 --- a/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue +++ b/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue @@ -1,14 +1,29 @@ - - diff --git a/app/imports/ui/properties/components/attributes/AttributeCardContent.vue b/app/imports/ui/properties/components/attributes/AttributeCardContent.vue new file mode 100644 index 00000000..439ad70f --- /dev/null +++ b/app/imports/ui/properties/components/attributes/AttributeCardContent.vue @@ -0,0 +1,97 @@ + + + + + \ No newline at end of file diff --git a/app/imports/ui/properties/components/attributes/HealthBar.vue b/app/imports/ui/properties/components/attributes/HealthBar.vue index da4bbb7d..cc83302b 100644 --- a/app/imports/ui/properties/components/attributes/HealthBar.vue +++ b/app/imports/ui/properties/components/attributes/HealthBar.vue @@ -6,7 +6,7 @@ style="min-height: 42px;" :class="{ hover }" class="my-1 health-bar" - :data-id="_id" + :data-id="model._id" >
- {{ name }} + {{ model.name }}
- {{ value }} / {{ maxValue }} + {{ model.value }} / {{ model.total }}
- + - - -
- + @@ -104,31 +99,9 @@ export default { }, }, props: { - value: { - type: Number, - default: undefined, - }, - maxValue: { - type: Number, - default: undefined, - }, - name: { - type: String, - default: undefined, - }, - color: { - type: String, - default() { - return this.$vuetify.theme.currentTheme.primary - }, - }, - midColor: { - type: String, - default: undefined, - }, - lowColor: { - type: String, - default: undefined, + model: { + type: Object, + required: true, }, _id: String, }, @@ -136,24 +109,29 @@ export default { return { editing: false, hover: false, + x: 0, + y: 0, }; }, computed: { fillFraction() { - let fraction = this.value / this.maxValue; + let fraction = this.model.value / this.model.total; if (fraction < 0) fraction = 0; if (fraction > 1) fraction = 1; return fraction; }, + color() { + return this.model.color || this.$vuetify.theme.currentTheme.primary + }, barColor() { - const fraction = this.value / this.maxValue; + const fraction = this.model.value / this.model.total; if (!Number.isFinite(fraction)) return this.color; if (fraction > 0.5) { return this.color; - } else if (this.midColor && this.lowColor) { - return chroma.mix(this.lowColor, this.midColor, fraction * 2).hex(); - } else if (this.midColor) { - return this.midColor; + } else if (this.model.healthBarColorMid && this.model.healthBarColorLow) { + return chroma.mix(this.model.healthBarColorLow, this.model.healthBarColorMid, fraction * 2).hex(); + } else if (this.model.healthBarColorMid) { + return this.model.healthBarColorMid; } return this.color; }, @@ -166,7 +144,7 @@ export default { isTextLight() { return isDarkColor(this.barBackgroundColor); /* Change color at the halfway mark - const fraction = this.value / this.maxValue; + const fraction = this.model.value / this.model.total; if (fraction >= 0.5){ return isDarkColor(this.barColor); } else { @@ -176,8 +154,14 @@ export default { } }, methods: { - edit() { - this.editing = true; + edit(e) { + e.preventDefault() + this.editing = false; + this.x = e.clientX - 165; + this.y = e.clientY - 24; + this.$nextTick(() => { + this.editing = true + }); }, cancelEdit() { this.editing = false; @@ -199,6 +183,10 @@ export default { z-index: 7; position: relative; } + +.no-menu-shadow { + box-shadow: none !important; +} diff --git a/app/imports/ui/properties/components/attributes/ResourceCardContent.vue b/app/imports/ui/properties/components/attributes/ResourceCardContent.vue new file mode 100644 index 00000000..1f9de91f --- /dev/null +++ b/app/imports/ui/properties/components/attributes/ResourceCardContent.vue @@ -0,0 +1,89 @@ + + + + + \ No newline at end of file diff --git a/app/imports/ui/properties/components/attributes/SpellSlotListTile.vue b/app/imports/ui/properties/components/attributes/SpellSlotListTile.vue index 584fc765..f4a00384 100644 --- a/app/imports/ui/properties/components/attributes/SpellSlotListTile.vue +++ b/app/imports/ui/properties/components/attributes/SpellSlotListTile.vue @@ -61,7 +61,6 @@ export default { required: true, }, dark: Boolean, - hideCastButton: Boolean, disabled: Boolean, }, computed: { diff --git a/app/imports/ui/properties/components/buffs/BuffListItem.vue b/app/imports/ui/properties/components/buffs/BuffListItem.vue new file mode 100644 index 00000000..b122f33c --- /dev/null +++ b/app/imports/ui/properties/components/buffs/BuffListItem.vue @@ -0,0 +1,30 @@ + + + \ No newline at end of file diff --git a/app/imports/ui/properties/components/folders/FolderGroupCard.vue b/app/imports/ui/properties/components/folders/FolderGroupCard.vue index 34662396..a216c8a6 100644 --- a/app/imports/ui/properties/components/folders/FolderGroupCard.vue +++ b/app/imports/ui/properties/components/folders/FolderGroupCard.vue @@ -1,15 +1,25 @@ \ No newline at end of file + + + \ No newline at end of file diff --git a/app/imports/ui/properties/components/folders/folderGroupComponents/ActionGroupComponent.vue b/app/imports/ui/properties/components/folders/folderGroupComponents/ActionGroupComponent.vue new file mode 100644 index 00000000..7bcb81da --- /dev/null +++ b/app/imports/ui/properties/components/folders/folderGroupComponents/ActionGroupComponent.vue @@ -0,0 +1,35 @@ + + + \ No newline at end of file diff --git a/app/imports/ui/properties/components/folders/folderGroupComponents/AttributeGroupComponent.vue b/app/imports/ui/properties/components/folders/folderGroupComponents/AttributeGroupComponent.vue new file mode 100644 index 00000000..30677f39 --- /dev/null +++ b/app/imports/ui/properties/components/folders/folderGroupComponents/AttributeGroupComponent.vue @@ -0,0 +1,95 @@ + + + + + \ No newline at end of file diff --git a/app/imports/ui/properties/components/folders/propertyComponentIndex.js b/app/imports/ui/properties/components/folders/propertyComponentIndex.js index 4b8ed64a..b61d0181 100644 --- a/app/imports/ui/properties/components/folders/propertyComponentIndex.js +++ b/app/imports/ui/properties/components/folders/propertyComponentIndex.js @@ -1,27 +1,27 @@ -import action from '/imports/ui/properties/components/actions/EventButton.vue'; +import action from '/imports/ui/properties/components/folders/folderGroupComponents/ActionGroupComponent.vue'; //import adjustment from ''; -import attribute from '/imports/ui/properties/components/attributes/SpellSlotListTile.vue'; -//import buff from ''; +import attribute from './folderGroupComponents/AttributeGroupComponent.vue'; +import buff from '/imports/ui/properties/components/buffs/BuffListItem.vue'; //import buffRemover from ''; //import branch from ''; //import constant from ''; -//import container from ''; +import container from '/imports/ui/properties/components/inventory/ContainerCard.vue'; //import classComponent from ''; //import classLevel from ''; //import damage from ''; //import damageMultiplier from ''; //import effect from ''; -//import feature from ''; -//import folder from ''; -//import item from ''; -//import note from ''; +import feature from '/imports/ui/properties/components/features/FeatureCard.vue'; +// import folder from ''; +import item from '/imports/ui/properties/components/inventory/ItemListTile.vue'; +import note from '/imports/ui/properties/components/persona/NoteCard.vue'; //import pointBuy from ''; //import proficiency from ''; //import propertySlot from ''; //import reference from ''; //import roll from ''; //import savingThrow from ''; -//import skill from ''; +import skill from '/imports/ui/properties/components/skills/SkillListTile.vue'; //import slotFiller from ''; //import spellList from ''; //import spell from ''; @@ -32,27 +32,27 @@ export default { action, //adjustment, attribute, - //buff, + buff, //buffRemover, //branch, //constant, - //container, + container, //class: classComponent, //classLevel, //damage, //damageMultiplier, //effect, - //feature, + feature, //folder, - //item, - //note, + item, + note, //pointBuy, //proficiency, //propertySlot, //reference, //roll, //savingThrow, - //skill, + skill, //slotFiller, //spellList, //spell, diff --git a/app/imports/ui/properties/components/inventory/ItemListTile.vue b/app/imports/ui/properties/components/inventory/ItemListTile.vue index 5dfa1b8e..72fb09c6 100644 --- a/app/imports/ui/properties/components/inventory/ItemListTile.vue +++ b/app/imports/ui/properties/components/inventory/ItemListTile.vue @@ -32,7 +32,7 @@ @change="changeQuantity" /> - +