@imposium-hub/components 1.28.2 → 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 +2 -0
- package/components/assets/AssetsTableDurationCell.tsx +46 -0
- package/components/number-field/NumberField.tsx +1 -1
- package/components/players/VideoPlayer.tsx +10 -1
- package/dist/components.js +2 -2
- package/dist/components.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/dist/styles.less +4 -0
- package/dist/styles.less.map +1 -1
- package/less/components/assets.less +4 -0
- package/package.json +1 -1
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);
|
|
@@ -14,6 +14,7 @@ interface IVideoPlayerProps {
|
|
|
14
14
|
hideDefaultControls? : boolean;
|
|
15
15
|
allowManualScale? : boolean;
|
|
16
16
|
customControls? : JSX.Element;
|
|
17
|
+
autoPlay? : boolean;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
interface IVideoPlayerState {
|
|
@@ -108,12 +109,20 @@ class VideoPlayer extends React.PureComponent<IVideoPlayerProps, IVideoPlayerSta
|
|
|
108
109
|
|
|
109
110
|
const {url, active, muted, customControls, hideDefaultControls} = this.props;
|
|
110
111
|
const controls = (!customControls && !hideDefaultControls);
|
|
112
|
+
const autoPlay = (this.props.autoPlay) ? this.props.autoPlay : false;
|
|
111
113
|
|
|
112
114
|
if (active !== false) {
|
|
113
115
|
return (
|
|
114
116
|
<div className = 'media-player'>
|
|
115
117
|
<div className = 'inner-viewer' style = {this.getVideoStyle()}>
|
|
116
|
-
<video
|
|
118
|
+
<video
|
|
119
|
+
controls = {controls}
|
|
120
|
+
onLoadedMetadata = {(e) => this.metadataLoaded(e)}
|
|
121
|
+
muted = {muted}
|
|
122
|
+
src = {url}
|
|
123
|
+
ref = {this.videoNode}
|
|
124
|
+
preload = 'auto'
|
|
125
|
+
autoPlay = {autoPlay}/>
|
|
117
126
|
{this.renderCustomControls()}
|
|
118
127
|
</div>
|
|
119
128
|
</div>
|