-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(frontend): Add error page for unsubscribed users (#87)
- Loading branch information
1 parent
2d4df2e
commit 86fb5b9
Showing
12 changed files
with
253 additions
and
1,487 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
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2022,2024 BMW Group AG | ||
* Copyright (c) 2022,2024 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
********************************************************************************/ | ||
|
||
import { AboutCard, PageHeader } from "@catena-x/portal-shared-components"; | ||
import legalJson from "../../../legal-notice.json"; | ||
import { Link } from "@mui/icons-material"; | ||
import { Breadcrumb, Typography } from "@catena-x/portal-shared-components"; | ||
import { PageBreadcrumb } from "../PageBreadCrumb/PageBreadcrumb"; | ||
import "./error.scss"; | ||
import { ErrorPage } from "@catena-x/portal-shared-components"; | ||
import { FooterPortal } from "../Footer/FooterPortal"; | ||
import NavigationBar from "../NavigationBar/NavigationBar"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { getPortalLink } from "../../services/EnvironmentService"; | ||
const ErrorPageCR = () => { | ||
const navigate = useNavigate(); | ||
|
||
return ( | ||
<div className="Error"> | ||
<NavigationBar /> | ||
<PageHeader title="Error" topPage={false} headerHeight={200}> | ||
|
||
</PageHeader> | ||
<ErrorPage | ||
additionalDescription="Please contact your admin." | ||
color="gray" | ||
description="The server encountered an internal error or misconfiguration and was unable to complete your request." | ||
header="401 (Unauthorized)" | ||
homeButtonTitle="Homepage" | ||
hasNavigation={false} | ||
onHomeClick={() => { | ||
window.location.href = getPortalLink() + "/appmarketplace"; | ||
}} | ||
onReloadClick={() => { | ||
navigate("/"); | ||
}} | ||
reloadButtonTitle="Reload Page" | ||
title="Oops, Something went wrong, subscribe to Country Risk App not found." | ||
/> | ||
<FooterPortal></FooterPortal> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ErrorPageCR; |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2022,2024 BMW Group AG | ||
* Copyright (c) 2022,2024 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
********************************************************************************/ | ||
|
||
.ErrorPage { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
font-weight: 100; | ||
font-size: small; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2022,2024 BMW Group AG | ||
* Copyright (c) 2022,2024 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
********************************************************************************/ | ||
import React, { useState, useEffect } from "react"; | ||
import App from "../../../App"; | ||
import ErrorPageCR from "../ErrorPage/ErrorPageCR"; | ||
|
||
const RootComponent = ({ user }) => { | ||
const [shouldShowErrorPage, setShouldShowErrorPage] = useState(false); | ||
|
||
useEffect(() => { | ||
if (user.access) { | ||
setShouldShowErrorPage(false); | ||
} else { | ||
setShouldShowErrorPage(true); | ||
} | ||
}, [user]); | ||
|
||
return shouldShowErrorPage ? <ErrorPageCR /> : <App />; | ||
}; | ||
|
||
export default RootComponent; |
Oops, something went wrong.