// @flow import * as ICONS from 'constants/icons'; import React, { useState } from 'react'; import usePersistedState from 'effects/use-persisted-state'; import Button from 'component/button'; import ClaimList from 'component/claimList'; import Paginate from 'component/common/paginate'; import { PAGE_SIZE } from 'constants/claim'; import { Form } from 'component/common/form-components/form'; import Icon from 'component/common/icon'; import { FormField } from 'component/common/form-components/form-field'; import { withRouter } from 'react-router'; import classnames from 'classnames'; import Yrbl from 'component/yrbl'; import { PURCHASES_PAGE_SIZE } from 'page/library/view'; import Spinner from 'component/spinner'; type Props = { fetchingFileList: boolean, downloadedUrls: Array, downloadedUrlsCount: ?number, history: { replace: string => void }, query: string, doPurchaseList: () => void, myDownloads: Array, myPurchases: Array, myPurchasesCount: ?number, fetchingMyPurchases: boolean, }; const VIEW_DOWNLOADS = 'view_download'; const VIEW_PURCHASES = 'view_purchases'; function FileListDownloaded(props: Props) { const { history, query, downloadedUrlsCount, myPurchasesCount, myPurchases, myDownloads, fetchingFileList, fetchingMyPurchases, } = props; const loading = fetchingFileList || fetchingMyPurchases; const [viewMode, setViewMode] = usePersistedState('library-view-mode', VIEW_PURCHASES); const [searchQuery, setSearchQuery] = useState(''); function handleInputChange(e) { const { value } = e.target; if (value !== searchQuery) { setSearchQuery(value); history.replace(`?query=${value}&page=1`); } } return ( <>
{}} className="wunderbar--inline">
{IS_WEB && viewMode === VIEW_DOWNLOADS ? (

{__("Download the app to track files you've viewed and downloaded.")}

} />
) : (
null} empty={ viewMode === VIEW_PURCHASES && !query ? (
{__('No purchases found.')}
) : ( __('No results for %query%', { query }) ) } uris={viewMode === VIEW_PURCHASES ? myPurchases : myDownloads} loading={loading} /> {!query && ( )}
)} ); } export default withRouter(FileListDownloaded);