Add "Copy all snippets" button on task with multiple snippets 📋
File: client/src/components/Task/TaskModal.jsx
Tasks can have multiple snippets but
you can only copy one at a time 💀 fr!!
Fix: add copy all button when 2+ snippets exist:
const handleCopyAll = () => {
const allCode = task?.snippets
?.map((s, i) =>
// Snippet ${i+1} (${s.language})\n${s.code}
)
.join('\n\n---\n\n')
navigator.clipboard.writeText(allCode)
setCopiedAll(true)
setTimeout(() => setCopiedAll(false), 2000)
}
{task?.snippets?.length > 1 && (
{copiedAll ? '✅ Copied all!' : '📋 Copy all snippets'}
)}
~12 lines! No backend needed 🎯
Add "Copy all snippets" button on task with multiple snippets 📋
File: client/src/components/Task/TaskModal.jsx
Tasks can have multiple snippets but
you can only copy one at a time 💀 fr!!
Fix: add copy all button when 2+ snippets exist:
const handleCopyAll = () => {
const allCode = task?.snippets
?.map((s, i) =>
// Snippet ${i+1} (${s.language})\n${s.code}
)
.join('\n\n---\n\n')
navigator.clipboard.writeText(allCode)
setCopiedAll(true)
setTimeout(() => setCopiedAll(false), 2000)
}
{task?.snippets?.length > 1 && (
{copiedAll ? '✅ Copied all!' : '📋 Copy all snippets'}
)}
~12 lines! No backend needed 🎯