mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-05 04:07:20 +00:00
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
import React from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import { connect } from 'react-redux'
|
|
import ViewSelector from './ViewSelector'
|
|
import UploadContentButton from './UploadContentButton'
|
|
import DownloadContentButton from './DownloadContentButton'
|
|
import { uploadContent } from '../../ducks/flows'
|
|
|
|
ContentViewOptions.propTypes = {
|
|
flow: PropTypes.object.isRequired,
|
|
message: PropTypes.object.isRequired,
|
|
}
|
|
|
|
function ContentViewOptions({ flow, message, uploadContent, readonly, contentViewDescription }) {
|
|
return (
|
|
<div className="view-options">
|
|
{readonly ? <ViewSelector message={message}/> : <span><b>View:</b> edit</span>}
|
|
|
|
<DownloadContentButton flow={flow} message={message}/>
|
|
|
|
{!readonly && <UploadContentButton uploadContent={uploadContent}/> }
|
|
|
|
{readonly && <span>{contentViewDescription}</span>}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default connect(
|
|
state => ({
|
|
contentViewDescription: state.ui.flow.viewDescription,
|
|
readonly: !state.ui.flow.modifiedFlow,
|
|
}),
|
|
{
|
|
uploadContent: uploadContent
|
|
}
|
|
)(ContentViewOptions)
|