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

feat(con): 404 page for unavailable content #1011

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
Binary file added apps/redi-connect/src/assets/images/404.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/redi-connect/src/components/templates/LoggedIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { Navbar, SideMenu } from '../organisms'
import Footer from '../organisms/Footer'

interface Props {
hideNavigation?: boolean
children?: ReactNode
}

Expand Down
14 changes: 14 additions & 0 deletions apps/redi-connect/src/pages/app/404/404.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import FourOhFour from '../../../assets/images/404.png'
import { LoggedIn } from '../../../components/templates'

export default () => (
<LoggedIn hideNavigation>
<div className="tw-max-w-[240px] md:tw-max-w-[342px] tw-flex tw-justify-center tw-h-full tw-flex-col tw-m-auto tw-min-h-[40rem]">
<img src={FourOhFour} alt="404" className="tw-mb-6" />
<span className="tw-text-sm md:tw-text-base">
<b>Hey!</b> This page isn't available. We're sorry about that. Please go
back to our <a href="/">Homepage</a>.
</span>
</div>
</LoggedIn>
)
25 changes: 6 additions & 19 deletions apps/redi-connect/src/pages/app/profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,6 @@ function Profile() {
const userCanApplyForMentorship =
!isAcceptedMatch && currentUserIsMentee && !hasOpenApplication

const contactInfoAvailable =
profile &&
(profile.firstName ||
profile.lastName ||
profile.email ||
profile.telephoneNumber ||
profile.linkedInProfileUrl ||
profile.githubProfileUrl ||
profile.slackUsername)

const shouldHidePrivateContactInfo = currentUserIsMentee && !isAcceptedMatch

const activeMentorshipMatch = myProfile.mentorshipMatches.find(
Expand Down Expand Up @@ -164,17 +154,14 @@ function Profile() {
</Element>
)}

{contactInfoAvailable && (
{!shouldHidePrivateContactInfo && (
<Element className="block-separator">
<Columns>
{!shouldHidePrivateContactInfo &&
(profile.firstName || profile.age) && (
<Columns.Column>
<Element className="block-separator">
<ReadContactDetails.Some profile={profile} />
</Element>
</Columns.Column>
)}
<Columns.Column>
<Element className="block-separator">
<ReadContactDetails.Some profile={profile} />
</Element>
</Columns.Column>
{(profile.linkedInProfileUrl ||
profile.githubProfileUrl ||
profile.slackUsername) && (
Expand Down
8 changes: 8 additions & 0 deletions apps/redi-connect/src/routes/routes__logged-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const Me = lazy(
/* webpackChunkName: "Me", webpackPreload: true */ '../pages/app/me/Me'
)
)
const FourOFour = lazy(
() => import(/* webpackChunkName: "404" */ '../pages/app/404/404')
)

const routes: RouteDefinition[] = [
{
Expand Down Expand Up @@ -85,6 +88,11 @@ const routes: RouteDefinition[] = [
component: Me,
exact: true,
},
{
path: '/app/404',
component: FourOFour,
exact: true,
},
]

const routesRequiringLoggedIn = routes.map((route) =>
Expand Down