Skip to content

Commit

Permalink
Community latest telegram messages (#126)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ailisp authored May 31, 2023
1 parent 43b54ed commit d21ba90
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 0 deletions.
4 changes: 4 additions & 0 deletions communities.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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",
},
};
15 changes: 15 additions & 0 deletions src/gigs-board/components/community/CommunityHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ return (
Events
</a>
</li>
<li class="nav-item">
<a
class="nav-link"
className={
props.tab === "Telegram" ? "nav-link active" : "nav-link"
}
href={href("community.Telegram", {
label: props.label,
tab: "Telegram",
})}
>
<i class="bi-telegram"> </i>
Telegram
</a>
</li>
</NavUnderline>
</div>
</Header>
Expand Down
4 changes: 4 additions & 0 deletions src/gigs-board/components/community/FeedHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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" */
Expand Down
4 changes: 4 additions & 0 deletions src/gigs-board/components/community/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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" */
Expand Down
4 changes: 4 additions & 0 deletions src/gigs-board/pages/community/Discussions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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" */
Expand Down
4 changes: 4 additions & 0 deletions src/gigs-board/pages/community/Events.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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" */
Expand Down
4 changes: 4 additions & 0 deletions src/gigs-board/pages/community/Overview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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" */
Expand Down
4 changes: 4 additions & 0 deletions src/gigs-board/pages/community/Sponsorship.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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" */
Expand Down
126 changes: 126 additions & 0 deletions src/gigs-board/pages/community/Telegram.jsx
Original file line number Diff line number Diff line change
@@ -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 (
<Widget
src={`${nearDevGovGigsWidgetsAccountId}/widget/gigs-board.${widgetName}`}
props={widgetProps}
key={key}
/>
);
}

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 (
<div class="alert alert-danger" role="alert">
Error: label is required
</div>
);
}

const community = communities[props.label];

const group = community.telegram;

const Telegram = (
<div>
<iframe
iframeResizer
src={
"https://j96g3uepe0.execute-api.us-east-1.amazonaws.com/groups-ui/" +
group
}
frameborder="0"
// Required by iframeResizer
style={{
width: "1px",
minWidth: "100%",
}}
></iframe>
</div>
);

return widget("components.community.Layout", {
label: props.label,
tab: "Telegram",
children: Telegram,
});

0 comments on commit d21ba90

Please sign in to comment.