Beispiel #1
0
    render() {
        if(!this.props.show) {
            return <span></span>;
        }
        return (
            <MuiThemeProvider muiTheme={muiTheme}>
                <div className="slot party-slot" style={{cursor: "default"}}> 
                    {this.props.Image ? 
                        <div className="party-image">
                            <img src={this.props.Image} />
                        </div> : ""
                    }
                    <div className="slot-title">
                        {this.props.Name}
                    </div>
                    
                    <div className="slot-description">
                        {renderHTML(this.props.Description)}
                    </div>
                    <div className="slot-chips">
                        {this.state.Chips.map((item, index) => {
                            return <Chip key={index} style={chipStyle}>{item}</Chip>
                        })}
                    </div>
                    <div className="slot-party-location">
                        <RoomIcon style={{marginBottom: "-8px"}}/> {this.props.Location}<br />
                        <ScheduleIcon style={{marginBottom: "-8px", marginTop: "8px"}}/>   {this.props.Time}
                    </div>
                    {/*<div className="slot-likes">
                        {this.props.Stars} Stars
                    </div>
                    <div className="slot-like-button">
                        <FloatingActionButton backgroundColor={indigo500} mini={true} onClick={this.onClick.bind(this)}>
                            {this.props.Star ? <StarIcon /> : <StarIconEmpty />}
                        </FloatingActionButton>
                    </div>*/}


                </div>
            </MuiThemeProvider>
        );
    }
    render: function(){
        const {question} = this.props;
        return (
          <div  style={{width: '100%'}}>
            <h1>{question.title}</h1>
            <h3>{renderHTML(question.text)}</h3>

            <br />
            <div style={{display: 'flex', flexDirection: 'row'}}>
                <div style={{width: '50%'}}>
                    {this.renderBody()}
                </div>
                <div style={{width: '50%', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center'}}>
                    <span style={{fontSize: '30px'}}>{this.props.answer.mark}/{question.max_points || 1}</span>
                </div>
            </div>


          </div>
        )
    }
    renderEssay: function(){
        const {answer} = this.state;
        if(this.props.disabled || answer.submited){
            return (
                <div>
                    {renderHTML(answer.value)}
                </div>
            )
        }
        return(
            <div>
                <h3>Write your answer :</h3>
                  <ReactQuill theme="snow" value={answer.value}
                      onChange={(value)=>{
                          this.setState({answer : {...answer, value}});
                      }}
                    />
            </div>

        )
    },
 (err, res) => {
   if (err) {
     toast.error(
       <div>
         Instance <strong>{self.props.instance.technicalName}</strong>{" "}
         starting error: {"" + err}
       </div>
     );
     toast.error(
       <div style={{ width: "30rem" }}>
         {renderHTML(err.response.data)}
       </div>
     );
   } else {
     toast.success(
       <div>
         <i className="fa fa-play-circle" /> Instance{" "}
         <strong>{self.props.instance.technicalName}</strong> has been
         started
       </div>
     );
   }
 }
const BlockWidget = props => {
  const inputPorts = Object.keys(props.node.ports).filter(
    p => props.node.ports[p].in
  );
  const outputPorts = Object.keys(props.node.ports).filter(
    p => !props.node.ports[p].in
  );

  const minHeight =
    Math.max(inputPorts.length, outputPorts.length) * portHeight;

  const block = props.node.loading ? (
    <LoadingBlock classes={props.classes} node={props.node} />
  ) : (
    <Paper
      className={classNames(props.classes.block, {
        [props.classes.selectedBlock]: props.node.selected,
      })}
      elevation={8}
      onClick={e => props.node.clickHandler(e)}
      onMouseDown={e => {
        if (!e.isPortClick) {
          props.node.mouseDownHandler(true);
        }
      }}
      onMouseUp={() => props.node.mouseDownHandler(false)}
    >
      <Typography className={props.classes.title}>
        {props.node.label}
      </Typography>

      <div className={props.classes.blockContents} style={{ minHeight }}>
        <div className={props.classes.iconContents}>
          {props.node.icon && props.node.icon !== '<svg/>'
            ? renderHTML(props.node.icon)
            : null}
        </div>
        <div className={props.classes.inputPortsContainer}>
          {inputPorts.map(p => (
            <BlockPortWidget
              key={props.node.ports[p].id}
              nodeId={props.node.id}
              portId={p}
            />
          ))}
        </div>
        <div className={props.classes.outputPortsContainer}>
          {outputPorts.map(p => (
            <BlockPortWidget
              key={props.node.ports[p].id}
              nodeId={props.node.id}
              portId={p}
            />
          ))}
        </div>
      </div>
      <Typography className={props.classes.description}>
        {props.node.description}
      </Typography>
    </Paper>
  );
  return props.node.isHiddenLink ? (
    <div
      style={{ display: 'flex', position: 'relative', maxWidth: '5px' }}
      onClick={e => props.node.clickHandler(e)}
      role="presentation"
    >
      <div style={{ position: 'absolute', right: '100%' }}>
        <Typography>
          {props.node.label.split(hiddenLinkIdSeparator)[0]}
        </Typography>
      </div>
      {outputPorts.map(p => (
        <div style={{ position: 'absolute', left: '100%' }}>
          <BlockPortWidget
            key={props.node.ports[p].id}
            nodeId={props.node.id}
            portId={p}
          />
        </div>
      ))}
    </div>
  ) : (
    block
  );
};
 {preview.split(/\n/).map((item,i)=> <Flexbox element='article' key={i}>{renderHTML(item)}</Flexbox>)}
 L: (text, ...args) => {
     const translated = translator(text, ...args);
     return RenderHTML(translated);
 },