From f5170c50eb834ab65c3b412bae284913f3428c23 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 24 Oct 2024 21:08:30 -0500 Subject: [PATCH 1/2] feat: page not found all instances + proposal id prop missing page.Proposal --- instances/devhub.near/widget/app.jsx | 3 +- .../devhub/entity/proposal/Proposal.jsx | 10 +++++ .../widget/devhub/page/notfound.jsx | 44 +++++++++++++++++++ .../events-committee.near/widget/app.jsx | 7 +-- .../devhub/entity/proposal/Proposal.jsx | 10 +++++ .../widget/app.jsx | 3 +- .../widget/components/proposals/Proposal.jsx | 10 +++++ 7 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 instances/devhub.near/widget/devhub/page/notfound.jsx diff --git a/instances/devhub.near/widget/app.jsx b/instances/devhub.near/widget/app.jsx index be0619899..221dce7de 100644 --- a/instances/devhub.near/widget/app.jsx +++ b/instances/devhub.near/widget/app.jsx @@ -234,8 +234,7 @@ function Page() { ); } default: { - // TODO: 404 page - return

404

; + return ; } } } diff --git a/instances/devhub.near/widget/devhub/entity/proposal/Proposal.jsx b/instances/devhub.near/widget/devhub/entity/proposal/Proposal.jsx index d28d4ec44..8c2182381 100644 --- a/instances/devhub.near/widget/devhub/entity/proposal/Proposal.jsx +++ b/instances/devhub.near/widget/devhub/entity/proposal/Proposal.jsx @@ -263,6 +263,16 @@ const LinkProfile = ({ account, children }) => { const stepsArray = [1, 2, 3, 4, 5]; const { id, timestamp } = props; + +if (id === undefined) { + return ( + + ); +} + const proposal = Near.view("${REPL_DEVHUB_CONTRACT}", "get_proposal", { proposal_id: parseInt(id), }); diff --git a/instances/devhub.near/widget/devhub/page/notfound.jsx b/instances/devhub.near/widget/devhub/page/notfound.jsx new file mode 100644 index 000000000..77910bc0a --- /dev/null +++ b/instances/devhub.near/widget/devhub/page/notfound.jsx @@ -0,0 +1,44 @@ +const { missing } = props; + +const BannerWrapper = styled.div` + margin-top: 3rem; + background-color: #ffd2d2; + .text-sm { + font-size: 13px; + } +`; + +return ( +
+ + +
+ +
+
+
Page not found!
+
+ Please visit the{" "} + + Home Page + + . + {missing ? ( + The {missing} prop is missing from the url + ) : ( + + We searched high and low but couldn't found what you're looking + for.{" "} + + )} + . +
+
+
+
+); diff --git a/instances/events-committee.near/widget/app.jsx b/instances/events-committee.near/widget/app.jsx index e873d793d..4953a3d1e 100644 --- a/instances/events-committee.near/widget/app.jsx +++ b/instances/events-committee.near/widget/app.jsx @@ -81,12 +81,7 @@ function Page() { ); } default: { - return ( - - ); + return ; } } } diff --git a/instances/events-committee.near/widget/devhub/entity/proposal/Proposal.jsx b/instances/events-committee.near/widget/devhub/entity/proposal/Proposal.jsx index 0d8a27a6e..43ba22f11 100644 --- a/instances/events-committee.near/widget/devhub/entity/proposal/Proposal.jsx +++ b/instances/events-committee.near/widget/devhub/entity/proposal/Proposal.jsx @@ -260,6 +260,16 @@ const LinkProfile = ({ account, children }) => { const stepsArray = [1, 2, 3, 4, 5]; const { id, timestamp } = props; + +if (id === undefined) { + return ( + + ); +} + const proposal = Near.view("${REPL_EVENTS_CONTRACT}", "get_proposal", { proposal_id: parseInt(id), }); diff --git a/instances/infrastructure-committee.near/widget/app.jsx b/instances/infrastructure-committee.near/widget/app.jsx index a808c2b8a..daabaabc3 100644 --- a/instances/infrastructure-committee.near/widget/app.jsx +++ b/instances/infrastructure-committee.near/widget/app.jsx @@ -105,8 +105,7 @@ function Page() { ); } default: { - // TODO: 404 page - return

404

; + return ; } } } diff --git a/instances/infrastructure-committee.near/widget/components/proposals/Proposal.jsx b/instances/infrastructure-committee.near/widget/components/proposals/Proposal.jsx index 92d7e4007..9bc4582a6 100644 --- a/instances/infrastructure-committee.near/widget/components/proposals/Proposal.jsx +++ b/instances/infrastructure-committee.near/widget/components/proposals/Proposal.jsx @@ -259,6 +259,16 @@ const LinkProfile = ({ account, children }) => { const stepsArray = [1, 2, 3, 4, 5]; const { id, timestamp } = props; + +if (id === undefined) { + return ( + + ); +} + const proposal = Near.view( "${REPL_INFRASTRUCTURE_COMMITTEE_CONTRACT}", "get_proposal", From bf359896ecdd9067e60c321bf095cf4de3eaf9e5 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 26 Oct 2024 11:06:24 -0500 Subject: [PATCH 2/2] missing id check rfp page --- .../widget/components/rfps/Rfp.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/instances/infrastructure-committee.near/widget/components/rfps/Rfp.jsx b/instances/infrastructure-committee.near/widget/components/rfps/Rfp.jsx index 47268022b..23db5cc3b 100644 --- a/instances/infrastructure-committee.near/widget/components/rfps/Rfp.jsx +++ b/instances/infrastructure-committee.near/widget/components/rfps/Rfp.jsx @@ -34,6 +34,15 @@ const accountId = context.accountId; const { id, timestamp } = props; +if (id === undefined) { + return ( + + ); +} + const Container = styled.div` .full-width-div { width: 100vw;