fix share on Web (spee.ch) URLs

This commit is contained in:
Thomas Zarebczan 2018-06-06 15:22:28 -04:00
parent 7571e96e65
commit 23a26c075a
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';
type Props = {
uri: ?string,
claimId: ?string,
claimName: ?string,
};
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
iconRight={icons.GLOBE}
icon={icons.GLOBE}
button="alt"
label={__('View on Web')}
href={`http://spee.ch/${uri}`}
href={`http://spee.ch/${speechURL}`}
/>
) : null;
};

View file

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

View file

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