storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/browser/app/js/objects/ObjectContainer.js (about) 1 /* 2 * MinIO Cloud Storage (C) 2018 MinIO, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 import React from "react" 18 import { connect } from "react-redux" 19 import humanize from "humanize" 20 import Moment from "moment" 21 import ObjectItem from "./ObjectItem" 22 import ObjectActions from "./ObjectActions" 23 import * as actionsObjects from "./actions" 24 import { getCheckedList } from "./selectors" 25 26 export const ObjectContainer = ({ 27 object, 28 checkedObjectsCount, 29 downloadObject 30 }) => { 31 let props = { 32 name: object.name, 33 contentType: object.contentType, 34 size: humanize.filesize(object.size), 35 lastModified: Moment(object.lastModified).format("lll") 36 } 37 if (checkedObjectsCount == 0) { 38 props.actionButtons = <ObjectActions object={object} /> 39 } 40 return <ObjectItem {...props} /> 41 } 42 43 const mapStateToProps = state => { 44 return { 45 checkedObjectsCount: getCheckedList(state).length 46 } 47 } 48 49 export default connect(mapStateToProps)(ObjectContainer)