App.vue 3.7 KB
Newer Older
1
2
3
<template>
  <div id="app">
    <sidebar></sidebar>
4
    <router-view :key="$route.fullPath"></router-view>
Eliot Berriot's avatar
Eliot Berriot committed
5
    <div class="ui fitted divider"></div>
6
7
8
9
10
11
    <div id="footer" class="ui vertical footer segment">
      <div class="ui container">
        <div class="ui stackable equal height stackable grid">
          <div class="three wide column">
            <h4 class="ui header">Links</h4>
            <div class="ui link list">
12
13
14
              <router-link class="item" to="/about">
                About this instance
              </router-link>
15
16
17
18
19
20
21
22
23
24
25
26
27
              <a href="https://funkwhale.audio" class="item" target="_blank">Official website</a>
              <a href="https://docs.funkwhale.audio" class="item" target="_blank">Documentation</a>
              <a href="https://code.eliotberriot.com/funkwhale/funkwhale" class="item" target="_blank">Source code</a>
              <a href="https://code.eliotberriot.com/funkwhale/funkwhale/issues" class="item" target="_blank">Issue tracker</a>
            </div>
          </div>
          <div class="ten wide column">
            <h4 class="ui header">About funkwhale</h4>
            <p>Funkwhale is a free and open-source project run by volunteers. You can help us improve the platform by reporting bugs, suggesting features and share the project with your friends!</p>
          </div>
        </div>
      </div>
    </div>
Eliot Berriot's avatar
Eliot Berriot committed
28
29
30
31
    <raven
      v-if="$store.state.instance.settings.raven.front_enabled.value"
      :dsn="$store.state.instance.settings.raven.front_dsn.value">
    </raven>
32
33
34
35
  </div>
</template>

<script>
Eliot Berriot's avatar
Eliot Berriot committed
36
37
38
import { WebSocketBridge } from 'django-channels'

import logger from '@/logging'
39
import Sidebar from '@/components/Sidebar'
Eliot Berriot's avatar
Eliot Berriot committed
40
import Raven from '@/components/Raven'
41
42
43

export default {
  name: 'app',
Eliot Berriot's avatar
Eliot Berriot committed
44
45
46
47
  components: {
    Sidebar,
    Raven
  },
48
49
  created () {
    this.$store.dispatch('instance/fetchSettings')
Eliot Berriot's avatar
Eliot Berriot committed
50
51
    this.openWebsocket()
    let self = this
52
53
54
55
    setInterval(() => {
      // used to redraw ago dates every minute
      self.$store.commit('ui/computeLastDate')
    }, 1000 * 60)
Eliot Berriot's avatar
Eliot Berriot committed
56
57
58
  },
  methods: {
    openWebsocket () {
59
60
61
      if (!this.$store.state.auth.authenticated) {
        return
      }
Eliot Berriot's avatar
Eliot Berriot committed
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
      let self = this
      let token = this.$store.state.auth.token
      // let token = 'test'
      const bridge = new WebSocketBridge()
      bridge.connect(
        `/api/v1/instance/activity?token=${token}`,
        null,
        {reconnectInterval: 5000})
      bridge.listen(function (event) {
        logger.default.info('Received timeline update', event)
        self.$store.commit('instance/event', event)
      })
      bridge.socket.addEventListener('open', function () {
        console.log('Connected to WebSocket')
      })
    }
78
  }
79
80
81
82
83
84
85
86
87
}
</script>

<style lang="scss">
// we do the import here instead in main.js
// as resolve order is not deterministric in webpack
// and we end up with CSS rules not applied,
// see https://github.com/webpack/webpack/issues/215
@import 'semantic/semantic.css';
88
@import 'style/vendor/media';
89
90


91
92
html, body {
  @include media("<desktop") {
93
    font-size: 90%;
94
95
  }
}
96
97
98
99
100
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
101
.main.pusher, .footer {
102
103
104
  @include media(">desktop") {
    margin-left: 350px !important;
  }
105
  transform: none !important;
106
107
}
.main-pusher {
108
109
  padding: 1.5rem 0;
}
110
111
112
113
114
.ui.stripe.segment, #footer {
  padding: 2em;
  @include media(">tablet") {
    padding: 4em;
  }
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
}

.ui.small.text.container {
  max-width: 500px !important;
}

.button.icon.tiny {
    padding: 0.5em !important;
}

.sidebar {
  .logo {
    path {
      fill: white;
    }
  }
}

.discrete.link {
    color: rgba(0, 0, 0, 0.87);
}

.floated.buttons .button ~ .dropdown {
  border-left: none;
}
</style>