From 2737e8c1a22fbc29231d9ecbdccf4409e61a08a9 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 22 May 2021 03:52:25 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Add=20display=20method=20to=20Co?= =?UTF-8?q?ndition=20objects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nest_frontend/objects/Condition.js | 47 ++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/nest_frontend/objects/Condition.js b/nest_frontend/objects/Condition.js index 2754676..aa94979 100644 --- a/nest_frontend/objects/Condition.js +++ b/nest_frontend/objects/Condition.js @@ -1,4 +1,11 @@ -import { IconDefinition, faQuestionCircle } from "@fortawesome/free-solid-svg-icons" +import { + IconDefinition, + faQuestionCircle, + faHashtag, + faAt, + faClock, + faLocationArrow, +} from "@fortawesome/free-solid-svg-icons" /** @@ -40,7 +47,7 @@ export class Condition { color: "Grey", icon: faQuestionCircle, title: this.id, - content: this.content, + children: this.content, } } } @@ -53,6 +60,15 @@ export class ConditionHashtag extends Condition { constructor(hashtag, id = null) { super(0, hashtag, id) } + + display() { + return { + color: "Grey", + icon: faHashtag, + title: this.id, + children: this.content, + } + } } @@ -63,6 +79,15 @@ export class ConditionUser extends Condition { constructor(user, id = null) { super(5, user, id) } + + display() { + return { + color: "Green", + icon: faAt, + title: this.id, + children: this.content, + } + } } @@ -76,6 +101,15 @@ export class ConditionTime extends Condition { super(2, timeRay.toString(), id) this.timeRay = timeRay } + + display() { + return { + color: "Yellow", + icon: faClock, + title: this.id, + children: this.content, + } + } } @@ -89,4 +123,13 @@ export class ConditionLocation extends Condition { super(3, mapArea.toString(), id) this.mapArea = mapArea } + + display() { + return { + color: "Red", + icon: faLocationArrow, + title: this.id, + children: this.mapArea.toHumanString(), + } + } }