-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Notebook feedback changes (#17952)
- Loading branch information
1 parent
60398b7
commit d24ea60
Showing
5 changed files
with
93 additions
and
4 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
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,72 @@ | ||
import { LemonBanner, LemonButton, LemonDivider } from '@posthog/lemon-ui' | ||
import { combineUrl } from 'kea-router' | ||
import { IconCopy } from 'lib/lemon-ui/icons' | ||
import { LemonDialog } from 'lib/lemon-ui/LemonDialog' | ||
import { copyToClipboard } from 'lib/utils' | ||
import posthog from 'posthog-js' | ||
import { useState } from 'react' | ||
import { urls } from 'scenes/urls' | ||
|
||
export type NotebookShareProps = { | ||
shortId: string | ||
} | ||
export function NotebookShare({ shortId }: NotebookShareProps): JSX.Element { | ||
const url = combineUrl(`${window.location.origin}${urls.notebook(shortId)}`).url | ||
|
||
const [interestTracked, setInterestTracked] = useState(false) | ||
|
||
const trackInterest = (): void => { | ||
posthog.capture('pressed interested in notebook sharing', { url }) | ||
} | ||
|
||
return ( | ||
<div className="space-y-2"> | ||
<h3>Internal Link</h3> | ||
<p> | ||
<b>Click the button below</b> to copy a direct link to this Notebook. Make sure the person you share it | ||
with has access to this PostHog project. | ||
</p> | ||
<LemonButton | ||
type="secondary" | ||
fullWidth | ||
center | ||
sideIcon={<IconCopy />} | ||
onClick={async () => await copyToClipboard(url, 'notebook link')} | ||
title={url} | ||
> | ||
<span className="truncate">{url}</span> | ||
</LemonButton> | ||
|
||
<LemonDivider className="my-4" /> | ||
|
||
<h3>External Sharing</h3> | ||
|
||
<LemonBanner | ||
type="warning" | ||
action={{ | ||
children: !interestTracked ? 'I would like this!' : 'Thanks!', | ||
onClick: () => { | ||
if (!interestTracked) { | ||
trackInterest() | ||
setInterestTracked(true) | ||
} | ||
}, | ||
}} | ||
> | ||
We don’t currently support sharing notebooks externally, but it’s on our roadmap! | ||
</LemonBanner> | ||
</div> | ||
) | ||
} | ||
|
||
export function openNotebookShareDialog({ shortId }: NotebookShareProps): void { | ||
LemonDialog.open({ | ||
title: 'Share notebook', | ||
content: <NotebookShare shortId={shortId} />, | ||
width: 600, | ||
primaryButton: { | ||
children: 'Close', | ||
type: 'secondary', | ||
}, | ||
}) | ||
} |
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