Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 16001 Rev 16002
Línea 67... Línea 67...
67
        );
67
        );
Línea 68... Línea 68...
68
 
68
 
69
        if (updatedMessages.length > 0) {
69
        if (updatedMessages.length > 0) {
70
          setMessages((prevMessages) => [...prevMessages, ...updatedMessages]);
70
          setMessages((prevMessages) => [...prevMessages, ...updatedMessages]);
71
          setTotalPages(data.pages);
71
          setTotalPages(data.pages);
72
          scrollToBottom();
72
          scrollTo(scrollList);
73
        }
73
        }
74
      })
74
      })
75
      .finally(() => setLoading(false));
75
      .finally(() => setLoading(false));
Línea 76... Línea 76...
76
  };
76
  };
77
 
77
 
78
  const onIntersection = (entities) => {
78
  const onIntersection = (entities) => {
79
    const target = entities[0];
79
    const target = entities[0];
80
    if (target.isIntersecting && currentPage < totalPages) {
80
    if (target.isIntersecting && currentPage < totalPages) {
81
      setCurrentPage((prevState) => prevState + 1);
81
      setCurrentPage((prevState) => prevState + 1);
82
      scrollTo(messageList, 200);
82
      scrollTo(scrollList, 200);
Línea 83... Línea 83...
83
    }
83
    }
84
  };
84
  };
Línea 98... Línea 98...
98
 
98
 
99
  //Utilitys
99
  //Utilitys
100
  const scrollTo = (element, distance) => {
100
  const scrollTo = (element, distance) => {
101
    const divToScrollEl = element.current;
101
    const divToScrollEl = element.current;
102
    if (!distance) {
102
    if (!distance) {
103
      element.current.scrollBy(0, element.current.scrollHeight);
103
      divToScrollEl.scrollBy(0, divToScrollEl.scrollHeight);
104
      return;
104
      return;
105
    }
105
    }
106
    element.current.scrollBy(0, distance);
106
    divToScrollEl.scrollBy(0, distance);
Línea 107... Línea 107...
107
  };
107
  };
108
 
108
 
109
  const onClickEmoji = (event) => {
109
  const onClickEmoji = (event) => {
Línea 147... Línea 147...
147
        console.log("Ha ocurrido un error: " + data);
147
        console.log("Ha ocurrido un error: " + data);
148
        return;
148
        return;
149
      }
149
      }
150
      inputTextEl.current.value = "";
150
      inputTextEl.current.value = "";
151
      setShowEmojione(false);
151
      setShowEmojione(false);
152
      scrollToBottom();
152
      scrollTo(scrollList);
153
    });
153
    });
154
  };
154
  };
Línea 155... Línea 155...
155
 
155
 
156
  const handleSendFile = () => {
156
  const handleSendFile = () => {
Línea 162... Línea 162...
162
        console.log("Ha ocurrido un error: " + data);
162
        console.log("Ha ocurrido un error: " + data);
163
        return;
163
        return;
164
      }
164
      }
165
      setSelectedFile("");
165
      setSelectedFile("");
166
      setShowEmojione(false);
166
      setShowEmojione(false);
167
      scrollToBottom();
167
      scrollTo(scrollList);
168
    });
168
    });
169
  };
169
  };
Línea 170... Línea 170...
170
 
170
 
171
  useEffect(() => {
171
  useEffect(() => {
Línea 225... Línea 225...
225
            hidden
225
            hidden
226
          />
226
          />
227
          <textarea
227
          <textarea
228
            className={styles.chatInput}
228
            className={styles.chatInput}
229
            placeholder="Escribe un mensaje"
229
            placeholder="Escribe un mensaje"
230
            ref={inputTextEl}
-
 
231
            onKeyDown={handleKeyDown}
230
            onKeyDown={handleKeyDown}
-
 
231
            ref={inputTextEl}
-
 
232
            rows="1"
232
          />
233
          />
233
          <button type="submit" className={"btn " + styles.send_btn}>
234
          <button type="submit" className={"btn " + styles.send_btn}>
234
            <SendIcon />
235
            <SendIcon />
235
          </button>
236
          </button>
236
        </form>
237
        </form>