diff --git a/apps/frontend/src/components/launches/editor.tsx b/apps/frontend/src/components/launches/editor.tsx index 4b61fd97..1a627705 100644 --- a/apps/frontend/src/components/launches/editor.tsx +++ b/apps/frontend/src/components/launches/editor.tsx @@ -1,9 +1,12 @@ -import { forwardRef } from 'react'; +import { forwardRef, useCallback, useRef } from 'react'; import type { MDEditorProps } from '@uiw/react-md-editor/src/Types'; import { RefMDEditor } from '@uiw/react-md-editor/src/Editor'; import MDEditor from '@uiw/react-md-editor'; import { useCopilotAction, useCopilotReadable } from '@copilotkit/react-core'; import dayjs from 'dayjs'; +import { CopilotTextarea } from '@copilotkit/react-textarea'; +import clsx from 'clsx'; +import { useUser } from '@gitroom/frontend/components/layout/user.context'; export const Editor = forwardRef< RefMDEditor, @@ -17,6 +20,7 @@ export const Editor = forwardRef< }, ref: React.ForwardedRef ) => { + const user = useUser(); useCopilotReadable({ description: 'Content of the post number ' + (props.order + 1), value: props.content, @@ -38,8 +42,24 @@ export const Editor = forwardRef< }); return ( -
- +
+ {user?.tier?.ai ? ( + props?.onChange?.(e.target.value)} + placeholder="Write your reply..." + autosuggestionsConfig={{ + textareaPurpose: `Assist me in writing social media posts.`, + chatApiConfigs: {}, + }} + /> + ) : ( + + )}
); }