mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 07:08:10 +00:00
remove contentview selector and view description if edit mode is on
This commit is contained in:
parent
b4bed57d4c
commit
fb06c66437
@ -12,13 +12,13 @@ ContentViewOptions.propTypes = {
|
||||
function ContentViewOptions({ flow, message, uploadContent, readonly, contentViewDescription }) {
|
||||
return (
|
||||
<div className="view-options">
|
||||
<ViewSelector message={message}/>
|
||||
{readonly ? <ViewSelector message={message}/> : <span><b>View:</b> edit</span>}
|
||||
|
||||
<DownloadContentButton flow={flow} message={message}/>
|
||||
|
||||
{!readonly && <UploadContentButton uploadContent={uploadContent}/> }
|
||||
|
||||
<span>{contentViewDescription}</span>
|
||||
{readonly && <span>{contentViewDescription}</span>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import React, { PropTypes, Component } from 'react'
|
||||
import { connect } from 'react-redux'
|
||||
import * as ContentViews from './ContentViews'
|
||||
import { setContentView } from '../../ducks/ui/flow';
|
||||
import Dropdown from '../common/Dropdown'
|
||||
|
||||
@ -8,27 +7,20 @@ import Dropdown from '../common/Dropdown'
|
||||
ViewSelector.propTypes = {
|
||||
contentViews: PropTypes.array.isRequired,
|
||||
activeView: PropTypes.string.isRequired,
|
||||
isEdit: PropTypes.bool.isRequired,
|
||||
setContentView: PropTypes.func.isRequired
|
||||
}
|
||||
|
||||
function ViewSelector ({contentViews, activeView, isEdit, setContentView}){
|
||||
let edit = ContentViews.Edit.displayName
|
||||
let inner = <span> <b>View:</b> {activeView} <span className="caret"></span> </span>
|
||||
function ViewSelector ({contentViews, activeView, setContentView}){
|
||||
let inner = <span> <b>View:</b> {activeView.toLowerCase()} <span className="caret"></span> </span>
|
||||
|
||||
return (
|
||||
<Dropdown dropup className="pull-left" btnClass="btn btn-default btn-xs" text={inner}>
|
||||
{contentViews.map(name =>
|
||||
<a href="#" key={name} onClick={e => {e.preventDefault(); setContentView(name)}}>
|
||||
<a href="#" key={name} onClick={e => {e.preventDefault(); setContentView(name)}}>
|
||||
{name.toLowerCase().replace('_', ' ')}
|
||||
</a>
|
||||
)
|
||||
}
|
||||
{isEdit &&
|
||||
<a href="#" onClick={e => {e.preventDefault(); setContentView(edit)}}>
|
||||
{edit.toLowerCase()}
|
||||
</a>
|
||||
}
|
||||
</Dropdown>
|
||||
)
|
||||
}
|
||||
@ -37,7 +29,6 @@ export default connect (
|
||||
state => ({
|
||||
contentViews: state.settings.contentViews,
|
||||
activeView: state.ui.flow.contentView,
|
||||
isEdit: !!state.ui.flow.modifiedFlow,
|
||||
}), {
|
||||
setContentView,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user