import React, { useRef, useEffect } from 'react'; import { useSelector } from 'react-redux'; import { useHistory } from 'react-router-dom'; import SnapSettingsCard from '../../../../components/app/snaps/snap-settings-card'; import { useI18nContext } from '../../../../hooks/useI18nContext'; import { JustifyContent, AlignItems, IconColor, Color, TEXT_ALIGN, FLEX_DIRECTION, Size, } from '../../../../helpers/constants/design-system'; import Box from '../../../../components/ui/box'; import { SNAPS_VIEW_ROUTE } from '../../../../helpers/constants/routes'; import { getSnapsList } from '../../../../selectors'; import { handleSettingsRefs } from '../../../../helpers/utils/settings-search'; import { BannerTip, BannerTipLogoType, ButtonLink, Icon, IconName, IconSize, Text, } from '../../../../components/component-library'; const SnapListTab = () => { const t = useI18nContext(); const history = useHistory(); const settingsRef = useRef(); const onClick = (snap) => { history.push(`${SNAPS_VIEW_ROUTE}/${encodeURIComponent(snap.id)}`); }; useEffect(() => { handleSettingsRefs(t, t('snaps'), settingsRef); }, [settingsRef, t]); const snapsList = useSelector((state) => getSnapsList(state)); return (
{snapsList.length ? (
{snapsList.map((snap) => { return ( { onClick(snap); }} snapId={snap.id} /> ); })}
) : ( {t('noSnaps')} {`${t('learnMoreUpperCase')}`} )}
); }; export default SnapListTab;