Timeline.vue 1.24 KB
Newer Older
Eliot Berriot's avatar
Eliot Berriot committed
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
<template>
  <div class="main pusher">
    <div class="ui vertical center aligned stripe segment">
      <div class="ui text container">
        <h1 class="ui header">Recent activity on this instance</h1>
        <div class="ui feed">
          <component
            class="event"
            v-for="(event, index) in events"
            :key="event.id + index"
            v-if="components[event.type]"
            :is="components[event.type]"
            :event="event">
            <username
              class="user"
              :username="event.actor.local_id"
              slot="user"></username>
              {{ event.published }}
            <human-date class="date" :date="event.published" slot="date"></human-date>
          </component>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {mapState} from 'vuex'

import Like from '@/components/activity/Like'
import Listen from '@/components/activity/Listen'

export default {
  data () {
    return {
      components: {
        'Like': Like,
        'Listen': Listen
      }
    }
  },
  computed: {
    ...mapState({
      events: state => state.instance.events
    })
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>