Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1009 Rev 1018
Línea 13... Línea 13...
13
} from "../../../redux/share-modal/shareModal.actions";
13
} from "../../../redux/share-modal/shareModal.actions";
14
import { addFeed, fetchFeeds } from "../../../redux/feed/feed.actions";
14
import { addFeed, fetchFeeds } from "../../../redux/feed/feed.actions";
15
import DropzoneComponent from "../../../shared/dropzone/DropzoneComponent";
15
import DropzoneComponent from "../../../shared/dropzone/DropzoneComponent";
16
import { shareModalTypes } from "../../../redux/share-modal/shareModal.types";
16
import { shareModalTypes } from "../../../redux/share-modal/shareModal.types";
17
import { feedTypes } from "../../../redux/feed/feed.types";
17
import { feedTypes } from "../../../redux/feed/feed.types";
18
import {CKEditor} from "ckeditor4-react";
18
import { CKEditor } from "ckeditor4-react";
-
 
19
import { axios } from "../../../utils";
-
 
20
import { CKEditor } from "ckeditor4-react";
19
import {axios} from "../../../utils";
21
import { axios } from "../../../utils";
20
import ConfirmModal from "../../../shared/confirm-modal/ConfirmModal";
22
import ConfirmModal from "../../../shared/confirm-modal/ConfirmModal";
Línea 21... Línea 23...
21
 
23
 
22
const StyledSpinnerContainer = styled.div`
24
const StyledSpinnerContainer = styled.div`
23
  position: absolute;
25
  position: absolute;
Línea 41... Línea 43...
41
    lastModalType,
43
    lastModalType,
42
    setModalType,
44
    setModalType,
43
    feedType,
45
    feedType,
44
    fetchFeeds,
46
    fetchFeeds,
45
    currentPage,
47
    currentPage,
46
    timelineUrl
48
    timelineUrl,
-
 
49
    feedSharedId
47
  } = props;
50
  } = props;
48
  // Redux dispatch Destructuring
51
  // Redux dispatch Destructuring
49
  const { closeShareModal, addNotification, addFeed, openShareModal } = props;
52
  const { closeShareModal, addNotification, addFeed, openShareModal } = props;
50
  // states
53
  // states
51
  const [loading, setLoading] = useState(false);
54
  const [loading, setLoading] = useState(false);
Línea 109... Línea 112...
109
    }
112
    }
110
  }, [modalType]);
113
  }, [modalType]);
111
  const hideDuplicatedModal = () => {
114
  const hideDuplicatedModal = () => {
112
    setTimeout(() => {
115
    setTimeout(() => {
113
      const modals = document.getElementsByClassName('modal');
116
      const modals = document.getElementsByClassName('modal');
114
      if(modals.length > 0 && modals[0].style.display !== 'none'){
117
      if (modals.length > 0 && modals[0].style.display !== 'none') {
115
        const currentModal = modals[0];
118
        const currentModal = modals[0];
116
        currentModal.style.display = 'none';
119
        currentModal.style.display = 'none';
117
        for (let index = 0; index < modals.length; index++) {
120
        for (let index = 0; index < modals.length; index++) {
118
          const element = modals[index];
121
          const element = modals[index];
119
          element.removeAttribute("tabindex"); 
122
          element.removeAttribute("tabindex");
120
        }
123
        }
121
      }
124
      }
122
    }, 3000);
125
    }, 3000);
123
  }
126
  }
Línea 149... Línea 152...
149
  const onSubmit = async (data, e) => {
152
  const onSubmit = async (data, e) => {
150
    setLoading(true);
153
    setLoading(true);
151
    const currentFormData = new FormData();
154
    const currentFormData = new FormData();
152
    for (let input in data) {
155
    for (let input in data) {
153
      currentFormData.append(input, data[input]);
156
      currentFormData.append(input, data[input]);
154
       (`${input}:${data[input]}`);
157
      (`${input}:${data[input]}`);
155
    }
158
    }
156
    await axios.post(postUrl, currentFormData).then((response) => {
159
    await axios.post(postUrl, currentFormData).then((response) => {
157
      const data = response.data;
160
      const data = response.data;
158
      const newFeed = data.data;
161
      const newFeed = data.data;
159
       (data);
162
      (data);
160
      if (data.success) {
163
      if (data.success) {
161
        closeShareModal();
164
        closeShareModal();
162
        // reset data
165
        // reset data
163
        e.target.reset();
166
        e.target.reset();
164
        setValue("description", "");
167
        setValue("description", "");
Línea 166... Línea 169...
166
        clearErrors();
169
        clearErrors();
167
        addNotification({
170
        addNotification({
168
          style: "success",
171
          style: "success",
169
          msg: "La publicación ha sido compartida",
172
          msg: "La publicación ha sido compartida",
170
        });
173
        });
-
 
174
        if (feedSharedId) {
-
 
175
          addFeed(newFeed, feedSharedId);
-
 
176
        } else {
171
        addFeed(newFeed);
177
          addFeed(newFeed);
-
 
178
        }
172
        if (modalType !== shareModalTypes.SHARE) {
179
        if (modalType !== shareModalTypes.SHARE) {
173
          console.log('>>: currentPage', currentPage, timelineUrl)
180
          console.log('>>: currentPage', currentPage, timelineUrl)
174
        }
181
        }
175
        if(currentPage && timelineUrl){
182
        if (currentPage && timelineUrl) {
176
          fetchFeeds(timelineUrl, currentPage)
183
          fetchFeeds(timelineUrl, currentPage)
177
        }
184
        }
178
          
185
 
179
      } else {
186
      } else {
180
        if (data.data.description || data.data.file || data.data.share_width) {
187
        if (data.data.description || data.data.file || data.data.share_width) {
181
          Object.entries(data.data).map(([key, value]) => {
188
          Object.entries(data.data).map(([key, value]) => {
182
            setError(key, { type: "required", message: value });
189
            setError(key, { type: "required", message: value });
183
          });
190
          });
Línea 269... Línea 276...
269
                startupFocus: "end",
276
                startupFocus: "end",
270
                allowedContent: false,
277
                allowedContent: false,
271
                toolbarGroups: [
278
                toolbarGroups: [
272
                  // { name: 'document',	   groups: [ 'mode', 'document', 'doctools' ] },
279
                  // { name: 'document',	   groups: [ 'mode', 'document', 'doctools' ] },
273
                  // { name: 'clipboard',   groups: [ 'undo' ] },
280
                  // { name: 'clipboard',   groups: [ 'undo' ] },
274
                  { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
281
                  { name: 'editing', groups: ['find', 'selection', 'spellchecker'] },
275
                  { name: 'forms' },
282
                  { name: 'forms' },
276
                  { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
283
                  { name: 'basicstyles', groups: ['basicstyles', 'cleanup'] },
277
                  { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
284
                  { name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'] },
278
                  { name: 'links' },
285
                  { name: 'links' },
279
                  { name: 'insert' },
286
                  { name: 'insert' },
280
                  { name: 'styles' },
287
                  { name: 'styles' },
281
                  { name: 'colors' },
288
                  { name: 'colors' },
282
                  { name: 'tools' },
289
                  { name: 'tools' },
Línea 286... Línea 293...
286
                // removePlugins: 'Clipboard,Paste'
293
                // removePlugins: 'Clipboard,Paste'
287
              }}
294
              }}
288
              name="description"
295
              name="description"
289
              onBeforeLoad={() => {
296
              onBeforeLoad={() => {
290
                setIsCKEditorLoading(false);
297
                setIsCKEditorLoading(false);
-
 
298
                ("Ready");
291
                 ("Ready");
299
                ("Ready");
292
              }}
300
              }}
293
            />
301
            />
294
            {isCKEditorLoading && (
302
            {isCKEditorLoading && (
295
              <StyledSpinnerContainer>
303
              <StyledSpinnerContainer>
296
                <Spinner />
304
                <Spinner />