Remove dead shareToX/shareToFacebook functions and related state; v1.0.14
Fixes CI lint errors — both functions were replaced by shareImageTo in the previous commit but not deleted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -391,7 +391,6 @@ export default function QASection() {
|
||||
const [engagement, setEngagement] = useState<EngagementMap>({})
|
||||
const [expandedCompactAnswers, setExpandedCompactAnswers] = useState<Record<string, boolean>>({})
|
||||
const [copiedQuestionId, setCopiedQuestionId] = useState<string | null>(null)
|
||||
const [copiedFacebookCaptionId, setCopiedFacebookCaptionId] = useState<string | null>(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [votedIds, setVotedIds] = useState<Set<string>>(() => {
|
||||
try {
|
||||
@@ -746,45 +745,6 @@ export default function QASection() {
|
||||
}
|
||||
}
|
||||
|
||||
const shareToX = (question: DecoratedQuestion) => {
|
||||
const url = getSocialUrl(question.id)
|
||||
const text = question.question.length > 200
|
||||
? `${question.question.slice(0, 197)}…`
|
||||
: question.question
|
||||
window.open(
|
||||
`https://x.com/intent/tweet?text=${encodeURIComponent(text)}&url=${encodeURIComponent(url)}`,
|
||||
'_blank',
|
||||
'noopener,noreferrer,width=600,height=420'
|
||||
)
|
||||
incrementEngagement(question.id, 'shares')
|
||||
}
|
||||
|
||||
const shareToFacebook = async (question: DecoratedQuestion) => {
|
||||
const url = getSocialUrl(question.id)
|
||||
const answerSnippet = question.answer.replace(/\s+/g, ' ').trim()
|
||||
const caption = [
|
||||
`Question: ${question.question}`,
|
||||
`Answer: ${answerSnippet.length > 240 ? `${answerSnippet.slice(0, 237)}...` : answerSnippet}`,
|
||||
'What are your thoughts?'
|
||||
].join('\n\n')
|
||||
|
||||
try {
|
||||
await navigator.clipboard.writeText(caption)
|
||||
setCopiedFacebookCaptionId(question.id)
|
||||
window.setTimeout(() => {
|
||||
setCopiedFacebookCaptionId(curr => (curr === question.id ? null : curr))
|
||||
}, 2500)
|
||||
} catch {
|
||||
window.prompt('Copy this caption and paste it into your post:', caption)
|
||||
}
|
||||
|
||||
window.open(
|
||||
`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`,
|
||||
'_blank',
|
||||
'noopener,noreferrer,width=600,height=500'
|
||||
)
|
||||
incrementEngagement(question.id, 'shares')
|
||||
}
|
||||
|
||||
const formatDate = (value?: string) => {
|
||||
if (!value) return null
|
||||
@@ -999,7 +959,6 @@ export default function QASection() {
|
||||
const relatedQuestions = getRelatedQuestions(question)
|
||||
const isFocused = focusedQuestionId === question.id
|
||||
const isExpandedInCompact = expandedCompactAnswers[question.id] === true
|
||||
const facebookCaptionCopied = copiedFacebookCaptionId === question.id
|
||||
const linkCopied = copiedQuestionId === question.id
|
||||
const answerText = compactMode && !isExpandedInCompact
|
||||
? truncateAnswer(question.answer)
|
||||
@@ -1065,11 +1024,9 @@ export default function QASection() {
|
||||
Save image
|
||||
</button>
|
||||
</div>
|
||||
{(facebookCaptionCopied || linkCopied) && (
|
||||
{linkCopied && (
|
||||
<p className="qa-share-feedback" role="status" aria-live="polite">
|
||||
{facebookCaptionCopied
|
||||
? 'Caption copied. Paste it into your Facebook post text box.'
|
||||
: 'Direct link copied to clipboard.'}
|
||||
Direct link copied to clipboard.
|
||||
</p>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user