Skip to content

Commit

Permalink
Merge pull request #9503 from hicommonwealth/israel.9486.PageNotFound…
Browse files Browse the repository at this point in the history
…-update

updated 404/PageNotFound
  • Loading branch information
ilijabojanovic authored Oct 10, 2024
2 parents bcf4421 + 6f2c556 commit 2fa11c6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
6 changes: 6 additions & 0 deletions packages/commonwealth/client/scripts/views/pages/404.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.PageNotFound {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
41 changes: 32 additions & 9 deletions packages/commonwealth/client/scripts/views/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,44 @@
import React from 'react';
import useUserStore from 'state/ui/user';
import { useAuthModalStore } from '../../state/ui/modals';
import { CWEmptyState } from '../components/component_kit/cw_empty_state';
import { CWButton } from '../components/component_kit/new_designs/CWButton';
import { AuthModal, AuthModalType } from '../modals/AuthModal';
import './404.scss';

type PageNotFoundProps = { title?: string; message?: string };

export const PageNotFound = (props: PageNotFoundProps) => {
const { message } = props;

const user = useUserStore();

const { authModalType, setAuthModalType } = useAuthModalStore();

return (
<CWEmptyState
iconName="cautionCircle"
content={
message ||
`
This page may not be visible to the public.
If it belongs to a private thread or community, try logging in.
<div className="PageNotFound">
<CWEmptyState
iconName="cautionCircle"
content={
message ||
`
This page is private.
Please Sign in to view or join the conversation.
`
}
/>
}
/>
{!user.isLoggedIn && (
<CWButton
buttonType="primary"
label="Sign in"
onClick={() => setAuthModalType(AuthModalType.SignIn)}
/>
)}
<AuthModal
type={AuthModalType.SignIn}
onClose={() => setAuthModalType(undefined)}
isOpen={!!authModalType}
/>
</div>
);
};

0 comments on commit 2fa11c6

Please sign in to comment.