zavadil-react-common 1.2.106 → 1.2.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,30 @@
1
1
  import React from 'react';
2
- import {ProgressBar} from "react-bootstrap";
2
+ import {Placeholder, ProgressBar} from "react-bootstrap";
3
3
  import {QueueStats} from 'zavadil-ts-common';
4
4
  import {QueueStateControl} from "./QueueStateControl";
5
5
 
6
6
  export type QueueStatsControlProps = {
7
7
  name: string;
8
- stats: QueueStats;
8
+ stats?: QueueStats | null;
9
9
  }
10
10
 
11
11
  export function QueueStatsControl({name, stats}: QueueStatsControlProps) {
12
- const max = stats.remaining + stats.processed;
12
+ const max = stats ? stats.remaining + stats.processed : undefined
13
+
13
14
  return (
14
15
  <div>
15
16
  <div className="d-flex align-items-center gap-2">
16
17
  <pre>{name}</pre>
17
- <pre>[{stats.processed} / {max}]</pre>
18
- <QueueStateControl state={stats.state}/>
18
+ <pre>[{stats?.processed || '?'} / {max || '?'}]</pre>
19
+ <QueueStateControl state={stats ? stats.state : 'Unknown'}/>
19
20
  </div>
20
21
  <div className="p-1">
21
- <ProgressBar variant="primary" striped={true} animated={true} min={0} now={stats.processed} max={max || 1}/>
22
+ {
23
+ stats ? <ProgressBar variant="primary" striped={true} animated={true} min={0} now={stats.processed} max={max || 1}/>
24
+ : <Placeholder className="w-100" animation="glow">
25
+ <Placeholder className="w-100"/>
26
+ </Placeholder>
27
+ }
22
28
  </div>
23
29
  </div>
24
30
  );