From 76b6501b31ae1d6b232d0768758f8cb4cd3b527c Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Thu, 1 Aug 2019 14:39:15 +0200 Subject: [PATCH] Improved library view layout --- app/imports/constants/PROPERTIES.js | 80 +++++++++++++++++++ app/imports/constants/PROPERTY_ICONS.js | 21 ----- .../ui/components/properties/PropertyIcon.vue | 18 +++++ app/imports/ui/components/tree/TreeNode.vue | 10 ++- app/imports/ui/pages/Library.vue | 34 +++++--- .../ui/properties/PropertySelector.vue | 35 ++------ 6 files changed, 133 insertions(+), 65 deletions(-) create mode 100644 app/imports/constants/PROPERTIES.js delete mode 100644 app/imports/constants/PROPERTY_ICONS.js create mode 100644 app/imports/ui/components/properties/PropertyIcon.vue diff --git a/app/imports/constants/PROPERTIES.js b/app/imports/constants/PROPERTIES.js new file mode 100644 index 00000000..60723516 --- /dev/null +++ b/app/imports/constants/PROPERTIES.js @@ -0,0 +1,80 @@ +const PROPERTIES = Object.freeze({ + action: { + icon: 'offline_bolt', + name: 'Action' + }, + attribute: { + icon: 'donut_small', + name: 'Attribute' + }, + buff: { + icon: 'star', + name: 'Buff' + }, + classLevel: { + icon: 'school', + name: 'Class level' + }, + damageMultiplier: { + icon: 'layers', + name: 'Damage multiplier' + }, + effect: { + icon: 'show_chart', + name: 'Effect' + }, + experience: { + icon: 'add', + name: 'Experience' + }, + feature: { + icon: 'subject', + name: 'Feature' + }, + folder: { + icon: 'folder', + name: 'Folder' + }, + note: { + icon: 'note', + name: 'Note' + }, + proficiency: { + icon: 'radio_button_checked', + name: 'Proficiency' + }, + roll: { + icon: 'flare', + name: 'Roll' + }, + skill: { + icon: 'check_box', + name: 'Skill' + }, + spellList: { + icon: 'list', + name: 'Spell list' + }, + spell: { + icon: 'whatshot', + name: 'Spell' + }, + container: { + icon: 'work', + name: 'Container' + }, + item: { + icon: 'category', + name: 'Item' + }, +}); + +export default PROPERTIES; + +export function getPropertyName(type){ + return type && PROPERTIES[type] && PROPERTIES[type].name; +} + +export function getPropertyIcon(type){ + return type && PROPERTIES[type] && PROPERTIES[type].icon; +} diff --git a/app/imports/constants/PROPERTY_ICONS.js b/app/imports/constants/PROPERTY_ICONS.js deleted file mode 100644 index 7e8a711b..00000000 --- a/app/imports/constants/PROPERTY_ICONS.js +++ /dev/null @@ -1,21 +0,0 @@ -const PROPERTY_ICONS = Object.freeze({ - action: 'offline_bolt', - attribute: 'donut_small', - buff: 'star', - classLevel: 'school', - damageMultiplier: 'layers', - effect: 'show_chart', - experience: 'add', - feature: 'subject', - folder: 'folder', - note: 'note', - proficiency: 'radio_button_checked', - roll: 'flare', - skill: 'check_box', - spellList: 'list', - spell: 'whatshot', - container: 'work', - item: 'category', -}); - -export default PROPERTY_ICONS; diff --git a/app/imports/ui/components/properties/PropertyIcon.vue b/app/imports/ui/components/properties/PropertyIcon.vue new file mode 100644 index 00000000..abec4576 --- /dev/null +++ b/app/imports/ui/components/properties/PropertyIcon.vue @@ -0,0 +1,18 @@ + + + diff --git a/app/imports/ui/components/tree/TreeNode.vue b/app/imports/ui/components/tree/TreeNode.vue index c5b8189d..3d04e91d 100644 --- a/app/imports/ui/components/tree/TreeNode.vue +++ b/app/imports/ui/components/tree/TreeNode.vue @@ -28,11 +28,12 @@ :class="selected && 'primary--text'" :disabled="expanded" >drag_handle - {{icon(node.type)}} + />
{{node && node.name}}
@@ -62,12 +63,15 @@ * the tree view shows off the full character structure, and where each part of * character comes from. **/ - import PROPERTY_ICONS from '/imports/constants/PROPERTY_ICONS.js'; + import PropertyIcon from '/imports/ui/components/properties/PropertyIcon.vue'; export default { name: 'tree-node', beforeCreate() { this.$options.components.TreeNodeList = require('./TreeNodeList.vue').default }, + components: { + PropertyIcon, + }, data(){ return { expanded: false, }}, diff --git a/app/imports/ui/pages/Library.vue b/app/imports/ui/pages/Library.vue index cfc0ff64..c0f9469d 100644 --- a/app/imports/ui/pages/Library.vue +++ b/app/imports/ui/pages/Library.vue @@ -9,14 +9,14 @@
- + - - - reorder - Organize - - +
- - - +
+ + +
+ {{getPropertyName(selectedNode && selectedNode.type)}} +
+
+ + + +
- - + +
- {{ icon(property.type) }} + {{property.icon}}

{{ property.name }} @@ -18,34 +18,11 @@