-
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: Add mentions instead of search (#18447)
- Loading branch information
1 parent
e74aac7
commit 31fa68a
Showing
25 changed files
with
315 additions
and
165 deletions.
There are no files selected for viewing
Binary file modified
BIN
+226 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--user-paths-edit--webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-14 Bytes
(100%)
frontend/__snapshots__/scenes-app-surveys--new-survey-targeting-section.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
2 changes: 1 addition & 1 deletion
2
frontend/src/lib/components/ActivationSidebar/activationLogic.test.ts
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
2 changes: 1 addition & 1 deletion
2
frontend/src/lib/components/Subscriptions/views/EditSubscription.tsx
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
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
70 changes: 70 additions & 0 deletions
70
frontend/src/scenes/notebooks/Nodes/NotebookNodeMention.tsx
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,70 @@ | ||
import { mergeAttributes, Node, NodeViewProps } from '@tiptap/core' | ||
import { NodeViewWrapper, ReactNodeViewRenderer } from '@tiptap/react' | ||
import { NotebookNodeType } from '~/types' | ||
import clsx from 'clsx' | ||
import { LemonButton, ProfilePicture, Tooltip } from '@posthog/lemon-ui' | ||
import { useValues } from 'kea' | ||
import { membersLogic } from 'scenes/organization/membersLogic' | ||
|
||
export interface NotebookNodeMentionAttrs { | ||
id?: number | ||
} | ||
|
||
const Component = (props: NodeViewProps): JSX.Element => { | ||
const { id } = props.node.attrs as NotebookNodeMentionAttrs | ||
|
||
const { meFirstMembers } = useValues(membersLogic) | ||
|
||
const member = meFirstMembers.find((member) => member.user.id === id) | ||
|
||
return ( | ||
<NodeViewWrapper as="span" className={clsx('NotebookMention', props.selected && 'NotebookMention--selected')}> | ||
<Tooltip | ||
title={ | ||
<div className="p-2 flex items-center gap-2"> | ||
<ProfilePicture name={member?.user.first_name} email={member?.user.email} size="xl" /> | ||
<div> | ||
<div className="font-bold">{member?.user.first_name}</div> | ||
<div className="text-sm">{member?.user.email}</div> | ||
</div> | ||
</div> | ||
} | ||
> | ||
<LemonButton size="small" noPadding type="secondary" status="primary-alt" sideIcon={null}> | ||
<span className="p-1">@{member?.user.first_name ?? '(Member)'}</span> | ||
</LemonButton> | ||
</Tooltip> | ||
</NodeViewWrapper> | ||
) | ||
} | ||
|
||
export const NotebookNodeMention = Node.create({ | ||
name: NotebookNodeType.Mention, | ||
inline: true, | ||
group: 'inline', | ||
atom: true, | ||
|
||
serializedText: (attrs: NotebookNodeMentionAttrs): string => { | ||
// mention is not a block so `getText` does not add a separator. | ||
// we need to add it manually | ||
return `(member:${attrs.id})` | ||
}, | ||
|
||
addAttributes() { | ||
return { | ||
id: { default: null }, | ||
} | ||
}, | ||
|
||
parseHTML() { | ||
return [{ tag: NotebookNodeType.Mention }] | ||
}, | ||
|
||
renderHTML({ HTMLAttributes }) { | ||
return [NotebookNodeType.Mention, mergeAttributes(HTMLAttributes)] | ||
}, | ||
|
||
addNodeView() { | ||
return ReactNodeViewRenderer(Component) | ||
}, | ||
}) |
140 changes: 0 additions & 140 deletions
140
frontend/src/scenes/notebooks/Notebook/BacklinkCommands.tsx
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.