Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 3773 Rev 3795
Línea 52... Línea 52...
52
  const [totalComments, setTotalComments] = useState(comments.length || 0);
52
  const [totalComments, setTotalComments] = useState(comments.length || 0);
53
  const [feedIsLiked, setFeedIsLiked] = useState(feed_is_liked);
53
  const [feedIsLiked, setFeedIsLiked] = useState(feed_is_liked);
54
  const [commentsState, setCommentsState] = useState(comments);
54
  const [commentsState, setCommentsState] = useState(comments);
55
  const [sharedState, setSharedState] = useState(owner_shared);
55
  const [sharedState, setSharedState] = useState(owner_shared);
56
  const [likesState, setLikesState] = useState(feed_likes);
56
  const [likesState, setLikesState] = useState(feed_likes);
-
 
57
  const [shareUrl, setShareUrl] = useState('');
Línea 57... Línea 58...
57
 
58
 
58
  const [shareOptions, setShareOptions] = useState(false)
59
  const [shareOptions, setShareOptions] = useState(false)
Línea 74... Línea 75...
74
    return () => {
75
    return () => {
75
      document.removeEventListener("mousedown", handleClickOutside);
76
      document.removeEventListener("mousedown", handleClickOutside);
76
    };
77
    };
77
  }, [shareContainer]);
78
  }, [shareContainer]);
Línea -... Línea 79...
-
 
79
 
-
 
80
  const getShareUrl = (url) => {
-
 
81
    axios.get(url)
-
 
82
      .then(({ data }) => {
-
 
83
        if (!data.success) {
-
 
84
          dispatch(addNotification({ style: 'danger', msg: data.data }))
-
 
85
          setShareOptions(false)
-
 
86
          return
-
 
87
        }
-
 
88
        setShareUrl(data.data)
-
 
89
      })
-
 
90
  }
78
 
91
 
79
  const likeHandler = (likeUrl) => {
92
  const likeHandler = (likeUrl) => {
80
    axios.post(likeUrl)
93
    axios.post(likeUrl)
81
      .then((res) => {
94
      .then((res) => {
82
        const { success, data } = res.data;
95
        const { success, data } = res.data;
Línea 224... Línea 237...
224
              >
237
              >
225
                <BiShareAlt />
238
                <BiShareAlt />
226
              </button>
239
              </button>
227
              {shareOptions &&
240
              {shareOptions &&
228
                <div className="ext_share" ref={shareContainer}>
241
                <div className="ext_share" ref={shareContainer}>
229
                  <FacebookShareButton url={feed_share_external_url}>
242
                  <FacebookShareButton beforeOnClick={() => getShareUrl(feed_share_external_url)} url={shareUrl}>
230
                    <FacebookIcon size={32} round />
243
                    <FacebookIcon size={32} round />
231
                  </FacebookShareButton>
244
                  </FacebookShareButton>
232
                  <TwitterShareButton url={feed_share_external_url}>
245
                  <TwitterShareButton beforeOnClick={() => getShareUrl(feed_share_external_url)} url={shareUrl}>
233
                    <TwitterIcon size={32} round />
246
                    <TwitterIcon size={32} round />
234
                  </TwitterShareButton>
247
                  </TwitterShareButton>
235
                  <TelegramShareButton url={feed_share_external_url}>
248
                  <TelegramShareButton beforeOnClick={() => getShareUrl(feed_share_external_url)} url={shareUrl}>
236
                    <TelegramIcon size={32} round />
249
                    <TelegramIcon size={32} round />
237
                  </TelegramShareButton>
250
                  </TelegramShareButton>
238
                  <WhatsappShareButton url={feed_share_external_url}>
251
                  <WhatsappShareButton beforeOnClick={() => getShareUrl(feed_share_external_url)} url={shareUrl}>
239
                    <WhatsappIcon size={32} round />
252
                    <WhatsappIcon size={32} round />
240
                  </WhatsappShareButton>
253
                  </WhatsappShareButton>
241
                  <RedditShareButton url={feed_share_external_url}>
254
                  <RedditShareButton beforeOnClick={() => getShareUrl(feed_share_external_url)} url={shareUrl}>
242
                    <RedditIcon size={32} round />
255
                    <RedditIcon size={32} round />
243
                  </RedditShareButton>
256
                  </RedditShareButton>
244
                  <EmailShareButton url={feed_share_external_url}>
257
                  <EmailShareButton beforeOnClick={() => getShareUrl(feed_share_external_url)} url={shareUrl}>
245
                    <EmailIcon size={32} round />
258
                    <EmailIcon size={32} round />
246
                  </EmailShareButton>
259
                  </EmailShareButton>
247
                </div>
260
                </div>
248
              }
261
              }
249
            </li>
262
            </li>