summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-09-19 14:18:34 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-09-19 14:18:34 +0900
commitd9f0e158a35eec183da77e84a3b038fab645bf62 (patch)
treea7cbad45883ff56d35771d849f95dbd911e3e45c /src/client
parent8.55.0 (diff)
downloadsharkey-d9f0e158a35eec183da77e84a3b038fab645bf62.tar.gz
sharkey-d9f0e158a35eec183da77e84a3b038fab645bf62.tar.bz2
sharkey-d9f0e158a35eec183da77e84a3b038fab645bf62.zip
Implement #2736
Diffstat (limited to 'src/client')
-rw-r--r--src/client/app/common/scripts/streaming/home.ts24
-rw-r--r--src/client/app/desktop/views/components/notes.note.vue8
-rw-r--r--src/client/app/desktop/views/components/timeline.vue11
-rw-r--r--src/client/app/desktop/views/pages/deck/deck.note.vue8
-rw-r--r--src/client/app/mobile/views/components/note.vue8
-rw-r--r--src/client/app/mobile/views/components/ui.header.vue3
-rw-r--r--src/client/app/mobile/views/pages/drive.vue6
-rw-r--r--src/client/app/mobile/views/pages/favorites.vue2
-rw-r--r--src/client/app/mobile/views/pages/games/reversi.vue2
-rw-r--r--src/client/app/mobile/views/pages/home.vue27
-rw-r--r--src/client/app/mobile/views/pages/messaging-room.vue2
-rw-r--r--src/client/app/mobile/views/pages/messaging.vue2
-rw-r--r--src/client/app/mobile/views/pages/note.vue2
-rw-r--r--src/client/app/mobile/views/pages/notifications.vue2
-rw-r--r--src/client/app/mobile/views/pages/settings.vue2
-rw-r--r--src/client/app/mobile/views/pages/tag.vue2
-rw-r--r--src/client/app/mobile/views/pages/widgets.vue2
17 files changed, 87 insertions, 26 deletions
diff --git a/src/client/app/common/scripts/streaming/home.ts b/src/client/app/common/scripts/streaming/home.ts
index dd18c70d70..26729507fb 100644
--- a/src/client/app/common/scripts/streaming/home.ts
+++ b/src/client/app/common/scripts/streaming/home.ts
@@ -50,6 +50,30 @@ export class HomeStream extends Stream {
});
});
+ this.on('unreadMention', () => {
+ os.store.dispatch('mergeMe', {
+ hasUnreadMentions: true
+ });
+ });
+
+ this.on('readAllUnreadMentions', () => {
+ os.store.dispatch('mergeMe', {
+ hasUnreadMentions: false
+ });
+ });
+
+ this.on('unreadSpecifiedNote', () => {
+ os.store.dispatch('mergeMe', {
+ hasUnreadSpecifiedNotes: true
+ });
+ });
+
+ this.on('readAllUnreadSpecifiedNotes', () => {
+ os.store.dispatch('mergeMe', {
+ hasUnreadSpecifiedNotes: false
+ });
+ });
+
this.on('clientSettingUpdated', x => {
os.store.commit('settings/set', {
key: x.key,
diff --git a/src/client/app/desktop/views/components/notes.note.vue b/src/client/app/desktop/views/components/notes.note.vue
index fdf41a52c9..ac2c1ce97f 100644
--- a/src/client/app/desktop/views/components/notes.note.vue
+++ b/src/client/app/desktop/views/components/notes.note.vue
@@ -213,10 +213,14 @@ export default Vue.extend({
methods: {
capture(withHandler = false) {
if (this.$store.getters.isSignedIn) {
- this.connection.send({
+ const data = {
type: 'capture',
id: this.p.id
- });
+ } as any;
+ if ((this.p.visibleUserIds || []).includes(this.$store.state.i.id) || (this.p.mentions || []).includes(this.$store.state.i.id)) {
+ data.read = true;
+ }
+ this.connection.send(data);
if (withHandler) this.connection.on('note-updated', this.onStreamNoteUpdated);
}
},
diff --git a/src/client/app/desktop/views/components/timeline.vue b/src/client/app/desktop/views/components/timeline.vue
index 9f421a68ed..7d683236bb 100644
--- a/src/client/app/desktop/views/components/timeline.vue
+++ b/src/client/app/desktop/views/components/timeline.vue
@@ -8,8 +8,8 @@
<span :data-active="src == 'tag'" @click="src = 'tag'" v-if="tagTl">%fa:hashtag% {{ tagTl.title }}</span>
<span :data-active="src == 'list'" @click="src = 'list'" v-if="list">%fa:list% {{ list.title }}</span>
<div class="buttons">
- <button :data-active="src == 'mentions'" @click="src = 'mentions'" title="%i18n:@mentions%">%fa:at%</button>
- <button :data-active="src == 'messages'" @click="src = 'messages'" title="%i18n:@messages%">%fa:envelope R%</button>
+ <button :data-active="src == 'mentions'" @click="src = 'mentions'" title="%i18n:@mentions%">%fa:at%<i class="badge" v-if="$store.state.i.hasUnreadMentions">%fa:circle%</i></button>
+ <button :data-active="src == 'messages'" @click="src = 'messages'" title="%i18n:@messages%">%fa:envelope R%<i class="badge" v-if="$store.state.i.hasUnreadSpecifiedNotes">%fa:circle%</i></button>
<button @click="chooseTag" title="%i18n:@hashtag%" ref="tagButton">%fa:hashtag%</button>
<button @click="chooseList" title="%i18n:@list%" ref="listButton">%fa:list%</button>
</div>
@@ -202,6 +202,13 @@ root(isDark)
line-height 42px
color isDark ? #9baec8 : #ccc
+ > .badge
+ position absolute
+ top -4px
+ right 4px
+ font-size 10px
+ color $theme-color
+
&:hover
color isDark ? #b2c1d5 : #aaa
diff --git a/src/client/app/desktop/views/pages/deck/deck.note.vue b/src/client/app/desktop/views/pages/deck/deck.note.vue
index 980fb03136..99274b0f41 100644
--- a/src/client/app/desktop/views/pages/deck/deck.note.vue
+++ b/src/client/app/desktop/views/pages/deck/deck.note.vue
@@ -147,10 +147,14 @@ export default Vue.extend({
methods: {
capture(withHandler = false) {
if (this.$store.getters.isSignedIn) {
- this.connection.send({
+ const data = {
type: 'capture',
id: this.p.id
- });
+ } as any;
+ if ((this.p.visibleUserIds || []).includes(this.$store.state.i.id) || (this.p.mentions || []).includes(this.$store.state.i.id)) {
+ data.read = true;
+ }
+ this.connection.send(data);
if (withHandler) this.connection.on('note-updated', this.onStreamNoteUpdated);
}
},
diff --git a/src/client/app/mobile/views/components/note.vue b/src/client/app/mobile/views/components/note.vue
index 8787b39a93..0ce72cab11 100644
--- a/src/client/app/mobile/views/components/note.vue
+++ b/src/client/app/mobile/views/components/note.vue
@@ -160,10 +160,14 @@ export default Vue.extend({
methods: {
capture(withHandler = false) {
if (this.$store.getters.isSignedIn) {
- this.connection.send({
+ const data = {
type: 'capture',
id: this.p.id
- });
+ } as any;
+ if ((this.p.visibleUserIds || []).includes(this.$store.state.i.id) || (this.p.mentions || []).includes(this.$store.state.i.id)) {
+ data.read = true;
+ }
+ this.connection.send(data);
if (withHandler) this.connection.on('note-updated', this.onStreamNoteUpdated);
}
},
diff --git a/src/client/app/mobile/views/components/ui.header.vue b/src/client/app/mobile/views/components/ui.header.vue
index c9b3ab51ae..15c8299c2e 100644
--- a/src/client/app/mobile/views/components/ui.header.vue
+++ b/src/client/app/mobile/views/components/ui.header.vue
@@ -188,9 +188,6 @@ root(isDark)
overflow hidden
text-overflow ellipsis
- [data-fa], [data-icon]
- margin-right 4px
-
> img
display inline-block
vertical-align bottom
diff --git a/src/client/app/mobile/views/pages/drive.vue b/src/client/app/mobile/views/pages/drive.vue
index 27ac956043..c0fc7b48dc 100644
--- a/src/client/app/mobile/views/pages/drive.vue
+++ b/src/client/app/mobile/views/pages/drive.vue
@@ -1,9 +1,9 @@
<template>
<mk-ui>
<span slot="header">
- <template v-if="folder">%fa:R folder-open%{{ folder.name }}</template>
- <template v-if="file"><mk-file-type-icon data-icon :type="file.type"/>{{ file.name }}</template>
- <template v-if="!folder && !file">%fa:cloud%%i18n:@drive%</template>
+ <template v-if="folder"><span style="margin-right:4px;">%fa:R folder-open%</span>{{ folder.name }}</template>
+ <template v-if="file"><mk-file-type-icon data-icon :type="file.type" style="margin-right:4px;"/>{{ file.name }}</template>
+ <template v-if="!folder && !file"><span style="margin-right:4px;">%fa:cloud%</span>%i18n:@drive%</template>
</span>
<template slot="func"><button @click="fn">%fa:ellipsis-h%</button></template>
<mk-drive
diff --git a/src/client/app/mobile/views/pages/favorites.vue b/src/client/app/mobile/views/pages/favorites.vue
index 6b9aec6a0c..53512e804c 100644
--- a/src/client/app/mobile/views/pages/favorites.vue
+++ b/src/client/app/mobile/views/pages/favorites.vue
@@ -1,6 +1,6 @@
<template>
<mk-ui>
- <span slot="header">%fa:star%%i18n:@title%</span>
+ <span slot="header"><span style="margin-right:4px;">%fa:star%</span>%i18n:@title%</span>
<main>
<template v-for="favorite in favorites">
diff --git a/src/client/app/mobile/views/pages/games/reversi.vue b/src/client/app/mobile/views/pages/games/reversi.vue
index bdadc88a43..f3bba586de 100644
--- a/src/client/app/mobile/views/pages/games/reversi.vue
+++ b/src/client/app/mobile/views/pages/games/reversi.vue
@@ -1,6 +1,6 @@
<template>
<mk-ui>
- <span slot="header">%fa:gamepad%%i18n:@reversi%</span>
+ <span slot="header"><span style="margin-right:4px;">%fa:gamepad%</span>%i18n:@reversi%</span>
<mk-reversi :game-id="$route.params.game" @nav="nav" :self-nav="false"/>
</mk-ui>
</template>
diff --git a/src/client/app/mobile/views/pages/home.vue b/src/client/app/mobile/views/pages/home.vue
index 43afc98b45..ca62d4e2f8 100644
--- a/src/client/app/mobile/views/pages/home.vue
+++ b/src/client/app/mobile/views/pages/home.vue
@@ -1,7 +1,7 @@
<template>
<mk-ui>
<span slot="header" @click="showNav = true">
- <span>
+ <span :class="$style.title">
<span v-if="src == 'home'">%fa:home%%i18n:@home%</span>
<span v-if="src == 'local'">%fa:R comments%%i18n:@local%</span>
<span v-if="src == 'hybrid'">%fa:share-alt%%i18n:@hybrid%</span>
@@ -15,6 +15,7 @@
<template v-if="!showNav">%fa:angle-down%</template>
<template v-else>%fa:angle-up%</template>
</span>
+ <i :class="$style.badge" v-if="$store.state.i.hasUnreadMentions || $store.state.i.hasUnreadSpecifiedNotes">%fa:circle%</i>
</span>
<template slot="func">
@@ -32,8 +33,8 @@
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'" v-if="enableLocalTimeline">%fa:share-alt% %i18n:@hybrid%</span>
<span :data-active="src == 'global'" @click="src = 'global'">%fa:globe% %i18n:@global%</span>
<div class="hr"></div>
- <span :data-active="src == 'mentions'" @click="src = 'mentions'">%fa:at% %i18n:@mentions%</span>
- <span :data-active="src == 'messages'" @click="src = 'messages'">%fa:envelope R% %i18n:@messages%</span>
+ <span :data-active="src == 'mentions'" @click="src = 'mentions'">%fa:at% %i18n:@mentions%<i class="badge" v-if="$store.state.i.hasUnreadMentions">%fa:circle%</i></span>
+ <span :data-active="src == 'messages'" @click="src = 'messages'">%fa:envelope R% %i18n:@messages%<i class="badge" v-if="$store.state.i.hasUnreadSpecifiedNotes">%fa:circle%</i></span>
<template v-if="lists">
<div class="hr" v-if="lists.length > 0"></div>
<span v-for="l in lists" :data-active="src == 'list' && list == l" @click="src = 'list'; list = l" :key="l.id">%fa:list% {{ l.title }}</span>
@@ -220,6 +221,11 @@ root(isDark)
&:not([data-active]):hover
background isDark ? #353e4a : #eee
+ > .badge
+ margin-left 6px
+ font-size 10px
+ color $theme-color
+
> .tl
max-width 680px
margin 0 auto
@@ -238,3 +244,18 @@ main:not([data-darkmode])
root(false)
</style>
+
+<style lang="stylus" module>
+@import '~const.styl'
+
+.title
+ i
+ margin-right 4px
+
+.badge
+ margin-left 6px
+ font-size 10px
+ color $theme-color
+ vertical-align middle
+
+</style>
diff --git a/src/client/app/mobile/views/pages/messaging-room.vue b/src/client/app/mobile/views/pages/messaging-room.vue
index 401397d856..750ba26294 100644
--- a/src/client/app/mobile/views/pages/messaging-room.vue
+++ b/src/client/app/mobile/views/pages/messaging-room.vue
@@ -1,7 +1,7 @@
<template>
<mk-ui>
<span slot="header">
- <template v-if="user">%fa:R comments%{{ user | userName }}</template>
+ <template v-if="user"><span style="margin-right:4px;">%fa:R comments%</span>{{ user | userName }}</template>
<template v-else><mk-ellipsis/></template>
</span>
<mk-messaging-room v-if="!fetching" :user="user" :is-naked="true"/>
diff --git a/src/client/app/mobile/views/pages/messaging.vue b/src/client/app/mobile/views/pages/messaging.vue
index 3883505281..98ae79fe6c 100644
--- a/src/client/app/mobile/views/pages/messaging.vue
+++ b/src/client/app/mobile/views/pages/messaging.vue
@@ -1,6 +1,6 @@
<template>
<mk-ui>
- <span slot="header">%fa:R comments%%i18n:@messaging%</span>
+ <span slot="header"><span style="margin-right:4px;">%fa:R comments%</span>%i18n:@messaging%</span>
<mk-messaging @navigate="navigate" :header-top="48"/>
</mk-ui>
</template>
diff --git a/src/client/app/mobile/views/pages/note.vue b/src/client/app/mobile/views/pages/note.vue
index fee60b350e..d7307c79a8 100644
--- a/src/client/app/mobile/views/pages/note.vue
+++ b/src/client/app/mobile/views/pages/note.vue
@@ -1,6 +1,6 @@
<template>
<mk-ui>
- <span slot="header">%fa:R sticky-note%%i18n:@title%</span>
+ <span slot="header"><span style="margin-right:4px;">%fa:R sticky-note%</span>%i18n:@title%</span>
<main v-if="!fetching">
<div>
<mk-note-detail :note="note"/>
diff --git a/src/client/app/mobile/views/pages/notifications.vue b/src/client/app/mobile/views/pages/notifications.vue
index 4d3c8ee534..bddcd457bb 100644
--- a/src/client/app/mobile/views/pages/notifications.vue
+++ b/src/client/app/mobile/views/pages/notifications.vue
@@ -1,6 +1,6 @@
<template>
<mk-ui>
- <span slot="header">%fa:R bell%%i18n:@notifications%</span>
+ <span slot="header"><span style="margin-right:4px;">%fa:R bell%</span>%i18n:@notifications%</span>
<template slot="func"><button @click="fn">%fa:check%</button></template>
<main>
diff --git a/src/client/app/mobile/views/pages/settings.vue b/src/client/app/mobile/views/pages/settings.vue
index f315c058df..9e90416370 100644
--- a/src/client/app/mobile/views/pages/settings.vue
+++ b/src/client/app/mobile/views/pages/settings.vue
@@ -1,6 +1,6 @@
<template>
<mk-ui>
- <span slot="header">%fa:cog%%i18n:@settings%</span>
+ <span slot="header"><span style="margin-right:4px;">%fa:cog%</span>%i18n:@settings%</span>
<main :data-darkmode="$store.state.device.darkmode">
<div class="signin-as" v-html="'%i18n:@signed-in-as%'.replace('{}', `<b>${name}</b>`)"></div>
diff --git a/src/client/app/mobile/views/pages/tag.vue b/src/client/app/mobile/views/pages/tag.vue
index a545e2b839..3f963501e0 100644
--- a/src/client/app/mobile/views/pages/tag.vue
+++ b/src/client/app/mobile/views/pages/tag.vue
@@ -1,6 +1,6 @@
<template>
<mk-ui>
- <span slot="header">%fa:hashtag%{{ $route.params.tag }}</span>
+ <span slot="header"><span style="margin-right:4px;">%fa:hashtag%</span>{{ $route.params.tag }}</span>
<main>
<p v-if="!fetching && empty">%fa:search% {{ '%i18n:no-posts-found%'.split('{}')[0] }}{{ q }}{{ '%i18n:no-posts-found%'.split('{}')[1] }}</p>
diff --git a/src/client/app/mobile/views/pages/widgets.vue b/src/client/app/mobile/views/pages/widgets.vue
index a83103632e..c649529c0e 100644
--- a/src/client/app/mobile/views/pages/widgets.vue
+++ b/src/client/app/mobile/views/pages/widgets.vue
@@ -1,6 +1,6 @@
<template>
<mk-ui>
- <span slot="header">%fa:home%%i18n:@dashboard%</span>
+ <span slot="header"><span style="margin-right:4px;">%fa:home%</span>%i18n:@dashboard%</span>
<template slot="func">
<button @click="customizing = !customizing">%fa:cog%</button>
</template>