so much discovery I can't take it #2617

Merged
neb-b merged 20 commits from fixes into master 2019-07-23 01:45:30 +02:00
3 changed files with 17 additions and 10 deletions
Showing only changes of commit 68dd41cbbc - Show all commits

View file

@ -61,9 +61,16 @@ function ClaimPreview(props: Props) {
} = props; } = props;
const haventFetched = claim === undefined; const haventFetched = claim === undefined;
const abandoned = !isResolvingUri && !claim && !placeholder; const abandoned = !isResolvingUri && !claim && !placeholder;
const { isChannel } = parseURI(uri);
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0; const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
let isValid;
try {
parseURI(uri);
isValid = true;
} catch (e) {
isValid = false;
}
const isChannel = isValid ? parseURI(uri).isChannel : false;
let shouldHide = abandoned || (!claimIsMine && obscureNsfw && nsfw); let shouldHide = abandoned || (!claimIsMine && obscureNsfw && nsfw);
// This will be replaced once blocking is done at the wallet server level // This will be replaced once blocking is done at the wallet server level
@ -90,7 +97,7 @@ function ClaimPreview(props: Props) {
} }
useEffect(() => { useEffect(() => {
if (!isResolvingUri && haventFetched && uri) { if (isValid && !isResolvingUri && haventFetched && uri) {
resolveUri(uri); resolveUri(uri);
} }
}, [isResolvingUri, uri, resolveUri, haventFetched]); }, [isResolvingUri, uri, resolveUri, haventFetched]);
@ -118,7 +125,7 @@ function ClaimPreview(props: Props) {
onContextMenu={handleContextMenu} onContextMenu={handleContextMenu}
className={classnames('claim-preview', { className={classnames('claim-preview', {
'claim-preview--large': type === 'large', 'claim-preview--large': type === 'large',
'claim-preview--visited': hasVisitedUri, 'claim-preview--visited': !isChannel && hasVisitedUri,
'claim-preview--pending': pending, 'claim-preview--pending': pending,
})} })}
> >

View file

@ -44,10 +44,12 @@ class TransactionListItem extends React.PureComponent<Props> {
const { amount, claim_id: claimId, claim_name: name, date, fee, txid, type } = transaction; const { amount, claim_id: claimId, claim_name: name, date, fee, txid, type } = transaction;
// Ensure the claim name exists and is valid // Ensure the claim name exists and is valid
let uri;
let claimName = name; let claimName = name;
if (claimName) { try {
({ claimName } = parseURI(name)); ({ claimName } = parseURI(name));
} uri = buildURI({ claimName: claimName, claimId });
} catch (e) {}
const dateFormat = { const dateFormat = {
month: 'short', month: 'short',
@ -72,9 +74,7 @@ class TransactionListItem extends React.PureComponent<Props> {
</td> </td>
<td className="table__item--actionable"> <td className="table__item--actionable">
{reward && <span>{reward.reward_title}</span>} {reward && <span>{reward.reward_title}</span>}
{claimName && claimId && ( {uri ? <Button button="link" navigate={uri} label={claimName} /> : claimName}
<Button button="link" navigate={buildURI({ claimName: claimName, claimId })} label={claimName} />
)}
</td> </td>
<td> <td>

View file

@ -6646,9 +6646,9 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
yargs "^13.2.2" yargs "^13.2.2"
zstd-codec "^0.1.1" zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#15e36688fb762b0b424a837de0f5a405b05463a2: lbry-redux@lbryio/lbry-redux#87e01209f56cb3326c12ffc114072c48f72c1a3e:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/15e36688fb762b0b424a837de0f5a405b05463a2" resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/87e01209f56cb3326c12ffc114072c48f72c1a3e"
dependencies: dependencies:
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"