Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2997 Rev 2998
Línea 15... Línea 15...
15
import { useFetch } from '@hooks'
15
import { useFetch } from '@hooks'
16
import { addNotification } from '@store/notification/notification.actions'
16
import { addNotification } from '@store/notification/notification.actions'
Línea 17... Línea 17...
17
 
17
 
18
import Widget from '@components/UI/Widget'
18
import Widget from '@components/UI/Widget'
19
import Options from '@components/UI/Option'
19
import Options from '@components/UI/Option'
20
import ProfileInfo from '@components/widgets/default/ProfileWidget'
20
import Spinner from '@components/UI/Spinner'
-
 
21
import EmptySection from '@components/UI/EmptySection'
21
import EmptySection from '@components/UI/EmptySection'
22
import ProfileInfo from '@components/widgets/default/ProfileWidget'
Línea 22... Línea 23...
22
import ConfirmModal from '@components/modals/ConfirmModal'
23
import ConfirmModal from '@components/modals/ConfirmModal'
23
 
24
 
24
const NotificationsPage = () => {
25
const NotificationsPage = () => {
-
 
26
  const { data: user } = useFetch('/helpers/menu')
-
 
27
  const { data: fetchedNotifications, isLoading } = useFetch(
-
 
28
    '/notifications',
25
  const { data: user } = useFetch('/helpers/menu')
29
    []
26
  const { data: fetchedNotifications } = useFetch('/notifications', [])
30
  )
27
  const [notifications, setNotifications] = useState([])
31
  const [notifications, setNotifications] = useState([])
28
  const [deleteModalState, setDeleteModalState] = useState({
32
  const [deleteModalState, setDeleteModalState] = useState({
29
    show: false,
33
    show: false,
Línea 114... Línea 118...
114
                  </Options.Item>
118
                  </Options.Item>
115
                </Options>
119
                </Options>
116
              )}
120
              )}
117
            />
121
            />
118
            <Widget.Body>
122
            <Widget.Body>
-
 
123
              {isLoading && <Spinner />}
119
              {notifications.length === 0 ? (
124
              {notifications.length === 0 && !isLoading && (
120
                <EmptySection message='No hay notificaciones' align='center' />
125
                <EmptySection message='No hay notificaciones' align='center' />
121
              ) : (
-
 
122
                <List sx={{ maxHeight: '60vh', overflow: 'auto' }}>
-
 
123
                  {notifications.map(
-
 
124
                    ({ link_delete, link, message, time_elapsed }) => (
-
 
125
                      <ListItem
-
 
126
                        key={link}
-
 
127
                        secondaryAction={
-
 
128
                          <IconButton onClick={() => handleDelete(link_delete)}>
-
 
129
                            <Delete />
-
 
130
                          </IconButton>
-
 
131
                        }
-
 
132
                      >
-
 
133
                        <ListItemButton LinkComponent={Link} to={link}>
-
 
134
                          <ListItemText
-
 
135
                            primary={message}
-
 
136
                            secondary={time_elapsed}
-
 
137
                          />
-
 
138
                        </ListItemButton>
-
 
139
                      </ListItem>
-
 
140
                    )
-
 
141
                  )}
-
 
142
                </List>
-
 
143
              )}
126
              )}
-
 
127
 
-
 
128
              <List sx={{ maxHeight: '60vh', overflow: 'auto' }}>
-
 
129
                {notifications.map(
-
 
130
                  ({ link_delete, link, message, time_elapsed }) => (
-
 
131
                    <ListItem
-
 
132
                      key={link}
-
 
133
                      secondaryAction={
-
 
134
                        <IconButton onClick={() => handleDelete(link_delete)}>
-
 
135
                          <Delete />
-
 
136
                        </IconButton>
-
 
137
                      }
-
 
138
                    >
-
 
139
                      <ListItemButton LinkComponent={Link} to={link}>
-
 
140
                        <ListItemText
-
 
141
                          primary={message}
-
 
142
                          secondary={time_elapsed}
-
 
143
                        />
-
 
144
                      </ListItemButton>
-
 
145
                    </ListItem>
-
 
146
                  )
-
 
147
                )}
-
 
148
              </List>
144
            </Widget.Body>
149
            </Widget.Body>
145
          </Widget>
150
          </Widget>
146
        </Grid>
151
        </Grid>
147
      </Grid>
152
      </Grid>
148
      <ConfirmModal
153
      <ConfirmModal