Skip to content

Commit

Permalink
fixes share URL for subsequent pages
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Mar 26, 2019
1 parent 1bda66a commit 1629339
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/components/Viz/Options.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ class Options extends Component {
const inCart = cart ? cart.data.find(c => c.slug === slug) : false;

const cartEnabled = data && slug && title;

const baseURL = location.href.split("/").slice(0, 6).join("/");
const shareEnabled = topic.slug;
const baseURL = (typeof window === "undefined" ? location : window.location).href.split("/").slice(0, 6).join("/");
const profileURL = `${baseURL}#${topic.slug}`;
const embedURL = `${baseURL}/${topic.section}/${topic.slug}`;

Expand Down Expand Up @@ -434,12 +434,12 @@ class Options extends Component {
<span>Download this visualization as a PNG image or SVG code.</span>
</Tooltip2>

<Tooltip2 tooltipClassName="option-tooltip" placement="top-end">
{ shareEnabled ? <Tooltip2 tooltipClassName="option-tooltip" placement="top-end">
<div className="option share" onClick={this.toggleDialog.bind(this, "share")}>
<span className="option-label">Share / Embed</span>
</div>
<span>Share this visualization on Twitter, Facebook, or on your personal website.</span>
</Tooltip2>
</Tooltip2> : null }

{ cartEnabled ? <Tooltip2 tooltipClassName="option-tooltip" placement="top-end">
<div className={ `option add-to-cart ${ cartSize >= cartMax ? "disabled" : "" }` } onClick={this.onCart.bind(this)}>
Expand All @@ -456,7 +456,7 @@ class Options extends Component {
<Tabs2 onChange={this.toggleDialog.bind(this)} selectedTabId={openDialog}>
<Tab2 id="view-table" title="View Data" panel={<DataPanel />} />
<Tab2 id="save-image" title="Save Image" panel={<ImagePanel />} />
<Tab2 id="share" title="Share / Embed" panel={<SharePanel />} />
{ shareEnabled ? <Tab2 id="share" title="Share / Embed" panel={<SharePanel />} /> : null }
<button aria-label="Close" className="close-button pt-dialog-close-button pt-icon-small-cross" onClick={this.toggleDialog.bind(this, false)}></button>
</Tabs2>
</Dialog>
Expand Down

0 comments on commit 1629339

Please sign in to comment.