Skip to content

Commit

Permalink
refactored: conditional stream activity details
Browse files Browse the repository at this point in the history
  • Loading branch information
Salmandabbakuti committed Sep 10, 2024
1 parent e0c681f commit f19d8cd
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions client/app/components/ActivityDrawer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit f19d8cd

Please sign in to comment.