File size: 1,604 Bytes
ba95018
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { getTemplateData } from '../../data/templateData';
import { FileText, Copy, ChevronDown } from 'lucide-react';
import { useState } from 'react';
import toast from 'react-hot-toast';

export default function SmartPhrasesPanel() {
  const [isOpen, setIsOpen] = useState(false);
  const SMART_PHRASES = getTemplateData()?.smartPhrases || [];

  const handleCopy = (text) => {
    navigator.clipboard.writeText(text).then(() => {
      toast.success('Copied to clipboard');
    });
  };

  return (
    <div className="section" id="section-smart-phrases">
      <div className="section__header" style={{ cursor: 'pointer' }} onClick={() => setIsOpen(!isOpen)}>
        <div className="section__header-icon">
          <FileText size={20} />
        </div>
        <h2 className="section__title">Quick Smart Phrases</h2>
        <span className={`collapsible-trigger__icon ${isOpen ? 'collapsible-trigger__icon--open' : ''}`} style={{ marginLeft: 'auto' }}>
          <ChevronDown size={20} />
        </span>
      </div>

      {isOpen && (
        <div className="smart-phrases__list">
          {SMART_PHRASES.map((phrase, i) => (
            <div
              key={i}
              className="smart-phrase"
              onClick={() => handleCopy(phrase)}
              title="Click to copy"
            >
              <span className="smart-phrase__number">{i + 1}.</span>
              <span>{phrase}</span>
              <span className="smart-phrase__copy">
                <Copy size={14} />
              </span>
            </div>
          ))}
        </div>
      )}
    </div>
  );
}