forked from globalfund/data-explorer-client
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from zimmerman-team/feat/DX-1504
feat: DX-1504, DX-1552, DX-1502 Not authorized page view
- Loading branch information
Showing
13 changed files
with
301 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
153 changes: 131 additions & 22 deletions
153
src/app/modules/common/not-authorized-message/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,139 @@ | ||
import React from "react"; | ||
import { WarningOutlined } from "@material-ui/icons"; | ||
import { ErrorOutlineRounded } from "@material-ui/icons"; | ||
import HomeFooter from "app/modules/home-module/components/Footer"; | ||
import { ReactComponent as GoogleIcon } from "app/modules/onboarding-module/asset/google-img.svg"; | ||
import { ReactComponent as LinkedInIcon } from "app/modules/onboarding-module/asset/linkedIn-img.svg"; | ||
import { Container } from "@material-ui/core"; | ||
import { useAuth0 } from "@auth0/auth0-react"; | ||
import { socialAuth } from "app/utils/socialAuth"; | ||
|
||
export function NotAuthorizedMessageModule(props: { | ||
asset: "chart" | "report"; | ||
asset: "chart" | "report" | "dataset"; | ||
action: "view" | "edit" | "delete"; | ||
name?: string; | ||
}) { | ||
const { isAuthenticated } = useAuth0(); | ||
return ( | ||
<div | ||
css={` | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
color: #e75656; | ||
font-size: 24px; | ||
line-height: 15px; | ||
font-family: "GothamNarrow-Bold", sans-serif; | ||
text-align: center; | ||
`} | ||
> | ||
<WarningOutlined htmlColor="#e75656" fontSize="large" /> | ||
<p> | ||
You are not authorized to {props.action} this {props.asset} | ||
</p> | ||
</div> | ||
<> | ||
<div | ||
css={` | ||
background-color: #f4f4f4; | ||
height: 50px; | ||
display: flex; | ||
align-items: center; | ||
`} | ||
> | ||
<Container maxWidth="lg"> | ||
<h1 | ||
css={` | ||
font-size: 24px; | ||
margin: 0; | ||
font-family: Inter; | ||
font-weight: 700; | ||
color: #231d2c; | ||
max-width: 100%; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
line-height: normal; | ||
`} | ||
> | ||
{props.name} | ||
</h1> | ||
</Container> | ||
</div> | ||
<div | ||
// 422px is the footer height and 98px is the header height | ||
css={` | ||
width: 100%; | ||
height: calc(100vh - 422px - 98px); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
color: #e75656; | ||
text-align: center; | ||
`} | ||
> | ||
<ErrorOutlineRounded | ||
htmlColor="#e75656" | ||
css={` | ||
font-size: 48px; | ||
`} | ||
/>{" "} | ||
<p | ||
css={` | ||
font-family: "GothamNarrow-Bold", sans-serif; | ||
font-size: 18px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: normal; | ||
margin: 0; | ||
margin-top: 16px; | ||
`} | ||
> | ||
{isAuthenticated ? ( | ||
<> | ||
You are not authorized to {props.action} this {props.asset}. | ||
Please contact <br /> your administrator. | ||
</> | ||
) : ( | ||
<> | ||
You are not authorized to {props.action} this {props.asset}. | ||
Please sign in <br /> or contact your administrator. | ||
</> | ||
)} | ||
</p> | ||
{!isAuthenticated && ( | ||
<div | ||
id="auth-buttons" | ||
css={` | ||
gap: 20px; | ||
width: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: center; | ||
margin-top: 32px; | ||
> button { | ||
gap: 10px; | ||
color: #fff; | ||
display: flex; | ||
padding: 9px 18px !important; | ||
background: #a1a2ff; | ||
align-items: center; | ||
justify-content: center; | ||
text-transform: uppercase; | ||
border-radius: 30px; | ||
outline: none; | ||
border: none; | ||
font-family: "Inter", sans-serif; | ||
font-weight: 700; | ||
font-size: 14px; | ||
text-transform: uppercase; | ||
text-decoration: none; | ||
:hover { | ||
opacity: 0.8; | ||
cursor: pointer; | ||
} | ||
> svg { | ||
transform: scale(0.8); | ||
} | ||
} | ||
`} | ||
> | ||
<button onClick={() => socialAuth("google-oauth2")}> | ||
<GoogleIcon /> sign in for free | ||
</button> | ||
<button onClick={() => socialAuth("linkedin")}> | ||
<LinkedInIcon /> sign in for free | ||
</button> | ||
</div> | ||
)} | ||
</div> | ||
<HomeFooter /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.