mirror of
https://github.com/wassname/talk.git
synced 2026-09-17 12:50:55 +08:00
Creating assetURL in localState
S
This commit is contained in:
@@ -5,21 +5,18 @@ import PermalinkPopover from "./PermalinkPopover";
|
||||
|
||||
interface InnerProps {
|
||||
commentID: string;
|
||||
origin: string | null;
|
||||
assetID: string | null;
|
||||
assetURL: string | null;
|
||||
}
|
||||
|
||||
class Permalink extends React.Component<InnerProps> {
|
||||
public render() {
|
||||
const { commentID, origin, assetID } = this.props;
|
||||
const { commentID, assetURL } = this.props;
|
||||
return (
|
||||
<Popover
|
||||
placement="top"
|
||||
body={({ toggleVisibility, forwardRef }) => (
|
||||
<PermalinkPopover
|
||||
// TODO (bc) temporary needed to pass the assetID to go back to the correct asset until the backend
|
||||
// returns the correct asset url
|
||||
permalinkUrl={`${origin}/?commentID=${commentID}&assetID=${assetID}`}
|
||||
permalinkUrl={`${assetURL}&commentID=${commentID}`}
|
||||
forwardRef={forwardRef}
|
||||
toggleVisibility={toggleVisibility}
|
||||
/>
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user