Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3561 | Rev 3564 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3561 Rev 3562
Línea 21... Línea 21...
21
  },
21
  },
22
  '& > img, & > video ': {
22
  '& > img, & > video ': {
23
    width: '100%',
23
    width: '100%',
24
    maxHeight: '600px',
24
    maxHeight: '600px',
25
    objectFit: 'contain',
25
    objectFit: 'contain',
26
    position: 'relative',
26
    position: 'relative'
27
    backgroundColor: '#000e'
-
 
28
  }
27
  }
29
}));
28
}));
Línea 30... Línea 29...
30
 
29
 
31
export default function FeedContent({ id }) {
30
export default function FeedContent({ id }) {
Línea 66... Línea 65...
66
    );
65
    );
67
  }, [description, contentType]);
66
  }, [description, contentType]);
Línea 68... Línea 67...
68
 
67
 
Línea 69... Línea -...
69
  const toggleModal = () => setShowModal(!showModal);
-
 
70
 
-
 
71
  const renderContent = ({
-
 
72
    description,
-
 
73
    image,
-
 
74
    document,
-
 
75
    video,
-
 
76
    imagePreview,
-
 
77
    voteUrl,
-
 
78
    sharedName,
-
 
79
    sharedImage,
-
 
80
    sharedTimeElapse,
-
 
81
    type
-
 
82
  }) => {
-
 
83
    switch (type) {
-
 
84
      case 'video': {
-
 
85
        return (
-
 
86
          <>
-
 
87
            <FeedDescription description={description} />
-
 
88
            <video poster={imagePreview} src={video} onClick={toggleModal} controls />
-
 
89
          </>
-
 
90
        );
-
 
91
      }
-
 
92
      case 'image': {
-
 
93
        return (
-
 
94
          <>
-
 
95
            <FeedDescription description={description} />
-
 
96
            <Widget.Media src={image} onClick={toggleModal} />
-
 
97
          </>
-
 
98
        );
-
 
99
      }
-
 
100
      case 'document': {
-
 
101
        return (
-
 
102
          <>
-
 
103
            <FeedDescription description={description} />
-
 
104
            <a href={document} target='_blank' rel='noreferrer'>
-
 
105
              <img className='pdf' src='/images/extension/pdf.png' alt='pdf' />
-
 
106
            </a>
-
 
107
          </>
-
 
108
        );
-
 
109
      }
-
 
110
      case 'fast-survey': {
-
 
111
        return (
-
 
112
          <SurveyForm
-
 
113
            voteUrl={voteUrl}
-
 
114
            active={Boolean(description.active)}
-
 
115
            question={description.question}
-
 
116
            time={description.time_remaining}
-
 
117
            resultType={description.result_type}
-
 
118
            answers={answers}
-
 
119
            votes={votes}
-
 
120
          />
-
 
121
        );
-
 
122
      }
-
 
123
      case 'shared': {
-
 
124
        return (
-
 
125
          <>
-
 
126
            <FeedDescription description={description} />
-
 
127
            <Widget styles={{ width: 'inherit' }}>
-
 
128
              <Widget.Header avatar={sharedImage} title={sharedName} subheader={sharedTimeElapse} />
-
 
129
              <FeedContainer>
-
 
130
                {renderContent({
-
 
131
                  type: sharedContentType,
-
 
132
                  description: sharedFeedDescription,
-
 
133
                  document: sharedFileDocument,
-
 
134
                  image: sharedFileImage,
-
 
135
                  video: sharedFileVideo,
-
 
136
                  imagePreview: sharedFileImagePreview
-
 
137
                })}
-
 
138
              </FeedContainer>
-
 
139
            </Widget>
-
 
140
          </>
-
 
141
        );
-
 
142
      }
-
 
143
      default:
-
 
144
        return <FeedDescription description={description} />;
-
 
145
    }
-
 
146
  };
68
  const toggleModal = () => setShowModal(!showModal);
147
 
69
 
148
  return (
70
  return (
149
    <FeedContainer>
71
    <FeedContainer>
150
      {description && <FeedDescription description={description} />}
72
      {description && <FeedDescription description={description} />}
Línea 171... Línea 93...
171
      )}
93
      )}
172
      {contentType === 'shared' && (
94
      {contentType === 'shared' && (
173
        <Widget styles={{ width: 'inherit' }}>
95
        <Widget styles={{ width: 'inherit' }}>
174
          <Widget.Header avatar={sharedImage} title={sharedName} subheader={sharedTimeElapse} />
96
          <Widget.Header avatar={sharedImage} title={sharedName} subheader={sharedTimeElapse} />
175
          <FeedContainer>
97
          <FeedContainer>
-
 
98
            <FeedDescription description={sharedFeedDescription} />
176
            {renderContent({
99
            {sharedContentType === 'video' && (
177
              type: sharedContentType,
100
              <video
178
              description: sharedFeedDescription,
101
                poster={sharedFileImagePreview}
179
              document: sharedFileDocument,
102
                src={sharedFileVideo}
180
              image: sharedFileImage,
103
                onClick={toggleModal}
181
              video: sharedFileVideo,
104
                controls
-
 
105
              />
-
 
106
            )}
-
 
107
            {sharedContentType === 'image' && (
182
              imagePreview: sharedFileImagePreview
108
              <Widget.Media src={sharedFileImage} onClick={toggleModal} />
-
 
109
            )}
-
 
110
            {sharedContentType === 'document' && (
-
 
111
              <a href={sharedFileDocument} target='_blank' rel='noreferrer'>
-
 
112
                <img className='pdf' src='/images/extension/pdf.png' alt='pdf' />
-
 
113
              </a>
183
            })}
114
            )}
184
          </FeedContainer>
115
          </FeedContainer>
185
        </Widget>
116
        </Widget>
186
      )}
117
      )}
187
 
-
 
188
      {renderContent({
-
 
189
        description,
-
 
190
        image,
-
 
191
        document,
-
 
192
        video,
-
 
193
        imagePreview,
-
 
194
        voteUrl,
-
 
195
        type: sharedName ? 'shared' : contentType,
-
 
196
        sharedName,
-
 
197
        sharedImage,
-
 
198
        sharedTimeElapse
-
 
199
      })}
-
 
200
    </FeedContainer>
118
    </FeedContainer>
201
  );
119
  );
202
}
120
}