add code for local links

This commit is contained in:
btzr-io 2018-05-11 00:29:53 -06:00
parent 539e8e360c
commit 8127db345b
2 changed files with 17 additions and 0 deletions

View file

@ -1,9 +1,11 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doNotify } from 'lbry-redux'; import { doNotify } from 'lbry-redux';
// import { doNavigate } from 'redux/actions/navigation';
import ExternalLink from './view'; import ExternalLink from './view';
const select = () => ({}); const select = () => ({});
const perform = dispatch => ({ const perform = dispatch => ({
// navigate: (path, params) => dispatch(doNavigate(path, params)),
openModal: (modal, props) => dispatch(doNotify(modal, props)), openModal: (modal, props) => dispatch(doNotify(modal, props)),
}); });

View file

@ -7,6 +7,7 @@ type Props = {
href: string, href: string,
title?: string, title?: string,
children: React.Node, children: React.Node,
// navigate: (string, ?{}) => void,
openModal: ({ id: string }, { uri: string }) => void, openModal: ({ id: string }, { uri: string }) => void,
}; };
@ -40,6 +41,20 @@ class ExternalLink extends React.PureComponent<Props> {
); );
} }
/* React-remark blocks the lbry protocol requires an external fix
// Return local link if valid lbry uri
if (protocol && protocol[0] === 'lbry:') {
element = (
<Button
button="link"
title={title}
onClick={() => navigate('/show', { uri: href })}
>
{children}
</Button>
);
} */
return element; return element;
} }