From f19d8cd568ca0a833599104d2a567ef88b216a05 Mon Sep 17 00:00:00 2001 From: Salman Dabbakuti <29351207+Salmandabbakuti@users.noreply.github.com> Date: Tue, 10 Sep 2024 19:33:02 +0530 Subject: [PATCH] refactored: conditional stream activity details --- client/app/components/ActivityDrawer.jsx | 40 +++++++++++------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/client/app/components/ActivityDrawer.jsx b/client/app/components/ActivityDrawer.jsx index 936ae25..9fcb470 100644 --- a/client/app/components/ActivityDrawer.jsx +++ b/client/app/components/ActivityDrawer.jsx @@ -126,39 +126,37 @@ export default function ActivityDrawer() { : parseInt(flowRateInTokenPerMonth).toFixed(2); let title = ""; + let description = ""; switch (item.type) { case "CREATE": title = "Stream Created"; + description = `${flowRatePerMonth} ${ + tokenData?.symbol + }/mo stream opened from ${ellipsisAddress( + item?.stream?.sender + )} to ${ellipsisAddress(item?.stream?.receiver)}`; break; case "UPDATE": title = "Stream Updated"; + description = `${ + tokenData?.symbol + } Stream from ${ellipsisAddress( + item?.stream?.sender + )} to ${ellipsisAddress( + item?.stream?.receiver + )} is updated to ${flowRatePerMonth} ${tokenData?.symbol}/mo`; break; case "DELETE": title = "Stream Cancelled"; + description = `${ + tokenData?.symbol + } Stream from ${ellipsisAddress( + item?.stream?.sender + )} to ${ellipsisAddress(item?.stream?.receiver)} is cancelled`; break; default: title = "Unknown Activity"; - } - - let description = ""; - if (item?.type === "CREATE") { - description = `${flowRatePerMonth} ${ - tokenData?.symbol - }/mo opened from ${ellipsisAddress( - item?.stream?.sender - )} to ${ellipsisAddress(item?.stream?.receiver)}`; - } else if (item.type === "UPDATE") { - description = `Stream from ${ellipsisAddress( - item?.stream?.sender - )} to ${ellipsisAddress( - item?.stream?.receiver - )} is updated to ${flowRatePerMonth}`; - } else { - description = `Stream from ${ellipsisAddress( - item?.stream?.sender - )} to ${ellipsisAddress( - item?.stream?.receiver - )} has been cancelled`; + description = "No information available"; } return (