aboutsummaryrefslogtreecommitdiff
path: root/src/components/notifications/notifications.vue
blob: 3d5878d4d5d79621bb58e59b8318afd359def751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<template>
  <teleport
    :disabled="minimalMode || disableTeleport"
    :to="teleportTarget"
  >
    <component
      :is="noHeading ? 'div' : 'aside'"
      ref="root"
      :class="{ minimal: minimalMode }"
      class="Notifications"
    >
      <div :class="mainClass">
        <div
          v-if="!noHeading"
          class="notifications-heading panel-heading -sticky"
        >
          <div class="title">
            {{ $t('notifications.notifications') }}
            <span
              v-if="unseenCount"
              class="badge badge-notification unseen-count"
            >{{ unseenCount }}</span>
          </div>
          <div
            class="rightside-button"
            v-if="showScrollTop"
          >
            <button
              class="button-unstyled scroll-to-top-button"
              type="button"
              :title="$t('general.scroll_to_top')"
              @click="scrollToTop"
            >
              <FALayers class="fa-scale-110 fa-old-padding-layer">
                <FAIcon icon="arrow-up" />
                <FAIcon
                  icon="minus"
                  transform="up-7"
                />
              </FALayers>
            </button>
          </div>
          <button
            v-if="unseenCount"
            class="button-default read-button"
            type="button"
            @click.prevent="markAsSeen"
          >
            {{ $t('notifications.read') }}
          </button>
          <NotificationFilters class="rightside-button" />
        </div>
        <div
          class="panel-body"
          role="feed"
        >
          <div
            v-for="notification in notificationsToDisplay"
            :key="notification.id"
            role="listitem"
            class="notification"
            :class="{unseen: !minimalMode && !notification.seen}"
          >
            <div class="notification-overlay" />
            <notification :notification="notification" />
          </div>
        </div>
        <div class="panel-footer">
          <div
            v-if="bottomedOut"
            class="new-status-notification text-center faint"
          >
            {{ $t('notifications.no_more_notifications') }}
          </div>
          <button
            v-else-if="!loading"
            class="button-unstyled -link -fullwidth"
            @click.prevent="fetchOlderNotifications()"
          >
            <div class="new-status-notification text-center">
              {{ minimalMode ? $t('interactions.load_older') : $t('notifications.load_older') }}
            </div>
          </button>
          <div
            v-else
            class="new-status-notification text-center"
          >
            <FAIcon
              icon="circle-notch"
              spin
              size="lg"
            />
          </div>
        </div>
      </div>
    </component>
  </teleport>
</template>

<script src="./notifications.js"></script>
<style lang="scss" src="./notifications.scss"></style>