Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve(desktop): improve code for new message notifications #1196

Merged
merged 1 commit into from Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/MessageList.vue
Expand Up @@ -36,7 +36,7 @@ export default class MessageList extends Vue {

public showMessages: MessageModel[] = []
public showLoadingIcon: boolean = false
public loadinSwitch = true
public loadSwitch = true
private scrollOffset: { offset: number; mode: 'before' | 'after' } = {
offset: Number.MAX_SAFE_INTEGER,
mode: 'before',
Expand All @@ -52,7 +52,7 @@ export default class MessageList extends Vue {

@Watch('scrollOffset')
private async handleScrollOffsetChanged(val: MessageList['scrollOffset'], oldVal: MessageList['scrollOffset']) {
if (this.loadinSwitch && this.showLoadingIcon === false && val.offset === 0) {
if (this.loadSwitch && this.showLoadingIcon === false && val.offset === 0) {
this.$emit('loadMoreMsg', val.mode)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/MsgTip.vue
@@ -1,6 +1,6 @@
<template>
<el-button v-if="count > 0" class="primary-btn new-msg-tip" icon="el-icon-bottom" @click="handleClick">
{{ count }} {{ count === 1 ? $t('common.newMsg') : $t('common.newMsgs') }}
{{ $tc('common.newMsg', count, { count }) }}
</el-button>
</template>

Expand Down
17 changes: 5 additions & 12 deletions src/lang/common.ts
Expand Up @@ -259,17 +259,10 @@ export default {
hu: 'Soha ne járjon le',
},
newMsg: {
zh: '条新消息',
en: 'new message',
tr: 'yeni mesaj',
ja: '新しいメッセージ',
hu: 'új üzenet',
},
newMsgs: {
zh: '条新消息',
en: 'new messages',
tr: 'yeni mesajlar',
ja: '新しいメッセージ',
hu: 'új üzenetek',
zh: '{count} 条新消息 | {count} 条新消息',
en: '{count} new message | {count} new messages',
tr: '{count} yeni mesaj | {count} yeni mesaj',
ja: '{count}件の新しいメッセージ | {count}件の新しいメッセージ',
hu: '{count} új üzenet | {count} új üzenet',
},
}
4 changes: 2 additions & 2 deletions src/views/connections/ConnectionsDetail.vue
Expand Up @@ -1093,14 +1093,14 @@ export default class ConnectionsDetail extends Vue {
const msgListRef = this.getMsgListRef()
const msgListDOM = msgListRef?.$el
if (msgListDOM) {
msgListRef.loadinSwitch = false
msgListRef.loadSwitch = false
msgListDOM.scrollTo({
top: msgListDOM.scrollHeight + 160,
left: 0,
behavior: 'smooth',
})
await delay(1000)
msgListRef.loadinSwitch = true
msgListRef.loadSwitch = true
}
}, 100)
})
Expand Down