-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #293 from factly/feat/analytics
feat: add analytics field in space
- Loading branch information
Showing
3 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { Result, Skeleton, Space } from 'antd'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
function Analytics() { | ||
const { space, loading } = useSelector(({ spaces }) => { | ||
return { | ||
space: spaces.details[spaces.selected], | ||
loading: spaces.loading, | ||
}; | ||
}); | ||
|
||
if (loading) return <Skeleton />; | ||
|
||
return ( | ||
<Space direction="vertical"> | ||
{space.analytics && space.analytics.plausible && space.analytics.plausible.embed_code ? ( | ||
<div dangerouslySetInnerHTML={{ __html: space.analytics.plausible.embed_code }} /> | ||
) : ( | ||
<Result title="No analytics found" /> | ||
)} | ||
</Space> | ||
); | ||
} | ||
|
||
export default Analytics; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters