3034f4ce6c
* bring in ody styles; modify; cleanup * workflow * workflow * v0.52.6-alpha.teststyles.1 * fix hook * v0.52.6-alpha.teststyles.2 * style fixes * fix pagination styling * v0.52.6-alpha.teststyles.3 * wallet icon was bad * restore deploy script * fixes * fix player close button * modal inputs * cleanup * cleanup * fix staked indicator * fix profile menu button skel delay * fix view-all-playlists hover * fix overlay buttons on collection page * fix header buttons
82 lines
2.7 KiB
JavaScript
82 lines
2.7 KiB
JavaScript
// @flow
|
|
import React from 'react';
|
|
import classnames from 'classnames';
|
|
import Page from 'component/page';
|
|
import ClaimListDiscover from 'component/claimListDiscover';
|
|
import ClaimEffectiveAmount from 'component/claimEffectiveAmount';
|
|
import SearchTopClaim from 'component/searchTopClaim';
|
|
import * as CS from 'constants/claim_search';
|
|
import Button from 'component/button';
|
|
import I18nMessage from 'component/i18nMessage';
|
|
import * as PAGES from 'constants/pages';
|
|
|
|
type Props = {
|
|
name: string,
|
|
beginPublish: (string) => void,
|
|
};
|
|
|
|
function TopPage(props: Props) {
|
|
const { name, beginPublish } = props;
|
|
const [channelActive, setChannelActive] = React.useState(false);
|
|
// if the query was actually '@name', still offer repost for 'name'
|
|
const queryName = name[0] === '@' ? name.slice(1) : name;
|
|
return (
|
|
<Page className="topPage-wrapper">
|
|
<SearchTopClaim query={name} hideLink setChannelActive={setChannelActive} />
|
|
<ClaimListDiscover
|
|
name={channelActive ? `@${queryName}` : queryName}
|
|
defaultFreshness={CS.FRESH_ALL}
|
|
defaultOrderBy={CS.ORDER_BY_TOP}
|
|
meta={
|
|
<div className="search__top-links">
|
|
<I18nMessage
|
|
tokens={{
|
|
repost: (
|
|
<Button
|
|
button="secondary"
|
|
navigate={`/$/${PAGES.REPOST_NEW}?to=${queryName}`}
|
|
label={__('Repost Here')}
|
|
/>
|
|
),
|
|
publish: (
|
|
<Button button="secondary" onClick={() => beginPublish(queryName)} label={__('Publish Here')} />
|
|
),
|
|
}}
|
|
>
|
|
%repost% %publish%
|
|
</I18nMessage>
|
|
</div>
|
|
}
|
|
includeSupportAction
|
|
renderProperties={(claim) => (
|
|
<span className="claim-preview__custom-properties">
|
|
{claim.meta.is_controlling && <span className="help--inline">{__('Currently winning')}</span>}
|
|
<ClaimEffectiveAmount uri={claim.repost_url || claim.canonical_url} />
|
|
</span>
|
|
)}
|
|
header={
|
|
<div className="claim-search__menu-group">
|
|
<Button
|
|
label={queryName}
|
|
button="alt"
|
|
onClick={() => setChannelActive(false)}
|
|
className={classnames('button-toggle', {
|
|
'button-toggle--active': !channelActive,
|
|
})}
|
|
/>
|
|
<Button
|
|
label={`@${queryName}`}
|
|
button="alt"
|
|
onClick={() => setChannelActive(true)}
|
|
className={classnames('button-toggle', {
|
|
'button-toggle--active': channelActive,
|
|
})}
|
|
/>
|
|
</div>
|
|
}
|
|
/>
|
|
</Page>
|
|
);
|
|
}
|
|
|
|
export default TopPage;
|