From d21ba90710eefa8a4dc3b04a5bf8864d913ef5e7 Mon Sep 17 00:00:00 2001 From: Bo Yao Date: Wed, 31 May 2023 10:11:00 +0800 Subject: [PATCH] Community latest telegram messages (#126) * Community latest telegram messages * iframe cloudflare pages * different attempts on iframe-resizer, parent side * clean up * sizing works after replace iframe to div in server side * fix dark mode, and address comments --- communities.jsx | 4 + .../components/community/CommunityHeader.jsx | 15 +++ .../components/community/FeedHeader.jsx | 4 + .../components/community/Layout.jsx | 4 + .../pages/community/Discussions.jsx | 4 + src/gigs-board/pages/community/Events.jsx | 4 + src/gigs-board/pages/community/Overview.jsx | 4 + .../pages/community/Sponsorship.jsx | 4 + src/gigs-board/pages/community/Telegram.jsx | 126 ++++++++++++++++++ 9 files changed, 169 insertions(+) create mode 100644 src/gigs-board/pages/community/Telegram.jsx diff --git a/communities.jsx b/communities.jsx index 95fac5bea..0b15cc341 100644 --- a/communities.jsx +++ b/communities.jsx @@ -7,6 +7,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreihgxg5kwts2juldaeasveyuddkm6tcabmrat2aaq5u6uyljtyt7lu", title: "Zero Knowledge", desc: "Building a zero knowledge ecosystem on NEAR.", + telegram: "NearZeroKnowledge", }, protocol: { overviewId: 412, @@ -16,6 +17,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreicg4svzfz5nvllomsahndgm7u62za4sib4mmbygxzhpcl4htqwr4a", title: "Protocol", desc: "Supporting the ongoing innovation of the NEAR Protocol.", + telegram: "NEAR_Protocol_Community_Group", }, tooling: { overviewId: 416, @@ -25,6 +27,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiehzr7z2fhoqqmkt3z667wubccbch6sqtsnvd6msodyzpnf72cszy", title: "Tooling", desc: "Supporting the ongoing innovation of tooling.", + telegram: "NEAR_Tools_Community_Group", }, "contract-standards": { overviewId: 414, @@ -34,5 +37,6 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiaowjqxds24fwcliyriintjd4ucciprii2rdxjmxgi7f5dmzuscey", title: "Contract Standards", desc: "Coordinating the contribution to the NEAR dapp standards.", + telegram: "nearnft", }, }; diff --git a/src/gigs-board/components/community/CommunityHeader.jsx b/src/gigs-board/components/community/CommunityHeader.jsx index 686b9fd50..b53ebfb2b 100644 --- a/src/gigs-board/components/community/CommunityHeader.jsx +++ b/src/gigs-board/components/community/CommunityHeader.jsx @@ -159,6 +159,21 @@ return ( Events + diff --git a/src/gigs-board/components/community/FeedHeader.jsx b/src/gigs-board/components/community/FeedHeader.jsx index f21a22e99..ea85af431 100644 --- a/src/gigs-board/components/community/FeedHeader.jsx +++ b/src/gigs-board/components/community/FeedHeader.jsx @@ -54,6 +54,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreihgxg5kwts2juldaeasveyuddkm6tcabmrat2aaq5u6uyljtyt7lu", title: "Zero Knowledge", desc: "Building a zero knowledge ecosystem on NEAR.", + telegram: "NearZeroKnowledge", }, protocol: { overviewId: 412, @@ -63,6 +64,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreicg4svzfz5nvllomsahndgm7u62za4sib4mmbygxzhpcl4htqwr4a", title: "Protocol", desc: "Supporting the ongoing innovation of the NEAR Protocol.", + telegram: "NEAR_Protocol_Community_Group", }, tooling: { overviewId: 416, @@ -72,6 +74,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiehzr7z2fhoqqmkt3z667wubccbch6sqtsnvd6msodyzpnf72cszy", title: "Tooling", desc: "Supporting the ongoing innovation of tooling.", + telegram: "NEAR_Tools_Community_Group", }, "contract-standards": { overviewId: 414, @@ -81,6 +84,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiaowjqxds24fwcliyriintjd4ucciprii2rdxjmxgi7f5dmzuscey", title: "Contract Standards", desc: "Coordinating the contribution to the NEAR dapp standards.", + telegram: "nearnft", }, }; /* END_INCLUDE: "communities.jsx" */ diff --git a/src/gigs-board/components/community/Layout.jsx b/src/gigs-board/components/community/Layout.jsx index 357d0dafc..f09a2d0bf 100644 --- a/src/gigs-board/components/community/Layout.jsx +++ b/src/gigs-board/components/community/Layout.jsx @@ -54,6 +54,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreihgxg5kwts2juldaeasveyuddkm6tcabmrat2aaq5u6uyljtyt7lu", title: "Zero Knowledge", desc: "Building a zero knowledge ecosystem on NEAR.", + telegram: "NearZeroKnowledge", }, protocol: { overviewId: 412, @@ -63,6 +64,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreicg4svzfz5nvllomsahndgm7u62za4sib4mmbygxzhpcl4htqwr4a", title: "Protocol", desc: "Supporting the ongoing innovation of the NEAR Protocol.", + telegram: "NEAR_Protocol_Community_Group", }, tooling: { overviewId: 416, @@ -72,6 +74,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiehzr7z2fhoqqmkt3z667wubccbch6sqtsnvd6msodyzpnf72cszy", title: "Tooling", desc: "Supporting the ongoing innovation of tooling.", + telegram: "NEAR_Tools_Community_Group", }, "contract-standards": { overviewId: 414, @@ -81,6 +84,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiaowjqxds24fwcliyriintjd4ucciprii2rdxjmxgi7f5dmzuscey", title: "Contract Standards", desc: "Coordinating the contribution to the NEAR dapp standards.", + telegram: "nearnft", }, }; /* END_INCLUDE: "communities.jsx" */ diff --git a/src/gigs-board/pages/community/Discussions.jsx b/src/gigs-board/pages/community/Discussions.jsx index 0cc2fe07c..6d3aac998 100644 --- a/src/gigs-board/pages/community/Discussions.jsx +++ b/src/gigs-board/pages/community/Discussions.jsx @@ -54,6 +54,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreihgxg5kwts2juldaeasveyuddkm6tcabmrat2aaq5u6uyljtyt7lu", title: "Zero Knowledge", desc: "Building a zero knowledge ecosystem on NEAR.", + telegram: "NearZeroKnowledge", }, protocol: { overviewId: 412, @@ -63,6 +64,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreicg4svzfz5nvllomsahndgm7u62za4sib4mmbygxzhpcl4htqwr4a", title: "Protocol", desc: "Supporting the ongoing innovation of the NEAR Protocol.", + telegram: "NEAR_Protocol_Community_Group", }, tooling: { overviewId: 416, @@ -72,6 +74,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiehzr7z2fhoqqmkt3z667wubccbch6sqtsnvd6msodyzpnf72cszy", title: "Tooling", desc: "Supporting the ongoing innovation of tooling.", + telegram: "NEAR_Tools_Community_Group", }, "contract-standards": { overviewId: 414, @@ -81,6 +84,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiaowjqxds24fwcliyriintjd4ucciprii2rdxjmxgi7f5dmzuscey", title: "Contract Standards", desc: "Coordinating the contribution to the NEAR dapp standards.", + telegram: "nearnft", }, }; /* END_INCLUDE: "communities.jsx" */ diff --git a/src/gigs-board/pages/community/Events.jsx b/src/gigs-board/pages/community/Events.jsx index 4172257af..dcb6612f9 100644 --- a/src/gigs-board/pages/community/Events.jsx +++ b/src/gigs-board/pages/community/Events.jsx @@ -54,6 +54,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreihgxg5kwts2juldaeasveyuddkm6tcabmrat2aaq5u6uyljtyt7lu", title: "Zero Knowledge", desc: "Building a zero knowledge ecosystem on NEAR.", + telegram: "NearZeroKnowledge", }, protocol: { overviewId: 412, @@ -63,6 +64,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreicg4svzfz5nvllomsahndgm7u62za4sib4mmbygxzhpcl4htqwr4a", title: "Protocol", desc: "Supporting the ongoing innovation of the NEAR Protocol.", + telegram: "NEAR_Protocol_Community_Group", }, tooling: { overviewId: 416, @@ -72,6 +74,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiehzr7z2fhoqqmkt3z667wubccbch6sqtsnvd6msodyzpnf72cszy", title: "Tooling", desc: "Supporting the ongoing innovation of tooling.", + telegram: "NEAR_Tools_Community_Group", }, "contract-standards": { overviewId: 414, @@ -81,6 +84,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiaowjqxds24fwcliyriintjd4ucciprii2rdxjmxgi7f5dmzuscey", title: "Contract Standards", desc: "Coordinating the contribution to the NEAR dapp standards.", + telegram: "nearnft", }, }; /* END_INCLUDE: "communities.jsx" */ diff --git a/src/gigs-board/pages/community/Overview.jsx b/src/gigs-board/pages/community/Overview.jsx index 1a71f23a7..d9d6465bf 100644 --- a/src/gigs-board/pages/community/Overview.jsx +++ b/src/gigs-board/pages/community/Overview.jsx @@ -54,6 +54,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreihgxg5kwts2juldaeasveyuddkm6tcabmrat2aaq5u6uyljtyt7lu", title: "Zero Knowledge", desc: "Building a zero knowledge ecosystem on NEAR.", + telegram: "NearZeroKnowledge", }, protocol: { overviewId: 412, @@ -63,6 +64,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreicg4svzfz5nvllomsahndgm7u62za4sib4mmbygxzhpcl4htqwr4a", title: "Protocol", desc: "Supporting the ongoing innovation of the NEAR Protocol.", + telegram: "NEAR_Protocol_Community_Group", }, tooling: { overviewId: 416, @@ -72,6 +74,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiehzr7z2fhoqqmkt3z667wubccbch6sqtsnvd6msodyzpnf72cszy", title: "Tooling", desc: "Supporting the ongoing innovation of tooling.", + telegram: "NEAR_Tools_Community_Group", }, "contract-standards": { overviewId: 414, @@ -81,6 +84,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiaowjqxds24fwcliyriintjd4ucciprii2rdxjmxgi7f5dmzuscey", title: "Contract Standards", desc: "Coordinating the contribution to the NEAR dapp standards.", + telegram: "nearnft", }, }; /* END_INCLUDE: "communities.jsx" */ diff --git a/src/gigs-board/pages/community/Sponsorship.jsx b/src/gigs-board/pages/community/Sponsorship.jsx index 70f8da748..f40145af2 100644 --- a/src/gigs-board/pages/community/Sponsorship.jsx +++ b/src/gigs-board/pages/community/Sponsorship.jsx @@ -54,6 +54,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreihgxg5kwts2juldaeasveyuddkm6tcabmrat2aaq5u6uyljtyt7lu", title: "Zero Knowledge", desc: "Building a zero knowledge ecosystem on NEAR.", + telegram: "NearZeroKnowledge", }, protocol: { overviewId: 412, @@ -63,6 +64,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreicg4svzfz5nvllomsahndgm7u62za4sib4mmbygxzhpcl4htqwr4a", title: "Protocol", desc: "Supporting the ongoing innovation of the NEAR Protocol.", + telegram: "NEAR_Protocol_Community_Group", }, tooling: { overviewId: 416, @@ -72,6 +74,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiehzr7z2fhoqqmkt3z667wubccbch6sqtsnvd6msodyzpnf72cszy", title: "Tooling", desc: "Supporting the ongoing innovation of tooling.", + telegram: "NEAR_Tools_Community_Group", }, "contract-standards": { overviewId: 414, @@ -81,6 +84,7 @@ const communities = { "https://ipfs.near.social/ipfs/bafkreiaowjqxds24fwcliyriintjd4ucciprii2rdxjmxgi7f5dmzuscey", title: "Contract Standards", desc: "Coordinating the contribution to the NEAR dapp standards.", + telegram: "nearnft", }, }; /* END_INCLUDE: "communities.jsx" */ diff --git a/src/gigs-board/pages/community/Telegram.jsx b/src/gigs-board/pages/community/Telegram.jsx new file mode 100644 index 000000000..f27bcd8ee --- /dev/null +++ b/src/gigs-board/pages/community/Telegram.jsx @@ -0,0 +1,126 @@ +/* INCLUDE: "common.jsx" */ +const nearDevGovGigsContractAccountId = + props.nearDevGovGigsContractAccountId || + (context.widgetSrc ?? "devgovgigs.near").split("/", 1)[0]; +const nearDevGovGigsWidgetsAccountId = + props.nearDevGovGigsWidgetsAccountId || + (context.widgetSrc ?? "devgovgigs.near").split("/", 1)[0]; + +function widget(widgetName, widgetProps, key) { + widgetProps = { + ...widgetProps, + nearDevGovGigsContractAccountId: props.nearDevGovGigsContractAccountId, + nearDevGovGigsWidgetsAccountId: props.nearDevGovGigsWidgetsAccountId, + referral: props.referral, + }; + return ( + + ); +} + +function href(widgetName, linkProps) { + linkProps = { ...linkProps }; + if (props.nearDevGovGigsContractAccountId) { + linkProps.nearDevGovGigsContractAccountId = + props.nearDevGovGigsContractAccountId; + } + if (props.nearDevGovGigsWidgetsAccountId) { + linkProps.nearDevGovGigsWidgetsAccountId = + props.nearDevGovGigsWidgetsAccountId; + } + if (props.referral) { + linkProps.referral = props.referral; + } + const linkPropsQuery = Object.entries(linkProps) + .map(([key, value]) => `${key}=${value}`) + .join("&"); + return `#/${nearDevGovGigsWidgetsAccountId}/widget/gigs-board.pages.${widgetName}${ + linkPropsQuery ? "?" : "" + }${linkPropsQuery}`; +} +/* END_INCLUDE: "common.jsx" */ + +/* INCLUDE: "communities.jsx" */ +const communities = { + "zero-knowledge": { + overviewId: 397, + eventsId: 401, + icon: "https://ipfs.near.social/ipfs/bafkreiajwq6ep3n7veddozji2djv5vviyisabhycbweslvpwhsoyuzcwi4", + cover: + "https://ipfs.near.social/ipfs/bafkreihgxg5kwts2juldaeasveyuddkm6tcabmrat2aaq5u6uyljtyt7lu", + title: "Zero Knowledge", + desc: "Building a zero knowledge ecosystem on NEAR.", + telegram: "NearZeroKnowledge", + }, + protocol: { + overviewId: 412, + eventsId: 413, + icon: "https://ipfs.near.social/ipfs/bafkreidpitdafcnhkp4uyomacypdgqvxr35jtfnbxa5s6crby7qjk2nv5a", + cover: + "https://ipfs.near.social/ipfs/bafkreicg4svzfz5nvllomsahndgm7u62za4sib4mmbygxzhpcl4htqwr4a", + title: "Protocol", + desc: "Supporting the ongoing innovation of the NEAR Protocol.", + telegram: "NEAR_Protocol_Community_Group", + }, + tooling: { + overviewId: 416, + eventsId: 417, + icon: "https://ipfs.near.social/ipfs/bafkreie2eaj5czmpfe6pe53kojzcspgozebdsonffwvbxtpuipnwahybvi", + cover: + "https://ipfs.near.social/ipfs/bafkreiehzr7z2fhoqqmkt3z667wubccbch6sqtsnvd6msodyzpnf72cszy", + title: "Tooling", + desc: "Supporting the ongoing innovation of tooling.", + telegram: "NEAR_Tools_Community_Group", + }, + "contract-standards": { + overviewId: 414, + eventsId: 415, + icon: "https://ipfs.near.social/ipfs/bafkreiepgdnu7soc6xgbyd4adicbf3eyxiiwqawn6tguaix6aklfpir634", + cover: + "https://ipfs.near.social/ipfs/bafkreiaowjqxds24fwcliyriintjd4ucciprii2rdxjmxgi7f5dmzuscey", + title: "Contract Standards", + desc: "Coordinating the contribution to the NEAR dapp standards.", + telegram: "nearnft", + }, +}; +/* END_INCLUDE: "communities.jsx" */ + +if (!props.label) { + return ( + + ); +} + +const community = communities[props.label]; + +const group = community.telegram; + +const Telegram = ( +
+ +
+); + +return widget("components.community.Layout", { + label: props.label, + tab: "Telegram", + children: Telegram, +});