Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 2468 | Rev 2470 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1309 steven 1
import React from 'react';
2
import { useState } from 'react';
3
import { useLayoutEffect } from 'react';
2468 stevensc 4
import ProfileInfo from '../dashboard/components/home-section/ProfileInfo';
5
import SocialNetworks from '../dashboard/components/home-section/SocialNetworks';
1309 steven 6
import { axios } from '../utils';
1307 steven 7
 
2469 stevensc 8
const Notifications = ({ image, fullName, country, visits, connections, description }) => {
2468 stevensc 9
 
1309 steven 10
  const [notifications, setNotifications] = useState([]);
2468 stevensc 11
 
1309 steven 12
  const handleNotifications = async () => {
1310 steven 13
    try {
14
      const _notifications = await axios.get('/notifications');
15
      setNotifications(_notifications.data.data)
2468 stevensc 16
      console.log('>>: _notifications ', notifications)
1310 steven 17
    } catch (error) {
18
      console.log('>>: error > ', error)
19
    }
1309 steven 20
  }
2468 stevensc 21
 
1309 steven 22
  useLayoutEffect(() => {
23
    handleNotifications();
24
  }, []);
2468 stevensc 25
 
1307 steven 26
  return (
1309 steven 27
    <section className="notifications-page">
2468 stevensc 28
      <div className="card notifications-grid">
29
        <div className='main-left-sidebar'>
30
          <ProfileInfo
31
            image={image}
32
            fullName={fullName}
33
            description={description}
34
            visits={visits}
35
            country={country}
36
            connections={connections}
37
          />
38
          <SocialNetworks />
39
        </div>
1311 steven 40
        <div className="card-body">
41
          <div className="container">
2468 stevensc 42
            <h2 className="card-title" style={{
43
              fontSize: '1.7rem'
44
            }}>Notificaciones</h2>
1311 steven 45
            <div className="messages-sec">
46
              <table className="table table-striped">
47
                <tbody>
48
                  {
49
                    !!notifications.length && (
50
                      notifications.map((element, i) => {
2468 stevensc 51
                        return (
1311 steven 52
                          <tr key={i.toString()}>
53
                            <td>
1314 steven 54
                              <div
1316 steven 55
                                className="row w-100"
1314 steven 56
                              >
57
                                <div
1316 steven 58
                                  className="col-md-6 col-sm-12"
1314 steven 59
                                >
60
                                  <a href={element.link}>
61
                                    {element.message}
62
                                  </a>
63
                                </div>
64
                                <div
1316 steven 65
                                  className="col-md-6 col-sm-12 text-right w-100"
1314 steven 66
                                >
67
                                  <span className="w-100 text-right"> {element.time_elapsed} </span>
68
                                </div>
69
                              </div>
1311 steven 70
                            </td>
71
                          </tr>
72
                        )
73
                      })
1310 steven 74
                    )
1311 steven 75
                  }
76
                </tbody>
77
              </table>
78
            </div>
79
          </div>
1309 steven 80
        </div>
81
      </div>
2468 stevensc 82
    </section >
1307 steven 83
  )
84
}
2469 stevensc 85
export default Notifications