Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add page not found banner #971

Merged
merged 2 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions instances/devhub.near/widget/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ function Page() {
);
}
default: {
// TODO: 404 page
return <p>404</p>;
return <Widget src={"${REPL_DEVHUB}/widget/devhub.page.notfound"} />;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,16 @@ const LinkProfile = ({ account, children }) => {
const stepsArray = [1, 2, 3, 4, 5];

const { id, timestamp } = props;

if (id === undefined) {
return (
<Widget
src={`${REPL_DEVHUB}/widget/devhub.page.notfound`}
props={{ missing: "proposal id" }}
/>
);
}

const proposal = Near.view("${REPL_DEVHUB_CONTRACT}", "get_proposal", {
proposal_id: parseInt(id),
});
Expand Down
44 changes: 44 additions & 0 deletions instances/devhub.near/widget/devhub/page/notfound.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const { missing } = props;

const BannerWrapper = styled.div`
margin-top: 3rem;
background-color: #ffd2d2;
.text-sm {
font-size: 13px;
}
`;

return (
<div className="container-xl gap-3">
<Widget src={`${REPL_DEVHUB}/widget/devhub.components.island.banner`} />
<BannerWrapper className="d-flex gap-3 align-items-center mb-4 p-3 rounded-3">
<div>
<i class="bi bi-exclamation-triangle-fill"></i>
</div>
<div>
<div className="fw-bold">Page not found! </div>
<div className="text-sm">
Please visit the{" "}
<a
href="?page=home"
className="text-decoration-underline"
target="_blank"
rel="noopener noreferrer"
>
Home Page
</a>
.
{missing ? (
<span>The {missing} prop is missing from the url</span>
) : (
<span>
We searched high and low but couldn't found what you're looking
for.{" "}
</span>
)}
.
</div>
</div>
</BannerWrapper>
</div>
);
7 changes: 1 addition & 6 deletions instances/events-committee.near/widget/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,7 @@ function Page() {
);
}
default: {
return (
<Widget
src={"${REPL_EVENTS}/widget/devhub.page.proposals"}
props={passProps}
/>
);
return <Widget src={"${REPL_DEVHUB}/widget/devhub.page.notfound"} />;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,16 @@ const LinkProfile = ({ account, children }) => {
const stepsArray = [1, 2, 3, 4, 5];

const { id, timestamp } = props;

if (id === undefined) {
return (
<Widget
src={`${REPL_DEVHUB}/widget/devhub.page.notfound`}
props={{ missing: "proposal id" }}
/>
);
}

const proposal = Near.view("${REPL_EVENTS_CONTRACT}", "get_proposal", {
proposal_id: parseInt(id),
});
Expand Down
3 changes: 1 addition & 2 deletions instances/infrastructure-committee.near/widget/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ function Page() {
);
}
default: {
// TODO: 404 page
return <p>404</p>;
return <Widget src={"${REPL_DEVHUB}/widget/devhub.page.notfound"} />;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ const LinkProfile = ({ account, children }) => {
const stepsArray = [1, 2, 3, 4, 5];

const { id, timestamp } = props;

if (id === undefined) {
return (
Comment on lines +263 to +264
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add it for the rfp page as well. thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes done

<Widget
src={`${REPL_DEVHUB}/widget/devhub.page.notfound`}
props={{ missing: "proposal id" }}
/>
);
}

const proposal = Near.view(
"${REPL_INFRASTRUCTURE_COMMITTEE_CONTRACT}",
"get_proposal",
Expand Down
Loading