-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[File] adds basic info when file has no player
- Loading branch information
Showing
4 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/core/Resources/modules/resources/file/player/components/overview.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React, {Fragment} from 'react' | ||
import {PropTypes as T} from 'prop-types' | ||
import get from 'lodash/get' | ||
|
||
import {trans, fileSize} from '#/main/app/intl' | ||
import {CALLBACK_BUTTON, URL_BUTTON} from '#/main/app/buttons' | ||
import {Toolbar} from '#/main/app/action' | ||
import {ContentHtml} from '#/main/app/content/components/html' | ||
import {route} from '#/main/core/workspace/routing' | ||
|
||
const PlayerOverview = (props) => | ||
<Fragment> | ||
{get(props.resourceNode, 'meta.description') && | ||
<div className="panel panel-default" style={{marginTop: 20}}> | ||
<ContentHtml className="panel-body">{get(props.resourceNode, 'meta.description')}</ContentHtml> | ||
</div> | ||
} | ||
|
||
<div className="well well-sm component-container" style={{marginTop: !get(props.resourceNode, 'meta.description') ? 20 : 0}}> | ||
<span className="fa fa-fw fa-file icon-with-text-right" /> | ||
{props.file.name} | ||
<b className="pull-right"> | ||
{fileSize(props.file.size)+trans('bytes_short')} | ||
</b> | ||
</div> | ||
|
||
<Toolbar | ||
className="component-container" | ||
buttonName="btn btn-block btn-emphasis" | ||
toolbar="download home" | ||
actions={[ | ||
{ | ||
name: 'download', | ||
type: CALLBACK_BUTTON, | ||
icon: 'fa fa-fw fa-download', | ||
label: trans('download', {}, 'actions'), | ||
callback: () => props.download(props.resourceNode), | ||
primary: true | ||
}, { | ||
name: 'home', | ||
type: URL_BUTTON, // we require an URL_BUTTON here to escape the embedded resource router | ||
icon: 'fa fa-fw fa-home', | ||
label: trans('return-home', {}, 'actions'), | ||
target: '#'+route(props.workspace), | ||
displayed: !!props.workspace | ||
} | ||
]} | ||
/> | ||
</Fragment> | ||
|
||
PlayerOverview.propTypes = { | ||
file: T.shape({ | ||
name: T.string.isRequired, | ||
size: T.number | ||
}).isRequired, | ||
resourceNode: T.shape({ | ||
name: T.string.isRequired, | ||
meta: T.shape({ | ||
description: T.string | ||
}) | ||
}), | ||
workspace: T.object, | ||
download: T.func.isRequired | ||
} | ||
|
||
export { | ||
PlayerOverview | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters