mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 13:23:09 +02:00
parent
6516bd2ade
commit
4277e53433
6 changed files with 101 additions and 8 deletions
|
@ -37,6 +37,17 @@ common:
|
||||||
reload-to-apply-the-setting: "この設定を反映するにはページをリロードする必要があります。今すぐリロードしますか?"
|
reload-to-apply-the-setting: "この設定を反映するにはページをリロードする必要があります。今すぐリロードしますか?"
|
||||||
fetching-as-ap-object: "連合に照会中"
|
fetching-as-ap-object: "連合に照会中"
|
||||||
unfollow-confirm: "{name}さんをフォロー解除しますか?"
|
unfollow-confirm: "{name}さんをフォロー解除しますか?"
|
||||||
|
notification-type: "通知の種類"
|
||||||
|
notification-types:
|
||||||
|
all: "すべて"
|
||||||
|
pollVote: "投票"
|
||||||
|
follow: "フォロー"
|
||||||
|
receiveFollowRequest: "フォローリクエスト"
|
||||||
|
reply: "返信"
|
||||||
|
quote: "引用"
|
||||||
|
renote: "Renote"
|
||||||
|
mention: "言及"
|
||||||
|
reaction: "リアクション"
|
||||||
|
|
||||||
got-it: "わかった"
|
got-it: "わかった"
|
||||||
customization-tips:
|
customization-tips:
|
||||||
|
|
|
@ -98,7 +98,7 @@ export default Vue.extend({
|
||||||
return {
|
return {
|
||||||
inputValue: this.input && this.input.default ? this.input.default : null,
|
inputValue: this.input && this.input.default ? this.input.default : null,
|
||||||
userInputValue: null,
|
userInputValue: null,
|
||||||
selectedValue: this.select ? this.select.items ? this.select.items[0].value : this.select.groupedItems[0].items[0].value : null,
|
selectedValue: this.select ? this.select.default ? this.select.default : this.select.items ? this.select.items[0].value : this.select.groupedItems[0].items[0].value : null,
|
||||||
canOk: true,
|
canOk: true,
|
||||||
faTimesCircle, faQuestionCircle
|
faTimesCircle, faQuestionCircle
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<x-column :name="name" :column="column" :is-stacked="isStacked">
|
<x-column :name="name" :column="column" :is-stacked="isStacked" :menu="menu">
|
||||||
<template #header><fa :icon="['far', 'bell']"/>{{ name }}</template>
|
<template #header><fa :icon="['far', 'bell']"/>{{ name }}</template>
|
||||||
|
|
||||||
<x-notifications/>
|
<x-notifications :type="column.notificationType === 'all' ? null : column.notificationType"/>
|
||||||
</x-column>
|
</x-column>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -30,11 +30,46 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
menu: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
name(): string {
|
name(): string {
|
||||||
if (this.column.name) return this.column.name;
|
if (this.column.name) return this.column.name;
|
||||||
return this.$t('@deck.notifications');
|
return this.$t('@deck.notifications');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
if (this.column.notificationType == null) {
|
||||||
|
this.column.notificationType = 'all';
|
||||||
|
this.$store.commit('updateDeckColumn', this.column);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.menu = [{
|
||||||
|
icon: 'cog',
|
||||||
|
text: this.$t('@.notification-type'),
|
||||||
|
action: () => {
|
||||||
|
this.$root.dialog({
|
||||||
|
title: this.$t('@.notification-type'),
|
||||||
|
type: null,
|
||||||
|
select: {
|
||||||
|
items: ['all', 'follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest'].map(x => ({
|
||||||
|
value: x, text: this.$t('@.notification-types.' + x)
|
||||||
|
}))
|
||||||
|
default: this.column.notificationType,
|
||||||
|
},
|
||||||
|
showCancelButton: true
|
||||||
|
}).then(({ canceled, result: type }) => {
|
||||||
|
if (canceled) return;
|
||||||
|
this.column.notificationType = type;
|
||||||
|
this.$store.commit('updateDeckColumn', this.column);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -47,12 +47,22 @@ export default Vue.extend({
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
props: {
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
connection: null,
|
connection: null,
|
||||||
pagination: {
|
pagination: {
|
||||||
endpoint: 'i/notifications',
|
endpoint: 'i/notifications',
|
||||||
limit: 20,
|
limit: 20,
|
||||||
|
params: () => ({
|
||||||
|
includeTypes: this.type ? [this.type] : undefined
|
||||||
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -69,6 +79,12 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
type() {
|
||||||
|
this.reload();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.connection = this.$root.stream.useSharedConnection('main');
|
this.connection = this.$root.stream.useSharedConnection('main');
|
||||||
this.connection.on('notification', this.onNotification);
|
this.connection.on('notification', this.onNotification);
|
||||||
|
|
|
@ -153,6 +153,13 @@ export default Vue.extend({
|
||||||
paging({}),
|
paging({}),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
props: {
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
connection: null,
|
connection: null,
|
||||||
|
@ -160,6 +167,9 @@ export default Vue.extend({
|
||||||
pagination: {
|
pagination: {
|
||||||
endpoint: 'i/notifications',
|
endpoint: 'i/notifications',
|
||||||
limit: 10,
|
limit: 10,
|
||||||
|
params: () => ({
|
||||||
|
includeTypes: this.type ? [this.type] : undefined
|
||||||
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -176,6 +186,12 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
type() {
|
||||||
|
this.reload();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.connection = this.$root.stream.useSharedConnection('main');
|
this.connection = this.$root.stream.useSharedConnection('main');
|
||||||
this.connection.on('notification', this.onNotification);
|
this.connection.on('notification', this.onNotification);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mkw-notifications">
|
<div class="mkw-notifications">
|
||||||
<ui-container :show-header="!props.compact">
|
<ui-container :show-header="!props.compact">
|
||||||
<template #header><fa :icon="['far', 'bell']"/>{{ $t('title') }}</template>
|
<template #header><fa :icon="['far', 'bell']"/>{{ props.type === 'all' ? $t('title') : $t('@.notification-types.' + props.type) }}</template>
|
||||||
<!-- <button #func :title="$t('title')" @click="settings"><fa icon="cog"/></button> -->
|
<template #func><button :title="$t('@.notification-type')" @click="settings"><fa icon="cog"/></button></template>
|
||||||
|
|
||||||
<mk-notifications :class="$style.notifications"/>
|
<mk-notifications :class="$style.notifications" :type="props.type === 'all' ? null : props.type"/>
|
||||||
</ui-container>
|
</ui-container>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -16,13 +16,28 @@ import i18n from '../../../i18n';
|
||||||
export default define({
|
export default define({
|
||||||
name: 'notifications',
|
name: 'notifications',
|
||||||
props: () => ({
|
props: () => ({
|
||||||
compact: false
|
compact: false,
|
||||||
|
type: 'all'
|
||||||
})
|
})
|
||||||
}).extend({
|
}).extend({
|
||||||
i18n: i18n('desktop/views/widgets/notifications.vue'),
|
i18n: i18n('desktop/views/widgets/notifications.vue'),
|
||||||
methods: {
|
methods: {
|
||||||
settings() {
|
settings() {
|
||||||
alert('not implemented yet');
|
this.$root.dialog({
|
||||||
|
title: this.$t('@.notification-type'),
|
||||||
|
type: null,
|
||||||
|
select: {
|
||||||
|
items: ['all', 'follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest'].map(x => ({
|
||||||
|
value: x, text: this.$t('@.notification-types.' + x)
|
||||||
|
}))
|
||||||
|
default: this.props.type,
|
||||||
|
},
|
||||||
|
showCancelButton: true
|
||||||
|
}).then(({ canceled, result: type }) => {
|
||||||
|
if (canceled) return;
|
||||||
|
this.props.type = type;
|
||||||
|
this.save();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
func() {
|
func() {
|
||||||
this.props.compact = !this.props.compact;
|
this.props.compact = !this.props.compact;
|
||||||
|
|
Loading…
Reference in a new issue