mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-25 00:49:17 +09:00
Refactyor
This commit is contained in:
parent
c6353f3502
commit
1b2200ccf4
@ -2,7 +2,7 @@
|
|||||||
<x-column :name="name" :column="column" :is-stacked="isStacked">
|
<x-column :name="name" :column="column" :is-stacked="isStacked">
|
||||||
<template #header><fa :icon="['far', 'envelope']"/>{{ name }}</template>
|
<template #header><fa :icon="['far', 'envelope']"/>{{ name }}</template>
|
||||||
|
|
||||||
<x-direct/>
|
<x-notes ref="timeline" :pagination="pagination" @inited="() => $emit('loaded')"/>
|
||||||
</x-column>
|
</x-column>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -10,13 +10,14 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import i18n from '../../../i18n';
|
import i18n from '../../../i18n';
|
||||||
import XColumn from './deck.column.vue';
|
import XColumn from './deck.column.vue';
|
||||||
import XDirect from './deck.direct.vue';
|
import XNotes from './deck.notes.vue';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
i18n: i18n(),
|
i18n: i18n(),
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
XColumn,
|
XColumn,
|
||||||
XDirect
|
XNotes
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
@ -30,6 +31,22 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
connection: null,
|
||||||
|
pagination: {
|
||||||
|
endpoint: 'notes/mentions',
|
||||||
|
limit: 10,
|
||||||
|
params: {
|
||||||
|
includeMyRenotes: this.$store.state.settings.showMyRenotes,
|
||||||
|
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
|
||||||
|
includeLocalRenotes: this.$store.state.settings.showLocalRenotes,
|
||||||
|
visibility: 'specified'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
name(): string {
|
name(): string {
|
||||||
if (this.column.name) return this.column.name;
|
if (this.column.name) return this.column.name;
|
||||||
@ -37,9 +54,25 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.connection = this.$root.stream.useSharedConnection('main');
|
||||||
|
this.connection.on('mention', this.onNote);
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
this.connection.dispose();
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
onNote(note) {
|
||||||
|
// Prepend a note
|
||||||
|
if (note.visibility == 'specified') {
|
||||||
|
(this.$refs.timeline as any).prepend(note);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
focus() {
|
focus() {
|
||||||
this.$refs.tl.focus();
|
this.$refs.timeline.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
<template>
|
|
||||||
<x-notes ref="timeline" :pagination="pagination" @inited="() => $emit('loaded')"/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import Vue from 'vue';
|
|
||||||
import XNotes from './deck.notes.vue';
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
components: {
|
|
||||||
XNotes
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
connection: null,
|
|
||||||
pagination: {
|
|
||||||
endpoint: 'notes/mentions',
|
|
||||||
limit: 10,
|
|
||||||
params: {
|
|
||||||
includeMyRenotes: this.$store.state.settings.showMyRenotes,
|
|
||||||
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
|
|
||||||
includeLocalRenotes: this.$store.state.settings.showLocalRenotes,
|
|
||||||
visibility: 'specified'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted() {
|
|
||||||
this.connection = this.$root.stream.useSharedConnection('main');
|
|
||||||
this.connection.on('mention', this.onNote);
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeDestroy() {
|
|
||||||
this.connection.dispose();
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
onNote(note) {
|
|
||||||
// Prepend a note
|
|
||||||
if (note.visibility == 'specified') {
|
|
||||||
(this.$refs.timeline as any).prepend(note);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
focus() {
|
|
||||||
this.$refs.timeline.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
@ -2,7 +2,7 @@
|
|||||||
<x-column :name="name" :column="column" :is-stacked="isStacked">
|
<x-column :name="name" :column="column" :is-stacked="isStacked">
|
||||||
<template #header><fa icon="at"/>{{ name }}</template>
|
<template #header><fa icon="at"/>{{ name }}</template>
|
||||||
|
|
||||||
<x-mentions ref="tl"/>
|
<x-notes ref="timeline" :pagination="pagination" @inited="() => $emit('loaded')"/>
|
||||||
</x-column>
|
</x-column>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -10,13 +10,14 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import i18n from '../../../i18n';
|
import i18n from '../../../i18n';
|
||||||
import XColumn from './deck.column.vue';
|
import XColumn from './deck.column.vue';
|
||||||
import XMentions from './deck.mentions.vue';
|
import XNotes from './deck.notes.vue';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
i18n: i18n(),
|
i18n: i18n(),
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
XColumn,
|
XColumn,
|
||||||
XMentions
|
XNotes
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
@ -30,6 +31,22 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
connection: null,
|
||||||
|
pagination: {
|
||||||
|
endpoint: 'notes/mentions',
|
||||||
|
limit: 10,
|
||||||
|
params: init => ({
|
||||||
|
untilDate: init ? undefined : (this.date ? this.date.getTime() : undefined),
|
||||||
|
includeMyRenotes: this.$store.state.settings.showMyRenotes,
|
||||||
|
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
|
||||||
|
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
name(): string {
|
name(): string {
|
||||||
if (this.column.name) return this.column.name;
|
if (this.column.name) return this.column.name;
|
||||||
@ -37,9 +54,22 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.connection = this.$root.stream.useSharedConnection('main');
|
||||||
|
this.connection.on('mention', this.onNote);
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
this.connection.dispose();
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
onNote(note) {
|
||||||
|
(this.$refs.timeline as any).prepend(note);
|
||||||
|
},
|
||||||
|
|
||||||
focus() {
|
focus() {
|
||||||
this.$refs.tl.focus();
|
this.$refs.timeline.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
<template>
|
|
||||||
<x-notes ref="timeline" :pagination="pagination" @inited="() => $emit('loaded')"/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import Vue from 'vue';
|
|
||||||
import XNotes from './deck.notes.vue';
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
components: {
|
|
||||||
XNotes
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
connection: null,
|
|
||||||
pagination: {
|
|
||||||
endpoint: 'notes/mentions',
|
|
||||||
limit: 10,
|
|
||||||
params: init => ({
|
|
||||||
untilDate: init ? undefined : (this.date ? this.date.getTime() : undefined),
|
|
||||||
includeMyRenotes: this.$store.state.settings.showMyRenotes,
|
|
||||||
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
|
|
||||||
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
|
|
||||||
})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted() {
|
|
||||||
this.connection = this.$root.stream.useSharedConnection('main');
|
|
||||||
this.connection.on('mention', this.onNote);
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeDestroy() {
|
|
||||||
this.connection.dispose();
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
onNote(note) {
|
|
||||||
(this.$refs.timeline as any).prepend(note);
|
|
||||||
},
|
|
||||||
|
|
||||||
focus() {
|
|
||||||
this.$refs.timeline.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
Loading…
Reference in New Issue
Block a user