diff --git a/packages/shared/src/components/feeds/FeedSettings/components/SmartPrompts.tsx b/packages/shared/src/components/feeds/FeedSettings/components/SmartPrompts.tsx deleted file mode 100644 index d25e46b5293..00000000000 --- a/packages/shared/src/components/feeds/FeedSettings/components/SmartPrompts.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import React from 'react'; -import type { ReactElement } from 'react'; -import { - Typography, - TypographyColor, - TypographyTag, - TypographyType, -} from '../../../typography/Typography'; -import { PlusUser } from '../../../PlusUser'; -import { LogEvent, Origin, TargetId } from '../../../../lib/log'; -import { usePlusSubscription, useToastNotification } from '../../../../hooks'; -import { usePromptsQuery } from '../../../../hooks/prompt/usePromptsQuery'; -import { FilterCheckbox } from '../../../fields/FilterCheckbox'; -import { useSettingsContext } from '../../../../contexts/SettingsContext'; -import { labels } from '../../../../lib'; -import { useLogContext } from '../../../../contexts/LogContext'; -import { useFeedSettingsEditContext } from '../FeedSettingsEditContext'; -import ConditionalWrapper from '../../../ConditionalWrapper'; -import { Tooltip } from '../../../tooltip/Tooltip'; - -export const SmartPrompts = (): ReactElement => { - const { editFeedSettings } = useFeedSettingsEditContext(); - const { isPlus } = usePlusSubscription(); - const { displayToast } = useToastNotification(); - const { logEvent } = useLogContext(); - const { flags, updatePromptFlag } = useSettingsContext(); - const promptFlags = flags?.prompt; - const { data: prompts, isLoading } = usePromptsQuery(); - - return ( -
-
-
- - Smart Prompts - - -
- - Level up how you interact with posts using AI-powered prompts. Extract - insights, refine content, or run custom instructions to get more out - of every post in one click. - -
- -
- {prompts?.map(({ id, label, description }) => ( - { - return ( - -
{child as ReactElement}
-
- ); - }} - > - { - const newState = !promptFlags?.[id] || false; - editFeedSettings(() => updatePromptFlag(id, newState)); - displayToast( - labels.feed.settings.globalPreferenceNotice.smartPrompt, - ); - - logEvent({ - event_name: LogEvent.ToggleSmartPrompts, - target_type: id, - target_id: newState ? TargetId.On : TargetId.Off, - extra: JSON.stringify({ - origin: Origin.Settings, - }), - }); - }} - descriptionClassName="text-text-tertiary" - > - {label} - -
- ))} -
-
- ); -}; diff --git a/packages/shared/src/components/feeds/FeedSettings/sections/FeedSettingsAISection.tsx b/packages/shared/src/components/feeds/FeedSettings/sections/FeedSettingsAISection.tsx index 6906521778e..a72891a5e20 100644 --- a/packages/shared/src/components/feeds/FeedSettings/sections/FeedSettingsAISection.tsx +++ b/packages/shared/src/components/feeds/FeedSettings/sections/FeedSettingsAISection.tsx @@ -29,7 +29,6 @@ import { import { Divider } from '../../../utilities'; import { Switch } from '../../../fields/Switch'; import { labels } from '../../../../lib'; -import { SmartPrompts } from '../components/SmartPrompts'; import { featurePlusCtaCopy } from '../../../../lib/featureManagement'; import Link from '../../../utilities/Link'; import { Tooltip } from '../../../tooltip/Tooltip'; @@ -109,7 +108,7 @@ export const FeedSettingsAISection = (): ReactElement => { { onLanguageChange(value); @@ -117,7 +116,7 @@ export const FeedSettingsAISection = (): ReactElement => { labels.feed.settings.globalPreferenceNotice.contentLanguage, ); }} - icon={null} + icon={undefined} disabled={!isPlus} /> @@ -210,10 +209,6 @@ export const FeedSettingsAISection = (): ReactElement => { - - - - ); }; diff --git a/packages/shared/src/components/modals/common.tsx b/packages/shared/src/components/modals/common.tsx index d7fdd4f8e2c..c1a8ae6c6d5 100644 --- a/packages/shared/src/components/modals/common.tsx +++ b/packages/shared/src/components/modals/common.tsx @@ -213,18 +213,6 @@ const AddToCustomFeedModal = dynamic( ), ); -const SmartPromptModal = dynamic(() => - import( - /* webpackChunkName: "smartPromptModal" */ './plus/SmartPromptModal' - ).then((mod) => mod.SmartPromptModal), -); - -const MobileSmartPromptsModal = dynamic(() => - import( - /* webpackChunkName: "mobileSmartPromptsModal" */ './plus/MobileSmartPromptsModal' - ).then((mod) => mod.MobileSmartPromptsModal), -); - const CookieConsentModal = dynamic( () => import( @@ -503,8 +491,6 @@ export const modals = { [LazyModal.ClickbaitShield]: ClickbaitShieldModal, [LazyModal.MoveBookmark]: MoveBookmarkModal, [LazyModal.AddToCustomFeed]: AddToCustomFeedModal, - [LazyModal.SmartPrompt]: SmartPromptModal, - [LazyModal.MobileSmartPrompts]: MobileSmartPromptsModal, [LazyModal.CookieConsent]: CookieConsentModal, [LazyModal.ReportUser]: ReportUserModal, [LazyModal.PlusMarketing]: PlusMarketingModal, diff --git a/packages/shared/src/components/modals/common/types.ts b/packages/shared/src/components/modals/common/types.ts index c5dd99b180b..f331f4ff9d7 100644 --- a/packages/shared/src/components/modals/common/types.ts +++ b/packages/shared/src/components/modals/common/types.ts @@ -64,9 +64,7 @@ export enum LazyModal { ReportUser = 'reportUser', GiftPlus = 'giftPlus', GiftPlusReceived = 'giftPlusReceived', - SmartPrompt = 'smartPrompt', PlusMarketing = 'plusMarketing', - MobileSmartPrompts = 'mobileSmartPrompts', GiveAward = 'giveAward', ContentModal = 'contentModal', CustomLinks = 'customLinks', diff --git a/packages/shared/src/components/modals/plus/MobileSmartPromptsModal.tsx b/packages/shared/src/components/modals/plus/MobileSmartPromptsModal.tsx deleted file mode 100644 index 3bdf6ceb2ac..00000000000 --- a/packages/shared/src/components/modals/plus/MobileSmartPromptsModal.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import type { ReactElement } from 'react'; -import React from 'react'; -import type { ModalProps } from '../common/Modal'; -import { Modal } from '../common/Modal'; -import type { Prompt } from '../../../graphql/prompt'; -import PromptButton from '../../post/smartPrompts/PromptButton'; -import { PromptDisplay } from '../../../graphql/prompt'; -import { ColorName } from '../../../styles/colors'; -import { ButtonSize, ButtonVariant } from '../../buttons/Button'; - -type MobileSmartPromptsModalProps = Omit & { - prompts: Prompt[]; - onChoosePrompt?: (prompt: string) => void; -}; - -export const MobileSmartPromptsModal = ({ - prompts, - onChoosePrompt, - ...props -}: MobileSmartPromptsModalProps): ReactElement => { - const onClick = (event: React.MouseEvent, id: string) => { - onChoosePrompt?.(id); - props.onRequestClose?.(event); - }; - - return ( - -
- onClick(event, PromptDisplay.TLDR)} - > - TLDR - - {prompts?.map(({ id, label, flags }) => ( - onClick(event, id)} - > - {label} - - ))} -
-
- ); -}; diff --git a/packages/shared/src/components/modals/plus/SmartPromptModal.tsx b/packages/shared/src/components/modals/plus/SmartPromptModal.tsx deleted file mode 100644 index 86b96a4000b..00000000000 --- a/packages/shared/src/components/modals/plus/SmartPromptModal.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import type { ReactElement } from 'react'; -import React from 'react'; -import type { ModalProps } from '../common/Modal'; -import { Modal } from '../common/Modal'; -import { Image } from '../../image/Image'; -import { smartPromptModalImage } from '../../../lib/image'; -import { - Typography, - TypographyColor, - TypographyType, -} from '../../typography/Typography'; -import { PlusUser } from '../../PlusUser'; -import { Button, ButtonVariant } from '../../buttons/Button'; -import { plusUrl } from '../../../lib/constants'; -import { DevPlusIcon } from '../../icons'; -import { LogEvent, TargetId } from '../../../lib/log'; -import { useConditionalFeature, usePlusSubscription } from '../../../hooks'; -import { featurePlusCtaCopy } from '../../../lib/featureManagement'; -import Link from '../../utilities/Link'; - -export const SmartPromptModal = ({ ...props }: ModalProps): ReactElement => { - const { logSubscriptionEvent, isPlus } = usePlusSubscription(); - const { - value: { full: plusCta }, - } = useConditionalFeature({ - feature: featurePlusCtaCopy, - shouldEvaluate: !isPlus, - }); - return ( - - Smart Prompt feature -
-
- - Smart Prompts - - -
- - - Level up how you interact with posts using AI-powered prompts. Extract - insights, refine content, or run custom instructions to get more out - of every post in one click. - - - - -
-
- ); -}; diff --git a/packages/shared/src/components/plus/PlusList.tsx b/packages/shared/src/components/plus/PlusList.tsx index 9a23dfb9a57..53fd5c64f51 100644 --- a/packages/shared/src/components/plus/PlusList.tsx +++ b/packages/shared/src/components/plus/PlusList.tsx @@ -9,7 +9,6 @@ import { useLogContext } from '../../contexts/LogContext'; import { BlockIcon, BriefIcon, - CustomPromptIcon, FolderIcon, HashtagIcon, LabelIcon, @@ -28,8 +27,6 @@ import { plusShowcasePresidentialBriefImage, plusShowcaseShieldImage, plusShowcaseShieldVideo, - plusShowcaseSmartPrompsImage, - plusShowcaseSmartPrompsVideo, plusShowcaseSquadImage, plusShowcaseTeamImage, plusShowcaseTeamVideo, @@ -86,22 +83,6 @@ export const plusFeatureListControl: Array = [ mediaType: 'image', }, }, - { - id: 'smart prompts', - label: 'Run prompts on any post', - status: PlusItemStatus.Ready, - tooltip: `Turn any post into an interactive learning experience. Ask AI to simplify concepts, challenge ideas, compare alternatives, or create your own custom prompt.`, - icon: , - iconClasses: 'bg-overlay-float-bacon text-accent-bacon-default', - modalProps: { - title: 'Run prompts on any post', - description: - 'Turn any post into an interactive learning experience. Ask AI to simplify concepts, challenge ideas, compare alternatives, or create your own custom prompt.', - videoUrl: plusShowcaseSmartPrompsVideo, - imageUrl: plusShowcaseSmartPrompsImage, - mediaType: 'video', - }, - }, { id: 'custom feeds', label: 'Advanced custom feeds', diff --git a/packages/shared/src/components/post/PostContent.tsx b/packages/shared/src/components/post/PostContent.tsx index b27532367a7..0408b366d52 100644 --- a/packages/shared/src/components/post/PostContent.tsx +++ b/packages/shared/src/components/post/PostContent.tsx @@ -25,7 +25,7 @@ import { cloudinaryPostImageCoverPlaceholder } from '../../lib/image'; import { withPostById } from './withPostById'; import { PostClickbaitShield } from './common/PostClickbaitShield'; import { useSmartTitle } from '../../hooks/post/useSmartTitle'; -import { SmartPrompt } from './smartPrompts/SmartPrompt'; +import ShowMoreContent from '../cards/common/ShowMoreContent'; import { PostTagList } from './tags/PostTagList'; import PostSourceInfo from './PostSourceInfo'; @@ -191,10 +191,19 @@ export function PostContentRaw({ /> )} {post.summary && ( - +
+ +
)} - +
+
) : null; diff --git a/packages/shared/src/components/post/smartPrompts/CustomPrompt.tsx b/packages/shared/src/components/post/smartPrompts/CustomPrompt.tsx deleted file mode 100644 index 1552e614d2b..00000000000 --- a/packages/shared/src/components/post/smartPrompts/CustomPrompt.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import React, { useCallback, useMemo, useState } from 'react'; -import type { ReactElement } from 'react'; -import { - Button, - ButtonColor, - ButtonSize, - ButtonVariant, -} from '../../buttons/Button'; -import type { Post } from '../../../graphql/posts'; -import { useSmartPrompt } from '../../../hooks/prompt/useSmartPrompt'; -import { usePromptsQuery } from '../../../hooks/prompt/usePromptsQuery'; -import { PromptDisplay } from '../../../graphql/prompt'; -import { SearchProgressBar } from '../../search'; -import { isNullOrUndefined } from '../../../lib/func'; -import Alert, { AlertType } from '../../widgets/Alert'; -import { labels } from '../../../lib'; -import { RenderMarkdown } from '../../RenderMarkdown'; -import { CopyIcon, EditIcon } from '../../icons'; -import { useCopyText } from '../../../hooks/useCopy'; -import { LogEvent } from '../../../lib/log'; -import { useActiveFeedContext } from '../../../contexts'; -import { postLogEvent } from '../../../lib/feed'; -import { useLogContext } from '../../../contexts/LogContext'; - -type CustomPromptProps = { - post: Post; -}; - -export const CustomPrompt = ({ post }: CustomPromptProps): ReactElement => { - const { logEvent } = useLogContext(); - const { logOpts } = useActiveFeedContext(); - const { data: prompts } = usePromptsQuery(); - const [isEdit, setIsEdit] = useState(false); - const [copying, copy] = useCopyText(); - const prompt = useMemo( - () => prompts?.find((p) => p.id === PromptDisplay.CustomPrompt), - [prompts], - ); - const { executePrompt, data, isPending } = useSmartPrompt({ post, prompt }); - const onSubmitCustomPrompt = useCallback( - (e: React.FormEvent) => { - e.preventDefault(); - logEvent( - postLogEvent(LogEvent.SmartPrompt, post, { - extra: { prompt: 'custom-prompt' }, - ...(logOpts && logOpts), - }), - ); - setIsEdit(false); - executePrompt(e.target[0].value); - }, - [executePrompt, logEvent, post, logOpts], - ); - - if (!data || isEdit) { - return ( -
-