File size: 1,241 Bytes
523133d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import 'bootstrap/dist/css/bootstrap.min.css';
import './FiguresDisplay.css';

function FiguresDisplay({
  figures,
  setModalState
}) {
  const openModal = (index) => {
    setModalState({ show: true, currentIndex: index });
  };

  if (figures.length == 0) {
    return (
      <div className="empty-placeholder">
        Start the analysis to see the results.
      </div>
    );
  } else {
    return (
      <>
        <div className="main-figure mb-3" onClick={() => openModal(0)}>
          <img
            className="img-fluid border rounded"
            src={`data:image/png;base64,${figures[0]}`}
            alt="Main Figure"
            style={{maxWidth:'100%'}}
          />
        </div>
        <div className="row g-2">
          {figures.slice(1).map((fig, idx) => (
            <div className="col-6" key={idx + 1}>
              <div className="fig-thumb border rounded bg-white p-1" onClick={() => openModal(idx + 1)}>
                <img
                  className="img-fluid"
                  src={`data:image/png;base64,${fig}`}
                  alt={`Fig-${idx + 1}`}
                />
              </div>
            </div>
          ))}
        </div>
      </>
    );
  }
}

export default FiguresDisplay;