File size: 2,443 Bytes
4b1a31e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React, { useState } from 'react';
import { Innovation, Classification } from '../types';
import { ChevronDown, ChevronUp, Trash2, Check, Zap, FileText } from 'lucide-react';
import { COLOR_MAP } from '../constants';

interface InnovationCardProps {
  innovation: Innovation;
  onClassify: (id: string, classification: Classification) => void;
}

const InnovationCard: React.FC<InnovationCardProps> = ({ innovation, onClassify }) => {
  const [isExpanded, setIsExpanded] = useState(false);

  return (
    <div
      className={`bg-white rounded-lg shadow-sm border border-slate-200 mb-4 overflow-hidden transition-all duration-200 ${innovation.classification === Classification.DELETE ? 'opacity-50' : ''}`}>
      <div className="p-4">
        <div className="flex justify-between items-start">
          <div className="flex-1 cursor-pointer" onClick={() => setIsExpanded(!isExpanded)}>
            <div className="px-4 pb-4 bg-slate-50 border-t border-slate-100 pt-3 text-sm">
              <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
                <div>
                  <p className="font-semibold text-slate-700 mb-1">File name</p>
                  <p className="text-slate-600">{innovation.file_name}</p>
                </div>
                {/* <div>
                  <p className="font-semibold text-slate-700 mb-1">Innovation Potential</p>
                  <p className="text-slate-600">{ }</p>
                </div> */}
              </div>
            </div>
          </div>

          <div className="flex items-center ml-4">
            <button
              onClick={(e) => {
                e.stopPropagation();
                onClassify(innovation.id, Classification.DELETE);
              }}
              className="text-red-400 hover:text-red-600 p-1 mr-2 text-xs font-medium border border-red-200 rounded px-2"
            >
              Delete
            </button>
            <button
              onClick={() => setIsExpanded(!isExpanded)}
              className="text-slate-400 hover:text-slate-600 p-1"
            >
              {isExpanded ? <ChevronUp size={20} /> : <ChevronDown size={20} />}
            </button>
          </div>
        </div>
      </div>

      {isExpanded && (
        <div
          className="flex flex-col gap-2 m-2"
          dangerouslySetInnerHTML={{ __html: innovation.answer }}
        />
      )}
    </div>
  );
};

export default InnovationCard;