import { Card } from '@automattic/components'; import { useTranslate } from 'i18n-calypso'; import { useDispatch, useSelector } from 'react-redux'; import ReaderExportButton from 'calypso/blocks/reader-export-button'; import { READER_EXPORT_TYPE_LIST } from 'calypso/blocks/reader-export-button/constants'; import QueryReaderList from 'calypso/components/data/query-reader-list'; import QueryReaderListItems from 'calypso/components/data/query-reader-list-items'; import EmptyContent from 'calypso/components/empty-content'; import NavigationHeader from 'calypso/components/navigation-header'; import SectionNav from 'calypso/components/section-nav'; import NavItem from 'calypso/components/section-nav/item'; import NavTabs from 'calypso/components/section-nav/tabs'; import { preventWidows } from 'calypso/lib/formatting'; import ReaderMain from 'calypso/reader/components/reader-main'; import Missing from 'calypso/reader/list-stream/missing'; import { createReaderList, updateReaderList } from 'calypso/state/reader/lists/actions'; import { getListByOwnerAndSlug, getListItems, isCreatingList as isCreatingListSelector, isUpdatingList as isUpdatingListSelector, isMissingByOwnerAndSlug, } from 'calypso/state/reader/lists/selectors'; import ItemAdder from './item-adder'; import ListDelete from './list-delete'; import ListForm from './list-form'; import ListItem from './list-item'; import SubscriptionItemAdder from './subscription-item-adder'; import './style.scss'; function Details( { list } ) { const dispatch = useDispatch(); const isUpdatingList = useSelector( isUpdatingListSelector ); return ( dispatch( updateReaderList( newList ) ) } /> ); } function Items( { list, listItems, owner } ) { const translate = useTranslate(); if ( ! listItems ) { return { translate( 'Loading…' ) }; } return ( <> { listItems?.length > 0 && ( <>

{ translate( 'Added sites' ) }

{ listItems.map( ( item ) => ( ) ) } ) } ); } function Export( { list, listItems } ) { const translate = useTranslate(); return (

{ translate( 'You can export this list to use on other services. The file will be in OPML format.' ) }

); } function ReaderListCreate() { const translate = useTranslate(); const dispatch = useDispatch(); const isCreatingList = useSelector( isCreatingListSelector ); return ( dispatch( createReaderList( list ) ) } /> ); } function ReaderListEdit( props ) { const { selectedSection } = props; const translate = useTranslate(); const list = useSelector( ( state ) => getListByOwnerAndSlug( state, props.owner, props.slug ) ); const isMissing = useSelector( ( state ) => isMissingByOwnerAndSlug( state, props.owner, props.slug ) ); const listItems = useSelector( ( state ) => list ? getListItems( state, list.ID ) : undefined ); const sectionProps = { ...props, list, listItems }; // Only the list owner can manage the list if ( list && ! list.is_owner ) { return ( ); } // The list does not exist if ( isMissing ) { return ; } return ( <> { ! list && } { ! listItems && list && } { ! list && { translate( 'Loading…' ) } } { list && ( <> { translate( 'Details' ) } { translate( 'Sites' ) } { translate( 'Export' ) } { ! list?.is_immutable && ( { translate( 'Delete' ) } ) } { selectedSection === 'details' &&
} { selectedSection === 'items' && } { selectedSection === 'export' && } { selectedSection === 'delete' && } ) } ); } export default function ReaderListManage( props ) { return props.isCreateForm ? : ; }