@imposium-hub/components 1.28.3 → 1.29.0

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.
package/Entry.ts CHANGED
@@ -32,6 +32,7 @@ import NoAccess from './components/no-access/NoAccess';
32
32
  import ServiceIcon from './components/service-icon/ServiceIcon';
33
33
  import DeterminateLoader from './components/determinate-loader/DeterminateLoader';
34
34
  import AssetsTableDateCell from './components/assets/AssetsTableDateCell';
35
+ import AssetsTableDurationCell from './components/assets/AssetsTableDurationCell';
35
36
  import AssetField from './components/assets/AssetField';
36
37
  import AssetsTableDropzone from './components/assets/AssetsTableDropzone';
37
38
  import AssetsTableNameCell from './components/assets/AssetsTableNameCell';
@@ -163,6 +164,7 @@ export {
163
164
  AssetsTableStatusCell,
164
165
  AssetsTableNameFilter,
165
166
  AssetsTableNameCell,
167
+ AssetsTableDurationCell,
166
168
  AssetsTableTagsCell,
167
169
  AssetsTableTagsFilter,
168
170
  AssetsTableTagsPivot,
@@ -0,0 +1,46 @@
1
+ import * as React from 'react';
2
+ import NumberField from '../number-field/NumberField';
3
+ import { updateAssetName } from '../../redux/actions/asset-list';
4
+ import { connect } from 'react-redux';
5
+ import { bindActionCreators } from 'redux';
6
+ import { IImposiumAPI } from '../../services/API';
7
+
8
+ interface IAssetsTableDurationCell {
9
+ cell : any;
10
+ api : IImposiumAPI;
11
+ }
12
+
13
+ const AssetsTableDurationCell : React.FC<IAssetsTableDurationCell> = (props : IAssetsTableDurationCell) => {
14
+
15
+ const {cell: {row: {original: {duration, id}}}} = props;
16
+
17
+ if (duration !== null && duration !== undefined) {
18
+ return (
19
+ <div className = 'asset-duration-cell'>
20
+ {secondsToTime(duration)}
21
+ </div>
22
+ );
23
+ } else {
24
+ return null;
25
+ }
26
+
27
+ };
28
+
29
+ export const secondsToTime = (timeInSeconds) : string => {
30
+ const minutes : any = Math.floor(timeInSeconds / 60);
31
+ let seconds : any = Math.floor(timeInSeconds - minutes * 60);
32
+ if (seconds < 10) {
33
+ seconds = `0${seconds}`;
34
+ }
35
+ return `${minutes}:${seconds}`;
36
+ };
37
+
38
+ const mapDispatchToProps = (dispatch) : any => {
39
+ return bindActionCreators({updateAssetName}, dispatch);
40
+ };
41
+
42
+ const mapStateToProps = (state) : any => {
43
+ return {};
44
+ };
45
+
46
+ export default connect(mapStateToProps, mapDispatchToProps)(AssetsTableDurationCell);
@@ -10,7 +10,7 @@ interface INumberFieldProps {
10
10
  value : number;
11
11
  tooltip? : IToolTipConfig | string;
12
12
  width? : string | number;
13
- onChange(e) : void;
13
+ onChange?(e) : void;
14
14
  info? : string;
15
15
  labelPosition? : string;
16
16
  min? : number;