From f8d3a75f09a0057e8c80eca7a25e89cee4fc7f47 Mon Sep 17 00:00:00 2001 From: Danilo Alves Date: Mon, 17 Jan 2022 10:27:25 -0300 Subject: [PATCH] =?UTF-8?q?Melhorado=20o=20visual=20e=20feedback=20dos=20c?= =?UTF-8?q?ards=20de=20localiza=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WbotServices/wbotMessageListener.ts | 10 +++------ .../src/components/LocationPreview/index.js | 21 ++++++++++--------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts index 598f723..2ed155b 100644 --- a/backend/src/services/WbotServices/wbotMessageListener.ts +++ b/backend/src/services/WbotServices/wbotMessageListener.ts @@ -3,7 +3,7 @@ import { promisify } from "util"; import { writeFile } from "fs"; import * as Sentry from "@sentry/node"; -import { +import WAWebJS, { Contact as WbotContact, Message as WbotMessage, MessageAck, @@ -130,21 +130,17 @@ const verifyMessage = async ( quotedMsgId: quotedMsg?.id }; - await ticket.update({ lastMessage: msg.type === "location" ? msg.description ? "Localization - " + msg.description.split('\\n')[0] : "Localization" : msg.body }); + await ticket.update({ lastMessage: msg.type === "location" ? msg.location.description ? "Localization - " + msg.location.description.split('\\n')[0] : "Localization" : msg.body }); await CreateMessageService({ messageData }); }; const prepareLocation = (msg: WbotMessage): WbotMessage => { - console.log(msg) let gmapsUrl = "https://maps.google.com/maps?q=" + msg.location.latitude + "%2C" + msg.location.longitude + "&z=17&hl=pt-BR"; msg.body = "data:image/png;base64," + msg.body + "|" + gmapsUrl; - msg.body += "|" + (msg.description != undefined ? msg.description : (msg.location.latitude + ", " + msg.location.longitude)) - - console.log(msg.body) - console.log(msg.description) + msg.body += "|" + (msg.location.description ? msg.location.description : (msg.location.latitude + ", " + msg.location.longitude)) return msg; }; diff --git a/frontend/src/components/LocationPreview/index.js b/frontend/src/components/LocationPreview/index.js index a2dd210..9187faf 100644 --- a/frontend/src/components/LocationPreview/index.js +++ b/frontend/src/components/LocationPreview/index.js @@ -22,18 +22,19 @@ const LocationPreview = ({ image, link, description }) => {
- - - - +
+
+ +
{ description && ( - - +
+
') }}>
- +
)} - +
+
- - +
+
);