Add ability to search through publishes. #7535

Merged
Ruk33 merged 8 commits from 3139-ability-to-search-through-publishes into master 2022-04-15 05:06:00 +02:00
2 changed files with 69 additions and 61 deletions
Showing only changes of commit 8ede588b38 - Show all commits

View file

@ -2306,5 +2306,6 @@
"Privacy": "Privacy", "Privacy": "Privacy",
"LBRY takes privacy and choice seriously. Is it ok if we monitor performance and help creators track their views?": "LBRY takes privacy and choice seriously. Is it ok if we monitor performance and help creators track their views?", "LBRY takes privacy and choice seriously. Is it ok if we monitor performance and help creators track their views?": "LBRY takes privacy and choice seriously. Is it ok if we monitor performance and help creators track their views?",
"Yes, share with LBRY": "Yes, share with LBRY", "Yes, share with LBRY": "Yes, share with LBRY",
"Search Uploads": "Search Uploads",
"--end--": "--end--" "--end--": "--end--"
} }

View file

@ -4,6 +4,7 @@ import * as ICONS from 'constants/icons';
import React, { useEffect, useMemo } from 'react'; import React, { useEffect, useMemo } from 'react';
import Button from 'component/button'; import Button from 'component/button';
import ClaimList from 'component/claimList'; import ClaimList from 'component/claimList';
import ClaimPreview from 'component/claimPreview';
import Page from 'component/page'; import Page from 'component/page';
import Paginate from 'component/common/paginate'; import Paginate from 'component/common/paginate';
import { PAGE_PARAM, PAGE_SIZE_PARAM } from 'constants/claim'; import { PAGE_PARAM, PAGE_SIZE_PARAM } from 'constants/claim';
@ -126,67 +127,73 @@ function FileListPublished(props: Props) {
return ( return (
<Page> <Page>
<div className="card-stack"> <div className="card-stack">
<ClaimList {!!urls && (
noEmpty <>
header={ <ClaimList
<span> noEmpty
<Button header={
button="alt" <span>
label={__('All')} <Button
aria-label={__('All uploads')} button="alt"
onClick={() => setFilterBy(FILTER_ALL)} label={__('All')}
className={classnames(`button-toggle`, { aria-label={__('All uploads')}
'button-toggle--active': filterBy === FILTER_ALL, onClick={() => setFilterBy(FILTER_ALL)}
})} className={classnames(`button-toggle`, {
/> 'button-toggle--active': filterBy === FILTER_ALL,
<Button })}
button="alt" />
label={__('Uploads')} <Button
onClick={() => setFilterBy(FILTER_UPLOADS)} button="alt"
className={classnames(`button-toggle`, { label={__('Uploads')}
'button-toggle--active': filterBy === FILTER_UPLOADS, onClick={() => setFilterBy(FILTER_UPLOADS)}
})} className={classnames(`button-toggle`, {
/> 'button-toggle--active': filterBy === FILTER_UPLOADS,
<Button })}
button="alt" />
label={__('Reposts')} <Button
onClick={() => { button="alt"
setFilterBy(FILTER_REPOSTS); label={__('Reposts')}
setSearchText(''); onClick={() => {
}} setFilterBy(FILTER_REPOSTS);
className={classnames(`button-toggle`, { setSearchText('');
'button-toggle--active': filterBy === FILTER_REPOSTS, }}
})} className={classnames(`button-toggle`, {
/> 'button-toggle--active': filterBy === FILTER_REPOSTS,
</span> })}
} />
headerAltControls={ </span>
<div className="card__actions--inline"> }
<Button headerAltControls={
button="alt" <div className="card__actions--inline">
label={__('Refresh')} <Button
icon={ICONS.REFRESH} button="alt"
disabled={fetching} label={__('Refresh')}
onClick={fetchAllMyClaims} icon={ICONS.REFRESH}
/> disabled={fetching}
<Form onSubmit={() => {}} className="wunderbar--inline"> onClick={fetchAllMyClaims}
<Icon icon={ICONS.SEARCH} /> />
<FormField <Form onSubmit={() => {}} className="wunderbar--inline">
className="wunderbar__input--inline" <Icon icon={ICONS.SEARCH} />
value={searchText} <FormField
onChange={(e) => setSearchText(e.target.value)} className="wunderbar__input--inline"
type="text" value={searchText}
placeholder={__('Search Uploads')} onChange={(e) => setSearchText(e.target.value)}
disabled={filterBy === FILTER_REPOSTS} type="text"
/> placeholder={__('Search Uploads')}
</Form> disabled={filterBy === FILTER_REPOSTS}
</div> />
} </Form>
persistedStorageKey="claim-list-published" </div>
uris={urls} }
loading={fetching} persistedStorageKey="claim-list-published"
/> uris={fetching ? [] : urls}
<Paginate totalPages={urlTotal > 0 ? Math.ceil(urlTotal / Number(pageSize)) : 1} /> loading={fetching}
/>
{fetching &&
new Array(Number(pageSize)).fill(1).map((x, i) => <ClaimPreview key={i} placeholder="loading" />)}
<Paginate totalPages={urlTotal > 0 ? Math.ceil(urlTotal / Number(pageSize)) : 1} />
</>
)}
</div> </div>
{!fetching && myClaims.length === 0 && ( {!fetching && myClaims.length === 0 && (
<React.Fragment> <React.Fragment>