mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +00:00
ARTICLE_SHARE イベント追跡
This commit is contained in:
@@ -2,6 +2,7 @@ import React, { PropTypes } from 'react'
|
|||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from 'react-dom'
|
||||||
import api from 'boost/api'
|
import api from 'boost/api'
|
||||||
import clientKey from 'boost/clientKey'
|
import clientKey from 'boost/clientKey'
|
||||||
|
import activityRecord from 'boost/activityRecord'
|
||||||
const clipboard = require('electron').clipboard
|
const clipboard = require('electron').clipboard
|
||||||
|
|
||||||
function getDefault () {
|
function getDefault () {
|
||||||
@@ -11,7 +12,8 @@ function getDefault () {
|
|||||||
// Fetched url
|
// Fetched url
|
||||||
url: null,
|
url: null,
|
||||||
// for tooltip Copy -> Copied!
|
// for tooltip Copy -> Copied!
|
||||||
copied: false
|
copied: false,
|
||||||
|
failed: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,14 +72,21 @@ export default class ShareButton extends React.Component {
|
|||||||
clientKey: clientKey.get(),
|
clientKey: clientKey.get(),
|
||||||
writerName: user.name
|
writerName: user.name
|
||||||
})
|
})
|
||||||
api.shareWithPublicURL(input)
|
this.setState({
|
||||||
.then(res => {
|
isSharing: true,
|
||||||
let url = res.body.url
|
failed: false
|
||||||
this.setState({url: url})
|
}, () => {
|
||||||
})
|
api.shareWithPublicURL(input)
|
||||||
.catch(err => {
|
.then(res => {
|
||||||
console.log(err)
|
let url = res.body.url
|
||||||
})
|
this.setState({url: url, isSharing: false})
|
||||||
|
activityRecord.emit('ARTICLE_SHARE')
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
this.setState({isSharing: false, failed: true})
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCopyURLClick () {
|
handleCopyURLClick () {
|
||||||
@@ -109,7 +118,7 @@ export default class ShareButton extends React.Component {
|
|||||||
onClick={e => this.shareWithPublicURLHandler(e)}
|
onClick={e => this.shareWithPublicURLHandler(e)}
|
||||||
ref='sharePublicURL'
|
ref='sharePublicURL'
|
||||||
disabled={this.state.isSharing}>
|
disabled={this.state.isSharing}>
|
||||||
<i className='fa fa-fw fa-external-link'/> {!this.state.isSharing ? 'Share with public URL' : 'Sharing...'}
|
<i className='fa fa-fw fa-external-link'/> {this.state.failed ? 'Failed : Click to Try again' : !this.state.isSharing ? 'Share with public URL' : 'Sharing...'}
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<div className='ShareButton-url'>
|
<div className='ShareButton-url'>
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ export function emit (type, data = {}) {
|
|||||||
case 'FINDER_OPEN':
|
case 'FINDER_OPEN':
|
||||||
case 'FINDER_COPY':
|
case 'FINDER_COPY':
|
||||||
case 'MAIN_DETAIL_COPY':
|
case 'MAIN_DETAIL_COPY':
|
||||||
|
case 'ARTICLE_SHARE':
|
||||||
todayRecord[type] = todayRecord[type] == null
|
todayRecord[type] = todayRecord[type] == null
|
||||||
? 1
|
? 1
|
||||||
: todayRecord[type] + 1
|
: todayRecord[type] + 1
|
||||||
|
|||||||
Reference in New Issue
Block a user