import React, { useEffect } from "react" import { useTranslation } from "react-i18next" import useOutsideClick from "../../../hooks/use-outside-click" import { usePolling } from "../../../providers/polling-provider" import Spinner from "../../atoms/spinner" import SadFaceIcon from "../../fundamentals/icons/sad-face-icon" import SidedMouthFaceIcon from "../../fundamentals/icons/sided-mouth-face" import BatchJobActivityList from "../batch-jobs-activity-list" const ActivityDrawer = ({ onDismiss }) => { const { t } = useTranslation() const ref = React.useRef(null) const { batchJobs, hasPollingError, refetch } = usePolling() useOutsideClick(onDismiss, ref) useEffect(() => { refetch() }, []) return (
{t("activity-drawer-activity", "Activity")}
{!hasPollingError ? ( batchJobs ? ( ) : ( ) ) : ( )}
) } const EmptyActivityDrawer = () => { const { t } = useTranslation() return (
{t("activity-drawer-no-notifications-title", "It's quiet in here...")} {t( "activity-drawer-no-notifications-description", "You don't have any notifications at the moment, but once you do they will live here." )}
) } const ErrorActivityDrawer = () => { const { t } = useTranslation() return (
{t("activity-drawer-error-title", "Oh no...")} {t( "activity-drawer-error-description", "Something went wrong while trying to fetch your notifications - We will keep trying!" )}
{t("activity-drawer-processing", "Processing...")}
) } export default ActivityDrawer