From 02e1a2ee54899af292971d2203aa37a80cd55d92 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:54:06 +0530 Subject: [PATCH] move all props to one file --- instances/devhub.near/widget/app.jsx | 13 ++- instances/devhub.near/widget/config/css.jsx | 6 +- instances/devhub.near/widget/config/data.jsx | 97 +++++++++++++++++++ instances/devhub.near/widget/config/theme.jsx | 5 + .../widget/devhub/entity/proposal/Feed.jsx | 92 +++++++----------- .../widget/devhub/page/proposals.jsx | 88 ----------------- .../events-committee.near/widget/app.jsx | 13 ++- .../widget/config/css.jsx | 6 +- .../widget/config/data.jsx | 52 ++++++++++ .../widget/config/theme.jsx | 5 + .../widget/devhub/page/proposals.jsx | 45 --------- .../widget/app.jsx | 14 ++- .../widget/components/proposals/Proposals.jsx | 27 ------ .../widget/config/css.jsx | 6 +- .../widget/config/data.jsx | 71 ++++++++++++++ .../widget/config/theme.jsx | 5 + 16 files changed, 302 insertions(+), 243 deletions(-) create mode 100644 instances/devhub.near/widget/config/data.jsx create mode 100644 instances/devhub.near/widget/config/theme.jsx create mode 100644 instances/events-committee.near/widget/config/data.jsx create mode 100644 instances/events-committee.near/widget/config/theme.jsx create mode 100644 instances/infrastructure-committee.near/widget/config/data.jsx create mode 100644 instances/infrastructure-committee.near/widget/config/theme.jsx diff --git a/instances/devhub.near/widget/app.jsx b/instances/devhub.near/widget/app.jsx index 902d85462..be0619899 100644 --- a/instances/devhub.near/widget/app.jsx +++ b/instances/devhub.near/widget/app.jsx @@ -14,9 +14,10 @@ const { AppLayout } = VM.require( "${REPL_DEVHUB}/widget/devhub.components.templates.AppLayout" ); -const { Theme } = VM.require("${REPL_DEVHUB}/widget/config.css"); +const { CssContainer } = VM.require("${REPL_DEVHUB}/widget/config.css"); +const { Theme } = VM.require("${REPL_DEVHUB}/widget/config.theme"); -if (!AppLayout || !Theme) { +if (!AppLayout || !Theme || !CssContainer) { return

Loading modules...

; } @@ -241,8 +242,10 @@ function Page() { return ( - - - + + + + + ); diff --git a/instances/devhub.near/widget/config/css.jsx b/instances/devhub.near/widget/config/css.jsx index 3c8341fcf..56ba8b991 100644 --- a/instances/devhub.near/widget/config/css.jsx +++ b/instances/devhub.near/widget/config/css.jsx @@ -1,6 +1,4 @@ -const Theme = styled.div` - --theme-color: rgb(4, 164, 110); - +const CssContainer = styled.div` .theme-btn { background-color: var(--theme-color) !important; border: none; @@ -25,4 +23,4 @@ const Theme = styled.div` } `; -return { Theme }; +return { CssContainer }; diff --git a/instances/devhub.near/widget/config/data.jsx b/instances/devhub.near/widget/config/data.jsx new file mode 100644 index 000000000..ce40e902a --- /dev/null +++ b/instances/devhub.near/widget/config/data.jsx @@ -0,0 +1,97 @@ +const proposalFeedAnnouncement = ( +
+

+

+ +
+
+ + Welcome to + + DevDAO’s New Proposal Feed! + + + This dedicated space replaces the + + old activity feed + + , making it easier to submit and track funding requests from DevDAO, the + primary organization behind DevHub. To submit a formal proposal, click + New Proposal. See our{" "} + + guidelines + + for details. For discussions and brainstorming, please utilize the + relevant{" "} + + communities + + . +
+

+
+); + +const categoryOptions = [ + { + title: "DevDAO Operations", + value: "DevDAO Operations", + }, + { + title: "DevDAO Platform", + value: "DevDAO Platform", + }, + { + title: "Events & Hackathons", + value: "Events & Hackathons", + }, + { + title: "Engagement & Awareness", + value: "Engagement & Awareness", + }, + { + title: "Decentralized DevRel", + value: "Decentralized DevRel", + }, + { + title: "Universities & Bootcamps", + value: "Universities & Bootcamps", + }, + { + title: "Tooling & Infrastructure", + value: "Tooling & Infrastructure", + }, + { + title: "Other", + value: "Other", + }, +]; + +return { + contract: "devhub.near", + proposalFeedIndexerQueryName: + "polyprogrammist_near_devhub_prod_v1_proposals_with_latest_snapshot", + indexerHasuraRole: "polyprogrammist_near", + isDevhub: true, + proposalFeedAnnouncement, + availableCategoryOptions: categoryOptions, +}; diff --git a/instances/devhub.near/widget/config/theme.jsx b/instances/devhub.near/widget/config/theme.jsx new file mode 100644 index 000000000..b5432c913 --- /dev/null +++ b/instances/devhub.near/widget/config/theme.jsx @@ -0,0 +1,5 @@ +const Theme = styled.div` + --theme-color: rgb(4, 164, 110); +`; + +return { Theme }; diff --git a/instances/devhub.near/widget/devhub/entity/proposal/Feed.jsx b/instances/devhub.near/widget/devhub/entity/proposal/Feed.jsx index 602c13443..17455a438 100644 --- a/instances/devhub.near/widget/devhub/entity/proposal/Feed.jsx +++ b/instances/devhub.near/widget/devhub/entity/proposal/Feed.jsx @@ -3,43 +3,27 @@ const { href } = VM.require("${REPL_DEVHUB}/widget/core.lib.url") || { }; const instance = props.instance ?? ""; -const availableCategoryOptions = props.availableCategoryOptions ?? []; -const announcement = props.announcement ?? <>; - -let contract = ""; -let rfpFeedIndexerQueryName = ""; -let proposalFeedIndexerQueryName = ""; -let indexerHasuraRole = ""; -let isDevhub = false; -let isInfra = false; -let isEvents = false; - -switch (instance) { - case "infrastructure-committee.near": { - contract = instance; - rfpFeedIndexerQueryName = - "polyprogrammist_near_devhub_ic_v1_rfps_with_latest_snapshot"; - proposalFeedIndexerQueryName = - "polyprogrammist_near_devhub_ic_v1_proposals_with_latest_snapshot"; - indexerHasuraRole = "polyprogrammist_near"; - isInfra = true; - break; - } - case "events-committee.near": { - contract = instance; - proposalFeedIndexerQueryName = - "thomasguntenaar_near_event_committee_prod_v1_proposals_with_latest_snapshot"; - indexerHasuraRole = "thomasguntenaar_near"; - isEvents = true; - break; - } - default: { - contract = instance; - proposalFeedIndexerQueryName = - "polyprogrammist_near_devhub_prod_v1_proposals_with_latest_snapshot"; - indexerHasuraRole = "polyprogrammist_near"; - isDevhub = true; - } + +const { + contract, + rfpFeedIndexerQueryName, + proposalFeedAnnouncement, + availableCategoryOptions, + proposalFeedIndexerQueryName, + indexerHasuraRole, + isDevhub, + isInfra, + isEvents, +} = VM.require(`${instance}/widget/config.data`); + +const loader = ( +
+ +
+); + +if (!contract) { + return loader; } function isNumber(v) { @@ -485,14 +469,6 @@ const FeedPage = () => { }); }; - const loader = ( -
- -
- ); - useEffect(() => { const handler = setTimeout(() => { fetchProposals(); @@ -537,17 +513,19 @@ const FeedPage = () => { }} />
- { - State.update({ category: select.value }); - }, - }} - /> + {!isInfra && ( + { + State.update({ category: select.value }); + }, + }} + /> + )} { ) : (
- {announcement} + {proposalFeedAnnouncement}
{state.aggregatedCount === 0 ? (