/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ import React from "react"; import { useCurrentAuthenticatedUser } from "../hooks"; import { useHistory } from "react-router-dom"; import { useTranslation } from "react-i18next"; import Button from "../components/Button"; import CardGroup from "../components/CardGroup"; import Link from "../components/Link"; const { Card, CardFooter, CardBody } = CardGroup; function AdminHome() { const history = useHistory(); const currentAuthenticatedUser = useCurrentAuthenticatedUser(); const { t } = useTranslation(); const onCreateDashboard = () => { history.push("/admin/dashboard/create"); }; const onViewDashboards = () => { history.push("/admin/dashboards"); }; const onManageUsers = () => { history.push("/admin/users"); }; const onViewSettings = () => { history.push("/admin/settings"); }; if ( !currentAuthenticatedUser || (!currentAuthenticatedUser.isEditor && !currentAuthenticatedUser.isAdmin) ) { return null; } return (

{t("WelcomeToPDoA")}

{`${ currentAuthenticatedUser.isAdmin ? `${t("WhatYouCanDoAsAdmin")}` : `${t("WhatYouCanDoAsNotAdmin")}` }`}

{currentAuthenticatedUser.isEditor ? (

{t("BuildDraftDashboards")}

{t("ViewDashboardsCreatedByOthers")}

) : ( "" )} {currentAuthenticatedUser.isAdmin ? (

{t("BuildDraftDashboards")}

{t("AllowOtherUsers")}

{t("PersonalizeDashboard")}

) : ( "" )}

{t("PDoASite")}
{t("WantToViewPublishedSite")}

{t("ViewPublishedSite")}
); } export default AdminHome;