@afeefa/vue-app 0.0.350 → 0.0.352

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 0.0.350
1
+ 0.0.352
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.350",
3
+ "version": "0.0.352",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -5,6 +5,10 @@
5
5
  class="impersonationBanner"
6
6
  >
7
7
  Angemeldet als {{ impersonatedAccountTitle }}
8
+ <a
9
+ class="impersonationBanner-exit ml-2"
10
+ @click="$auth.logout()"
11
+ >abmelden</a>
8
12
  </div>
9
13
 
10
14
  <v-overlay
@@ -266,4 +270,11 @@ export default class App extends Vue {
266
270
  white-space: nowrap;
267
271
  }
268
272
 
273
+ .impersonationBanner-exit {
274
+ color: white;
275
+ font-weight: normal;
276
+ text-decoration: underline;
277
+ cursor: pointer;
278
+ }
279
+
269
280
  </style>
@@ -1,21 +1,21 @@
1
1
  <template>
2
2
  <a-badge
3
- color="#EEEEEE"
4
- class="black--text"
3
+ v-if="isVisible"
4
+ :color="color_"
5
+ :class="['black--text', { colored: !!color }]"
5
6
  inline
6
7
  v-bind="$attrs"
7
8
  :content="content"
8
9
  />
9
10
  </template>
10
11
 
11
-
12
12
  <script>
13
13
  import { Component, Vue } from '@a-vue'
14
14
  import { modelCountService } from './ModelCountService'
15
15
  import { SaveEvent } from '@a-vue/events'
16
16
 
17
17
  @Component({
18
- props: ['action', 'field', 'count']
18
+ props: ['action', 'field', 'count', 'color', { hideEmpty: false }]
19
19
  })
20
20
  export default class ModelCount extends Vue {
21
21
  countRequest = null
@@ -32,8 +32,41 @@ export default class ModelCount extends Vue {
32
32
  }
33
33
  }
34
34
 
35
- loadCount () {
36
- this.content = this.countRequest.get(this.field)
35
+ async loadCount () {
36
+ this.content = await this.countRequest.get(this.field)
37
+ }
38
+
39
+ /**
40
+ * hideEmpty: a badge is an attention marker. A permanent zero next to the
41
+ * menu entry is noise that readers learn to skip - and then they miss the one.
42
+ */
43
+ get isVisible () {
44
+ if (!this.hideEmpty) {
45
+ return true
46
+ }
47
+
48
+ return !!Number(this.content)
49
+ }
50
+
51
+ /**
52
+ * color may be a plain string or a function of the loaded count, so a badge
53
+ * can signal "something needs attention" without the caller knowing the
54
+ * number - it is loaded in here.
55
+ */
56
+ get color_ () {
57
+ if (typeof this.color === 'function') {
58
+ return this.color(Number(this.content))
59
+ }
60
+
61
+ return this.color || '#EEEEEE'
37
62
  }
38
63
  }
39
64
  </script>
65
+
66
+ <style scoped lang="scss">
67
+ // ABadge paints the badge text grey, which is unreadable on a saturated
68
+ // background. A caller that picks a color gets light text instead.
69
+ .colored :deep(.v-badge__badge) {
70
+ color: #FFFFFF;
71
+ }
72
+ </style>