Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
33f56297
You need to sign in or sign up before continuing.
Unverified
Commit
33f56297
authored
Jun 10, 2019
by
陈帅
Committed by
GitHub
Jun 10, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4399 from ant-design/add-block-analytics
add block a analytics to ga
parents
d52f1718
85aa7420
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
src/components/CopyBlock/index.tsx
src/components/CopyBlock/index.tsx
+23
-1
src/typings.d.ts
src/typings.d.ts
+1
-0
No files found.
src/components/CopyBlock/index.tsx
View file @
33f56297
...
...
@@ -4,6 +4,7 @@ import styles from './index.less';
import
{
connect
}
from
'
dva
'
;
import
*
as
H
from
'
history
'
;
import
{
FormattedMessage
}
from
'
umi-plugin-react/locale
'
;
import
{
isAntDesignPro
}
from
'
@/utils/utils
'
;
const
firstUpperCase
=
(
pathString
:
string
)
=>
{
return
pathString
...
...
@@ -13,13 +14,34 @@ const firstUpperCase = (pathString: string) => {
.
filter
(
s
=>
s
)
.
join
(
''
);
};
// when click block copy, send block url to ga
const
onBlockCopy
=
(
label
:
string
)
=>
{
if
(
!
isAntDesignPro
())
{
return
;
}
const
ga
=
window
&&
(
window
as
any
).
ga
;
if
(
ga
)
{
ga
(
'
send
'
,
'
event
'
,
{
eventCategory
:
'
block
'
,
eventAction
:
'
copy
'
,
eventLabel
:
label
,
});
}
};
const
BlockCodeView
:
React
.
SFC
<
{
url
:
string
;
}
>
=
({
url
})
=>
{
const
blockUrl
=
`npx umi block add
${
firstUpperCase
(
url
)}
--path=
${
url
}
`
;
return
(
<
div
className
=
{
styles
[
'
copy-block-view
'
]
}
>
<
Typography
.
Paragraph
copyable
=
{
{
text
:
blockUrl
}
}
>
<
Typography
.
Paragraph
copyable
=
{
{
text
:
blockUrl
,
onCopy
:
()
=>
onBlockCopy
(
url
),
}
}
>
<
code
className
=
{
styles
[
'
copy-block-code
'
]
}
>
{
blockUrl
}
</
code
>
</
Typography
.
Paragraph
>
</
div
>
...
...
src/typings.d.ts
View file @
33f56297
...
...
@@ -20,6 +20,7 @@ declare module 'react-fittext';
declare
module
'
@antv/data-set
'
;
declare
module
'
nzh/cn
'
;
declare
let
ga
:
Function
;
// preview.pro.ant.design only do not use in your production ;
// preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
declare
let
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION
:
'
site
'
|
undefined
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment