From 7e14c432332857916fbd180cb7f883aed58e52bf Mon Sep 17 00:00:00 2001 From: Dmitriy <34593263+shelegdmitriy@users.noreply.github.com> Date: Tue, 19 Mar 2024 18:38:45 +0200 Subject: [PATCH 1/3] chore: events page qa improvements (#714) --- src/Events/Card.jsx | 14 +++--- src/Events/CardLarge.jsx | 23 ++++++---- src/Events/Index.jsx | 94 ++++++++++++++++++++-------------------- 3 files changed, 70 insertions(+), 61 deletions(-) diff --git a/src/Events/Card.jsx b/src/Events/Card.jsx index 6e26a93b..d4b6abdf 100644 --- a/src/Events/Card.jsx +++ b/src/Events/Card.jsx @@ -161,14 +161,14 @@ return ( - + {title} - - + + - - + + {startAt} {startAt !== endAt && " -"} @@ -179,9 +179,9 @@ return ( )} - + - + {location} diff --git a/src/Events/CardLarge.jsx b/src/Events/CardLarge.jsx index 7a2fb735..9bc84bda 100644 --- a/src/Events/CardLarge.jsx +++ b/src/Events/CardLarge.jsx @@ -168,17 +168,24 @@ return ( - + {title} - + {description} - - + + - - + + {startAt} {startAt !== endAt && " -"} @@ -189,9 +196,9 @@ return ( )} - + - + {location} diff --git a/src/Events/Index.jsx b/src/Events/Index.jsx index dea9faa7..600954a3 100644 --- a/src/Events/Index.jsx +++ b/src/Events/Index.jsx @@ -15,7 +15,7 @@ const [dataLoaded, setDataLoaded] = useState(false); const fetchEvents = () => { fetchEventsList().then((eventsData) => { const { entries: events, hasMore } = eventsData; - const sortEvents = events.sort((a, b) => new Date(a.event.start_at) - new Date(b.event.start_at)); + const sortEvents = [...events].sort((a, b) => new Date(a.event.start_at) - new Date(b.event.start_at)); setEventsList(sortEvents); setMoreEvents(hasMore); setDataLoaded(true); @@ -204,11 +204,17 @@ const IconCircle = styled.div` } `; -const featuredEvent = - eventsList.length > 0 && - [...eventsList].sort( - (a, b) => Math.abs(new Date(a.event.start_at) - new Date()) - Math.abs(new Date(b.event.start_at) - new Date()), - )[0].event; +const featuredEvent = !dataLoaded + ? eventsList[0] + : eventsList.length > 0 && + [...eventsList].sort( + (a, b) => Math.abs(new Date(a.event.start_at) - new Date()) - Math.abs(new Date(b.event.start_at) - new Date()), + )[0].event; + +// remove featured event from events list to avoid duplicate +const eventsListFiltered = !dataLoaded + ? eventsList + : (eventsList.length > 0 && eventsList.filter((event) => event.api_id !== featuredEvent.api_id)) || []; return ( @@ -230,7 +236,7 @@ return ( {featuredEvent && (
- + Upcoming Event @@ -257,29 +263,29 @@ return (
)} -
- - - - Our Events - - {moreEvents && ( - - )} - + {eventsListFiltered.length > 0 && ( +
+ + + + Our Events + + {moreEvents && ( + + )} + - {eventsList.length > 0 ? ( - {eventsList.map(({ event }) => { + {eventsListFiltered.map(({ event }) => { const startAt = convertData(event?.start_at); const endAt = convertData(event?.end_at); const location = formatLocation(event.geo_address_json); @@ -302,28 +308,24 @@ return ( ); })} - ) : ( + +
+ )} + + {eventsListFiltered.length === 0 && ( +
+ - - There are no upcoming events at the moment. + + New events coming soon! - + Subscribe to our Luma calendar to stay up to date with our events. - - )} - -
+
+
+ )}
@@ -337,7 +339,7 @@ return ( Hosting an event? - + Do you want your NEAR community event posted here? Submit your event details via Luma to be considered. From 92a89856e8e25d46ef4792f0708d62ec0d26be26 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Wed, 20 Mar 2024 02:22:24 +0530 Subject: [PATCH 2/3] Added devhub proposal notification (#692) --- src/NearOrg/Notifications/Notification.jsx | 10 ++++--- src/NearOrg/Notifications/utils.jsx | 31 +++++++++++++++++++--- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/NearOrg/Notifications/Notification.jsx b/src/NearOrg/Notifications/Notification.jsx index 4f4f0e6f..f0d85ca9 100644 --- a/src/NearOrg/Notifications/Notification.jsx +++ b/src/NearOrg/Notifications/Notification.jsx @@ -134,12 +134,15 @@ const Left = styled.div` const Right = styled.div``; let { blockHeight, accountId, manageNotification, permission, value } = props; -let { item, type, post, message } = value; +let { item, type, post, message, proposal, notifier } = value; item = item ?? {}; -post = post ?? {}; +post = post ?? proposal ?? {}; message = message ?? ""; const path = item.path || ""; - +const showAuthorProfile = type == "devhub/mention" || type == "devhub/edit"; +if (showAuthorProfile) { + accountId = notifier; +} const profile = props.profile || Social.get(`${accountId}/profile/**`, "final"); const profileUrl = `/${REPL_ACCOUNT}/widget/ProfilePage?accountId=${accountId}`; @@ -147,6 +150,7 @@ const profileUrl = `/${REPL_ACCOUNT}/widget/ProfilePage?accountId=${accountId}`; // which means it's not actionable // as for example "like", "comment", "star", "custom", // "devgovgigs/mention", "devgovgigs/edit", "devgovgigs/reply", "devgovgigs/like" +// "devhub/mention", "devhub/edit", "devhub/reply", "devhub/like" const ordinaryNotification = ["follow", "unfollow", "poke"].indexOf(type) >= 0; // Assert is a valid type diff --git a/src/NearOrg/Notifications/utils.jsx b/src/NearOrg/Notifications/utils.jsx index a8397378..8c86d5d6 100644 --- a/src/NearOrg/Notifications/utils.jsx +++ b/src/NearOrg/Notifications/utils.jsx @@ -4,12 +4,13 @@ function createNotificationMessage(notificationType, path, postValue, customMess const isComment = path.indexOf("/post/comment") > 0 || notificationType === "comment"; const isPost = !isComment && path.indexOf("/post/main") > 0; - const getDevHubParentId = postValue + const getDevHubPostParentId = postValue ? Near.view("devgovgigs.near", "get_parent_id", { post_id: postValue, }) : undefined; - const isDevHubPost = getDevHubParentId === null; + + const isDevHubPost = getDevHubPostParentId === null; switch (notificationType) { case "like": @@ -21,9 +22,13 @@ function createNotificationMessage(notificationType, path, postValue, customMess case "comment": case "devgovgigs/reply": return "replied to your post"; + case "devhub/reply": + return "replied to your proposal"; case "mention": case "devgovgigs/mention": return "mentioned you in their post"; + case "devhub/mention": + return "mentioned you in their proposal"; case "poke": return "poked you"; case "star": @@ -31,9 +36,12 @@ function createNotificationMessage(notificationType, path, postValue, customMess case "custom": return customMessage ?? ""; case "devgovgigs/edit": + case "devhub/edit": return "edited your"; case "devgovgigs/like": return isDevHubPost ? "liked your post" : "liked your comment"; + case "devhub/like": + return "liked your proposal"; default: return null; } @@ -68,11 +76,13 @@ function getNotificationContent(notificationType, notificationValue, path, postV function createNotificationLink(notificationType, notificationValue, authorAccountId, accountId, blockHeight) { const pathPrefix = `/${REPL_ACCOUNT}/widget`; - let { item, widget, params, post } = notificationValue; + let { item, widget, params, post, proposal, notifier } = notificationValue; item = item ?? {}; widget = widget ?? ""; params = params ?? {}; post = post ?? {}; + proposal = proposal ?? ""; + notifier = notifier ?? ""; let { blockHeight: likeAtBlockHeight, path } = item; path = path ?? ""; @@ -105,6 +115,18 @@ function createNotificationLink(notificationType, notificationValue, authorAccou id: post, }, }); + case "devhub/mention": + case "devhub/edit": + case "devhub/reply": + case "devhub/like": + return href({ + widgetSrc: "devhub.near/widget/app", + params: { + page: "proposal", + id: proposal, + notifier: notifier, + }, + }); default: return `${pathPrefix}/PostPage?accountId=${accountId}&blockHeight=${blockHeight}`; } @@ -114,6 +136,7 @@ function getNotificationIconClassName(notificationType) { switch (notificationType) { case "like": case "devgovgigs/like": + case "devhub/like": return "ph ph-heart"; case "fork": return "ph ph-git-fork"; @@ -123,9 +146,11 @@ function getNotificationIconClassName(notificationType) { return "ph ph-user-minus"; case "comment": case "devgovgigs/reply": + case "devhub/reply": return "ph ph-share-fat"; case "mention": case "devgovgigs/mention": + case "devhub/mention": return "ph ph-at"; case "poke": return "ph ph-hand-pointing"; From 6aa80ae9c6104a612ac043d51162bf6f83e9a467 Mon Sep 17 00:00:00 2001 From: Charles Garrett Date: Wed, 20 Mar 2024 12:26:11 -0400 Subject: [PATCH 3/3] chore: explore all teams should open in a new tab --- src/NearOrg/Ecosystem/GetFundingPage.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/NearOrg/Ecosystem/GetFundingPage.jsx b/src/NearOrg/Ecosystem/GetFundingPage.jsx index 616e9527..522c480d 100644 --- a/src/NearOrg/Ecosystem/GetFundingPage.jsx +++ b/src/NearOrg/Ecosystem/GetFundingPage.jsx @@ -481,6 +481,7 @@ return ( label: "Explore All Teams", variant: "affirmative", size: "large", + target: "_blank", }} />