import './style.scss'; import { useTranslate } from 'i18n-calypso'; import { useCallback, useState } from 'react'; import { useDispatch } from 'react-redux'; import Notice from 'calypso/components/notice'; import { AddSitesForm } from 'calypso/landing/subscriptions/components/add-sites-form'; import { SubscriptionManagerContextProvider, SubscriptionsPortal, } from 'calypso/landing/subscriptions/components/subscription-manager-context'; import ReaderRedditIcon from 'calypso/reader/components/icons/reddit-icon'; import { useSelector } from 'calypso/state'; import { isCurrentUserEmailVerified } from 'calypso/state/current-user/selectors'; import { requestFollows } from 'calypso/state/reader/follows/actions'; const Reddit = () => { const translate = useTranslate(); const dispatch = useDispatch(); const isEmailVerified = useSelector( isCurrentUserEmailVerified ); const [ hasFeedPreview, setHasFeedPreview ] = useState< boolean >( false ); const onChangeFeedPreview = useCallback( ( hasPreview: boolean ): void => { setHasFeedPreview( hasPreview ); }, [] ); const onSubscribeToggle = useCallback( (): void => { setHasFeedPreview( false ); // Close the feed preview when the subscription is toggled. dispatch( requestFollows() ); // In other places we show subscriptions table due to which list get refreshed automatically. Here we need to refresh the list manually. }, [ dispatch ] ); return (
{ ! isEmailVerified && ( { translate( 'Account Settings' ) } ) }
{ ! hasFeedPreview ? (

{ translate( 'Common Reddit URLs' ) }

  • { translate( 'Front page:' ) } { ' https://www.reddit.com/.rss' }
  • { translate( 'A subreddit:' ) } { ' https://www.reddit.com/r/{ SUBREDDIT }/.rss' }
  • { translate( 'A user:' ) } { ' https://www.reddit.com/user/{ REDDITOR }/.rss' }
  • { translate( 'User comments:' ) } { ' https://www.reddit.com/user/{ REDDITOR }/comments/.rss' }
  • { translate( 'User submissions:' ) } { ' https://www.reddit.com/user/{ REDDITOR }/submitted/.rss' }
  • { translate( 'Search result:' ) } { ' https://www.reddit.com/search.rss?q={ QUERY }' }
) : null }
); }; export default Reddit;