From 12b56907d967e8862318dfc03189bbd91f707a31 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 Date: Tue, 28 Nov 2023 14:44:02 +0530 Subject: [PATCH] add notification item code --- src/DevGov/Notification/Item/Left.jsx | 42 ++++++++++++++++++++++++++ src/DevGov/Notification/Item/Right.jsx | 28 +++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 src/DevGov/Notification/Item/Left.jsx create mode 100644 src/DevGov/Notification/Item/Right.jsx diff --git a/src/DevGov/Notification/Item/Left.jsx b/src/DevGov/Notification/Item/Left.jsx new file mode 100644 index 000000000..82c31f02a --- /dev/null +++ b/src/DevGov/Notification/Item/Left.jsx @@ -0,0 +1,42 @@ +/* INCLUDE: "common.jsx" */ +function href(widgetName, linkProps) { + linkProps = { ...linkProps }; + + if (props.referral) { + linkProps.referral = props.referral; + } + + const linkPropsQuery = Object.entries(linkProps) + .filter(([_key, nullable]) => (nullable ?? null) !== null) + .map(([key, value]) => `${key}=${value}`) + .join("&"); + + return `/#/${REPL_DEVHUB}/widget/devhub.page.${widgetName}${ + linkPropsQuery ? "?" : "" + }${linkPropsQuery}`; +} +/* END_INCLUDE: "common.jsx" */ + +if (!props.type) { + return "Loading ..."; +} + +const type = props.type.split("/")[1]; +return props.type ? ( + <> + {type == "like" + ? "liked your" + : type == "reply" + ? "replied to your" + : type == "edit" + ? "edited your" + : type == "mention" + ? "mentioned you in their" + : "???"}{" "} + + DevHub post + + +) : ( + "Loading ..." +); diff --git a/src/DevGov/Notification/Item/Right.jsx b/src/DevGov/Notification/Item/Right.jsx new file mode 100644 index 000000000..d3c07deac --- /dev/null +++ b/src/DevGov/Notification/Item/Right.jsx @@ -0,0 +1,28 @@ +/* INCLUDE: "common.jsx" */ +function href(widgetName, linkProps) { + linkProps = { ...linkProps }; + + if (props.referral) { + linkProps.referral = props.referral; + } + + const linkPropsQuery = Object.entries(linkProps) + .filter(([_key, nullable]) => (nullable ?? null) !== null) + .map(([key, value]) => `${key}=${value}`) + .join("&"); + + return `/#/${REPL_DEVHUB}/widget/devhub.page.${widgetName}${ + linkPropsQuery ? "?" : "" + }${linkPropsQuery}`; +} +/* END_INCLUDE: "common.jsx" */ + +return props.post === undefined ? ( + "Loading ..." +) : ( + <> + + View DevHub post + + +);