This commit is contained in:
Belén Curcio
2018-07-26 11:21:12 -03:00
parent db09033367
commit f51f989021
2 changed files with 22 additions and 12 deletions
@@ -21,22 +21,27 @@ const PermalinkView: StatelessComponent<InnerProps> = props => {
if (props.comment) {
// TODO (bc) temporary needed to pass the assetID to go back to the correct asset until the backend
// returns the correct asset url
const assetURL = `${location.origin}/?assetID=${query.assetID}`;
let assetURL: string = "";
if (query.assetID) {
assetURL = `${location.origin}/?assetID=${query.assetID}`;
}
return (
<div className={styles.root}>
<Logo />
<Flex direction="column" className={styles.comment}>
<CommentContainer data={props.comment} />
<Button
variant="filled"
color="primary"
onClick={() => {
window.location.href = assetURL;
}}
>
Back to the Stream
</Button>
{assetURL && (
<Button
variant="filled"
color="primary"
onClick={() => {
window.location.href = assetURL;
}}
>
Back to the Stream
</Button>
)}
</Flex>
</div>
);
@@ -10,8 +10,13 @@ interface InnerProps {
commentID: string;
}
export const PermalinkContainer: StatelessComponent<InnerProps> = props => {
return <Permalink {...props} assetURL={props.local.assetURL} />;
export const PermalinkContainer: StatelessComponent<InnerProps> = ({
local,
commentID,
}) => {
return local.assetURL ? (
<Permalink assetURL={local.assetURL} commentID={commentID} />
) : null;
};
const enhanced = withLocalStateContainer<Local>(