0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-05 14:33:07 +00:00

Fix Share links

This commit is contained in:
Trevor Buckner
2020-10-07 17:13:37 -04:00
parent 28ed2fe8f2
commit 8fe0148821
3 changed files with 37 additions and 16 deletions

View File

@@ -290,6 +290,12 @@ const EditPage = createClass({
}
},
processShareId : function() {
return this.state.brew.googleId ?
this.state.brew.googleId + this.state.brew.shareId :
this.state.brew.shareId;
},
renderNavbar : function(){
return <Navbar>
<Nav.section>
@@ -300,10 +306,10 @@ const EditPage = createClass({
{this.renderGoogleDriveIcon()}
{this.renderSaveButton()}
<ReportIssue />
<Nav.item newTab={true} href={`/share/${this.props.brew.shareId}`} color='teal' icon='fa-share-alt'>
<Nav.item newTab={true} href={`/share/${this.processShareId()}`} color='teal' icon='fa-share-alt'>
Share
</Nav.item>
<PrintLink shareId={this.props.brew.shareId} />
<PrintLink shareId={this.processShareId()} />
<RecentNavItem brew={this.props.brew} storageKey='edit' />
<Account />
</Nav.section>

View File

@@ -45,15 +45,10 @@ const SharePage = createClass({
}
},
renderSourceButton : function() {
let shareLink = this.props.brew.shareId;
if(this.props.brew.googleId) {
shareLink = this.props.brew.googleId + shareLink;
}
return <Nav.item href={`/source/${shareLink}`} color='teal' icon='fa-code'>
source
</Nav.item>;
processShareId : function() {
return this.props.brew.googleId ?
this.props.brew.googleId + this.props.brew.shareId :
this.props.brew.shareId;
},
render : function(){
@@ -65,8 +60,10 @@ const SharePage = createClass({
</Nav.section>
<Nav.section>
<PrintLink shareId={this.props.brew.shareId} />
{this.renderSourceButton()}
<PrintLink shareId={this.processShareId()} />
<Nav.item href={`/source/${this.processShareId()}`} color='teal' icon='fa-code'>
source
</Nav.item>
<RecentNavItem brew={this.props.brew} storageKey='view' />
<Account />
</Nav.section>