fix share on Web (spee.ch) URLs
This commit is contained in:
parent
7571e96e65
commit
23a26c075a
3 changed files with 12 additions and 13 deletions
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue