From c8ab4952f4cd59c654e1fb386603ceee3c090d65 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sun, 22 May 2022 20:59:33 +1000 Subject: Display multiple descriptions for compound-nodes --- src/components/TileInfoModal.vue | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'src/components/TileInfoModal.vue') diff --git a/src/components/TileInfoModal.vue b/src/components/TileInfoModal.vue index 0ffeb5c..4e39a4e 100644 --- a/src/components/TileInfoModal.vue +++ b/src/components/TileInfoModal.vue @@ -6,12 +6,15 @@ import type {TolMap} from '../tol'; import {TolNode} from '../tol'; import {capitalizeWords} from '../util'; +type DescData = {text: string, fromRedirect: boolean, wikiId: number, fromDbp: boolean}; + // Represents a node description + // Displays information about a tree-of-life node export default defineComponent({ data(){ return { tolNode: null as null | TolNode, - descObj: null as null | {text: string, fromRedirect: boolean, wikiId: number, fromDbp: boolean}, + descData: null as null | DescData | [DescData, DescData], imgInfo: null as null | {eolId: string, sourceUrl: string, license: string, copyrightOwner: string}, }; }, @@ -59,7 +62,7 @@ export default defineComponent({ .then(obj => { if (obj != null){ this.tolNode = obj.nodeObj; - this.descObj = obj.descObj; + this.descData = obj.descData; this.imgInfo = obj.imgInfo; } }); @@ -93,21 +96,29 @@ export default defineComponent({ -
+
+ (No description found) +
+
- Redirected: {{descObj.fromRedirect}}
- Short-description from {{descObj.fromDbp ? 'DBpedia' : 'Wikipedia'}}
- + Redirected: {{descData.fromRedirect}}
+ Short-description from {{descData.fromDbp ? 'DBpedia' : 'Wikipedia'}}
+
Wikipedia Link

-
- {{descObj.text}} -
+
{{descData.text}}
- (No description found) +
+

{{displayName.substring(1, displayName.indexOf(' + '))}}

+
{{descData[0].text}}
+
+
+

{{displayName.substring(displayName.indexOf(' + ') + 3, displayName.length - 1)}}

+
{{descData[1].text}}
+
-- cgit v1.2.3