From 99eca6dfedb57024ba57495e6c5fc2dc050df5db Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 12 Jun 2017 13:01:22 +0200 Subject: [web] fix contentviews, simplify related logic --- web/src/js/components/ContentView.jsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'web/src/js/components/ContentView.jsx') diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx index a79bf9e5..cb4749c5 100644 --- a/web/src/js/components/ContentView.jsx +++ b/web/src/js/components/ContentView.jsx @@ -1,7 +1,7 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' -import * as ContentViews from './ContentView/ContentViews' +import { Edit, ViewServer, ViewImage } from './ContentView/ContentViews' import * as MetaViews from './ContentView/MetaViews' import ShowFullContentButton from './ContentView/ShowFullContentButton' @@ -16,7 +16,7 @@ ContentView.propTypes = { message: PropTypes.object.isRequired, } -ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2) +ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ViewImage.matches(msg) ? 10 : 0.2) function ContentView(props) { const { flow, message, contentView, isDisplayLarge, displayLarge, onContentChange, readonly } = props @@ -33,10 +33,15 @@ function ContentView(props) { return } - const View = ContentViews[contentView] || ContentViews['ViewServer'] + let view; + if(contentView === "Edit") { + view = + } else { + view = + } return (
- + {view}
) -- cgit v1.2.3