Merge pull request #1559 from lbryio/speechURLs

fix share on Web (spee.ch) URLs
This commit is contained in:
Sean Yesmunt 2018-06-06 22:16:18 -04:00 committed by GitHub
commit 493053ca55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 13 deletions

View file

@ -4,18 +4,22 @@ import * as icons from 'constants/icons';
import Button from 'component/button'; import Button from 'component/button';
type Props = { type Props = {
uri: ?string, claimId: ?string,
claimName: ?string,
}; };
export default (props: Props) => { export default (props: Props) => {
const { uri } = props; const { claimId, claimName } = props;
const speechURL = claimName.startsWith('@')
? `${claimName}:${claimId}`
: `${claimId}/${claimName}`;
return uri ? ( return claimId && claimName ? (
<Button <Button
iconRight={icons.GLOBE} icon={icons.GLOBE}
button="alt" button="alt"
label={__('View on Web')} label={__('View on Web')}
href={`http://spee.ch/${uri}`} href={`http://spee.ch/${speechURL}`}
/> />
) : null; ) : null;
}; };

View file

@ -85,7 +85,7 @@ class ChannelPage extends React.PureComponent<Props> {
<h1>{name}</h1> <h1>{name}</h1>
<div className="card__actions card__actions--no-margin"> <div className="card__actions card__actions--no-margin">
<SubscribeButton uri={permanentUrl} channelName={name} /> <SubscribeButton uri={permanentUrl} channelName={name} />
<ViewOnWebButton uri={`${name}:${claimId}`} /> <ViewOnWebButton claimId={claimId} claimName={name} />
</div> </div>
</section> </section>
<section>{contentList}</section> <section>{contentList}</section>

View file

@ -183,7 +183,7 @@ class FilePage extends React.Component<Props> {
<React.Fragment> <React.Fragment>
<Button <Button
button="alt" button="alt"
iconRight="Send" icon="Send"
label={__('Enjoy this? Send a tip')} label={__('Enjoy this? Send a tip')}
onClick={() => openModal({ id: MODALS.SEND_TIP }, { uri })} onClick={() => openModal({ id: MODALS.SEND_TIP }, { uri })}
/> />
@ -191,12 +191,7 @@ class FilePage extends React.Component<Props> {
</React.Fragment> </React.Fragment>
)} )}
{speechSharable && ( {speechSharable && (
<ViewOnWebButton <ViewOnWebButton claimId={claim.claim_id} claimName={claim.name} />
uri={buildURI({
claimId: claim.claim_id,
contentName: claim.name,
}).slice(7)}
/>
)} )}
</div> </div>
</div> </div>