Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 3277 Rev 3278
Línea 38... Línea 38...
38
        })
38
        })
39
        console.log('>>: err > ', err)
39
        console.log('>>: err > ', err)
40
      })
40
      })
41
  }
41
  }
Línea 42... Línea 42...
42
 
42
 
43
  const deleteNotifications = () => {
43
  const deleteAllNotifications = () => {
44
    axios.post('/notifications/clear')
44
    axios.post('/notifications/clear')
45
      .then(({ data }) => {
45
      .then(({ data }) => {
46
        !data.success && addNotification({ style: 'danger', msg: data.data })
46
        !data.success && addNotification({ style: 'danger', msg: data.data })
47
        addNotification({ style: 'success', msg: data.data })
47
        addNotification({ style: 'success', msg: data.data })
48
        setNotifications([])
48
        setNotifications([])
49
      })
49
      })
50
      .catch(err => addNotification({ style: "danger", msg: `Error: ${err}` }))
50
      .catch(err => addNotification({ style: "danger", msg: `Error: ${err}` }))
Línea -... Línea 51...
-
 
51
  }
-
 
52
 
-
 
53
  const deleteNotification = (link_delete) => {
-
 
54
    axios.post(link_delete)
-
 
55
      .then(({ data }) => {
-
 
56
        !data.success && addNotification({ style: 'danger', msg: data.data })
-
 
57
        addNotification({ style: 'success', msg: data.data })
-
 
58
        setNotifications(notifications.filter(notification => notification.link_delete !== link_delete))
-
 
59
      })
-
 
60
      .catch(err => addNotification({ style: "danger", msg: `Error: ${err}` }))
51
  }
61
  }
52
 
62
 
53
  useLayoutEffect(() => {
63
  useLayoutEffect(() => {
54
    const handleClickOutside = (event) => {
64
    const handleClickOutside = (event) => {
55
      if (menuOptions.current && !menuOptions.current.contains(event.target)) {
65
      if (menuOptions.current && !menuOptions.current.contains(event.target)) {
Línea 86... Línea 96...
86
            <div className="messages-sec border-gray px-5 py-4">
96
            <div className="messages-sec border-gray px-5 py-4">
87
              <div className="d-flex align-items-center justify-content-between">
97
              <div className="d-flex align-items-center justify-content-between">
88
                <h2 className="card-title" style={{ fontSize: '1.7rem', fontWeight: '700' }}>
98
                <h2 className="card-title" style={{ fontSize: '1.7rem', fontWeight: '700' }}>
89
                  Notificaciones
99
                  Notificaciones
90
                </h2>
100
                </h2>
91
                <div className="cursor-pointer d-flex align-items-center">
101
                <div className="cursor-pointer d-flex align-items-center mb-3 position-relative">
92
                  <BiDotsVerticalRounded
102
                  <BiDotsVerticalRounded
93
                    onClick={() => setDisplayOption(!displayOption)}
103
                    onClick={() => setDisplayOption(!displayOption)}
94
                    style={{ fontSize: '1.5rem' }}
104
                    style={{ fontSize: '1.5rem' }}
95
                  />
105
                  />
96
                  <div className={`feed-options ${displayOption ? 'active' : ''}`} ref={menuOptions} >
106
                  <div className={`feed-options ${displayOption ? 'active' : ''}`} ref={menuOptions} >
97
                    <ul>
107
                    <ul>
98
                      <li>
108
                      <li>
99
                        <button
109
                        <button
100
                          className="option-btn"
110
                          className="option-btn mb-2"
101
                          onClick={deleteNotifications}
111
                          onClick={deleteAllNotifications}
102
                        >
112
                        >
103
                          <BsTrash className="mr-1" />
113
                          <BsTrash className="mr-1" />
104
                          Borrar notificaciones
114
                          Borrar notificaciones
105
                        </button>
115
                        </button>
106
                      </li>
116
                      </li>
Línea 120... Línea 130...
120
              <ul>
130
              <ul>
121
                {notifications.length
131
                {notifications.length
122
                  ? [...notifications].reverse().map((element, i) =>
132
                  ? [...notifications].reverse().map((element, i) =>
123
                    <li key={i}>
133
                    <li key={i}>
124
                      <div className="notification-item">
134
                      <div className="notification-item">
-
 
135
                        <div className="d-inline-flex flex-column">
125
                        <a href={element.link}>
136
                          <a href={element.link} className='mb-2'>
126
                          {element.message}
137
                            {element.message}
127
                        </a>
138
                          </a>
128
                        <span>
139
                          <span>
129
                          {element.time_elapsed}
140
                            {element.time_elapsed}
130
                        </span>
141
                          </span>
-
 
142
                        </div>
-
 
143
                        <BsTrash className='cursor-pointer' onClick={() => deleteNotification(element.link_delete)} />
131
                      </div>
144
                      </div>
132
                    </li>
145
                    </li>
133
                  )
146
                  )
134
                  :
147
                  :
135
                  <div
148
                  <div