Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7090 Rev 7101
Línea 14... Línea 14...
14
  TwitterShareButton,
14
  TwitterShareButton,
15
  WhatsappIcon,
15
  WhatsappIcon,
16
  WhatsappShareButton,
16
  WhatsappShareButton,
17
} from 'react-share'
17
} from 'react-share'
18
import parse from 'html-react-parser'
18
import parse from 'html-react-parser'
19
import RecommendIcon from '@mui/icons-material/Recommend'
-
 
20
import FavoriteIcon from '@mui/icons-material/FavoriteTwoTone'
-
 
21
import VolunteerActivismIcon from '@mui/icons-material/VolunteerActivism'
-
 
22
import EmojiEmotionsIcon from '@mui/icons-material/EmojiEmotions'
-
 
23
import TungstenIcon from '@mui/icons-material/Tungsten'
-
 
24
import GroupsRoundedIcon from '@mui/icons-material/GroupsRounded'
19
import GroupsRoundedIcon from '@mui/icons-material/GroupsRounded'
Línea 25... Línea 20...
25
 
20
 
26
import { feedTypes } from '../../redux/feed/feed.types'
21
import { feedTypes } from '../../redux/feed/feed.types'
Línea 55... Línea 50...
55
    comments,
50
    comments,
56
    comment_add_url,
51
    comment_add_url,
57
    feed_share_external_url,
52
    feed_share_external_url,
58
  } = feed
53
  } = feed
59
  const [totalComments, setTotalComments] = useState(0)
54
  const [totalComments, setTotalComments] = useState(0)
60
  const [ownerReactions, setOwnerReaction] = useState(feed.feed_reactions)
-
 
61
  const [totalReactions, setTotalReactions] = useState(0)
-
 
62
  const [sharedState, setSharedState] = useState(owner_shared)
55
  const [sharedState, setSharedState] = useState(owner_shared)
63
  const [shareUrl, setShareUrl] = useState('')
56
  const [shareUrl, setShareUrl] = useState('')
Línea 64... Línea 57...
64
 
57
 
65
  const [showComments, setShowComments] = useState(false)
58
  const [showComments, setShowComments] = useState(false)
Línea 69... Línea 62...
69
  const shareContainer = useRef(null)
62
  const shareContainer = useRef(null)
70
  const dispatch = useDispatch()
63
  const dispatch = useDispatch()
Línea 71... Línea 64...
71
 
64
 
Línea 72... Línea -...
72
  useOutsideClick(shareContainer, () => setShareOptions(false))
-
 
73
 
-
 
74
  const reactionsOptions = [
-
 
75
    {
-
 
76
      type: 'r',
-
 
77
      icon: <RecommendIcon style={{ color: '#7405f9' }} />,
-
 
78
    },
-
 
79
    {
-
 
80
      type: 's',
-
 
81
      icon: <VolunteerActivismIcon style={{ color: '#6495ED' }} />,
-
 
82
    },
-
 
83
    {
-
 
84
      type: 'l',
-
 
85
      icon: <FavoriteIcon style={{ color: '#DF704D' }} />,
-
 
86
    },
-
 
87
    {
-
 
88
      type: 'i',
-
 
89
      icon: (
-
 
90
        <TungstenIcon
-
 
91
          style={{ color: '#F5BB5C', transform: 'rotate(180deg)' }}
-
 
92
        />
-
 
93
      ),
-
 
94
    },
-
 
95
    {
-
 
96
      type: 'f',
-
 
97
      icon: <EmojiEmotionsIcon style={{ color: '#FF7F50' }} />,
-
 
98
    },
-
 
99
  ]
65
  useOutsideClick(shareContainer, () => setShareOptions(false))
100
 
66
 
101
  const getShareUrl = new Promise((resolve, reject) => {
67
  const getShareUrl = new Promise((resolve, reject) => {
102
    if (shareOptions) {
68
    if (shareOptions) {
103
      axios
69
      axios
Línea 130... Línea 96...
130
    )
96
    )
131
  }
97
  }
Línea 132... Línea 98...
132
 
98
 
Línea 133... Línea -...
133
  useEffect(() => setSharedState(owner_shared), [owner_shared])
-
 
134
 
-
 
135
  useEffect(() => {
-
 
136
    const feedReactions = ownerReactions?.reduce(
-
 
137
      (acc, reaction) => acc + Number(reaction.total),
-
 
138
      0
-
 
139
    )
-
 
140
    setTotalReactions(feedReactions)
-
 
141
  }, [ownerReactions])
99
  useEffect(() => setSharedState(owner_shared), [owner_shared])
142
 
100
 
143
  return (
101
  return (
144
    <>
102
    <>
145
      <FeedModal isShow={show} handleClose={() => setShow(false)} feed={feed} />
103
      <FeedModal isShow={show} handleClose={() => setShow(false)} feed={feed} />
Línea 178... Línea 136...
178
              file_image: feed.shared_file_image,
136
              file_image: feed.shared_file_image,
179
              file_document: feed.shared_file_document,
137
              file_document: feed.shared_file_document,
180
            }}
138
            }}
181
          />
139
          />
182
        </div>
140
        </div>
183
        <div className="reactions-counter">
-
 
184
          {reactionsOptions
-
 
185
            .filter((option) =>
-
 
186
              ownerReactions.find(
-
 
187
                (reaction) => reaction.reaction === option.type
-
 
188
              )
-
 
189
            )
-
 
190
            .map((reaction) => reaction.icon)}
-
 
191
          <span>{totalReactions} reacciones</span>
-
 
192
        </div>
-
 
193
        <ul className="reactions-list">
141
        <ul className="reactions-list">
194
          <li>
142
          <li>
195
            <ReactionsButton
143
            <ReactionsButton
196
              onChange={(reactions) => setOwnerReaction(reactions)}
144
              onChange={() => null}
197
              currentReaction={feed.feed_my_reaction}
145
              currentReaction={feed.feed_my_reaction}
198
              withLabel
146
              withLabel
199
              deleteUrl={feed.feed_delete_reaction_url}
147
              deleteUrl={feed.feed_delete_reaction_url}
200
              reactionTypesUrl={{
-
 
201
                r: feed.feed_save_reaction_recommended_url,
-
 
202
                s: feed.feed_save_reaction_support_url,
-
 
203
                l: feed.feed_save_reaction_love_url,
148
              saveUrl={feed.feed_save_reaction_url}
204
                i: feed.feed_save_reaction_interest_url,
-
 
205
                f: feed.feed_save_reaction_fun_url,
-
 
206
              }}
-
 
207
            />
149
            />
208
          </li>
150
          </li>
209
          <li>
151
          <li>
210
            <button
152
            <button
211
              type="button"
153
              type="button"