replace response copy with share copy (#56127)
This commit is contained in:
@@ -50,8 +50,8 @@ search:
|
||||
references: Copilot Sources
|
||||
loading_status_message: Loading Copilot response...
|
||||
done_loading_status_message: Done loading Copilot response
|
||||
copy_answer: Copy answer
|
||||
copied_announcement: Copied!
|
||||
share_answer: Copy answer URL
|
||||
share_copied_announcement: Copied share URL!
|
||||
thumbs_up: This answer was helpful
|
||||
thumbs_down: This answer was not helpful
|
||||
thumbs_announcement: Thank you for your feedback!
|
||||
|
||||
@@ -7,8 +7,8 @@ import { ActionList, IconButton, Spinner } from '@primer/react'
|
||||
import {
|
||||
CheckIcon,
|
||||
CopilotIcon,
|
||||
CopyIcon,
|
||||
FileIcon,
|
||||
ShareIcon,
|
||||
ThumbsdownIcon,
|
||||
ThumbsupIcon,
|
||||
} from '@primer/octicons-react'
|
||||
@@ -85,7 +85,14 @@ export function AskAIResults({
|
||||
}>('ai-query-cache', 1000, 7)
|
||||
const { isOpen: isCTAOpen, permanentDismiss: permanentlyDismissCTA } = useCTAPopoverContext()
|
||||
|
||||
const [isCopied, setCopied] = useClipboard(message, { successDuration: 1400 })
|
||||
let copyUrl = ``
|
||||
if (window?.location?.href) {
|
||||
// Get base path from current URL
|
||||
const url = new URL(window.location.href)
|
||||
copyUrl = `${url.origin}/?search-overlay-open=true&search-overlay-ask-ai=true&search-overlay-input=${encodeURIComponent(query)}`
|
||||
}
|
||||
|
||||
const [isCopied, setCopied] = useClipboard(copyUrl, { successDuration: 1399 })
|
||||
const [feedbackSelected, setFeedbackSelected] = useState<null | 'up' | 'down'>(null)
|
||||
|
||||
const [conversationId, setConversationId] = useState<string>('')
|
||||
@@ -504,15 +511,17 @@ export function AskAIResults({
|
||||
boxShadow: 'unset',
|
||||
color: isCopied ? 'var(--fgColor-accent) !important;' : '',
|
||||
}}
|
||||
icon={isCopied ? CheckIcon : CopyIcon}
|
||||
icon={isCopied ? CheckIcon : ShareIcon}
|
||||
className="btn-octicon"
|
||||
aria-label={t('ai.copy_answer')}
|
||||
aria-label={
|
||||
isCopied ? t('search.ai.share_copied_announcement') : t('search.ai.share_answer')
|
||||
}
|
||||
onClick={() => {
|
||||
setCopied()
|
||||
announce(t('ai.copied_announcement'))
|
||||
announce(t('search.ai.share_copied_announcement'))
|
||||
sendEvent({
|
||||
type: EventType.clipboard,
|
||||
clipboard_operation: 'copy',
|
||||
clipboard_operation: 'share',
|
||||
eventGroupKey: ASK_AI_EVENT_GROUP,
|
||||
eventGroupId: askAIEventGroupId.current,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user