proper hot tl

This commit is contained in:
Kainoa Kanter 2023-04-06 20:02:26 -07:00
parent b31dfcd752
commit 00edb30db5
4 changed files with 18 additions and 15 deletions

View File

@ -1,14 +1,14 @@
<template>
<XNotes ref="tlComponent" :no-gap="!$store.state.showGapBetweenNotesInTimeline" :pagination="pagination" @queue="emit('queue', $event)"/>
<XNotes ref="tlComponent" :no-gap="!defaultStore.state.showGapBetweenNotesInTimeline" :pagination="pagination" @queue="emit('queue', $event)"/>
</template>
<script lang="ts" setup>
import { ref, computed, provide, onUnmounted } from 'vue';
import { computed, provide, onUnmounted } from 'vue';
import XNotes from '@/components/MkNotes.vue';
import * as os from '@/os';
import { stream } from '@/stream';
import * as sound from '@/scripts/sound';
import { $i } from '@/account';
import { defaultStore } from '@/store';
const props = defineProps<{
src: string;
@ -89,6 +89,13 @@ if (props.src === 'antenna') {
endpoint = 'notes/global-timeline';
connection = stream.useChannel('globalTimeline');
connection.on('note', prepend);
} else if (props.src === 'featured') {
endpoint = 'notes/featured';
query = {
origin: 'combined',
}
connection = stream.useChannel('main');
connection.on('note', prepend);
} else if (props.src === 'mentions') {
endpoint = 'notes/mentions';
connection = stream.useChannel('main');

View File

@ -41,7 +41,7 @@ const props = defineProps<{
tag?: string;
}>();
const tabs = ['featured', 'users'];
const tabs = ['users', 'featured'];
let tab = $ref(tabs[0]);
watch($$(tab), () => (syncSlide(tabs.indexOf(tab))));

View File

@ -5,7 +5,13 @@
<option v-if="isRecommendedTimelineAvailable" value="recommended">{{ i18n.ts._timelines.recommended }}</option>
<option v-if="isGlobalTimelineAvailable" value="global">{{ i18n.ts._timelines.global }}</option>
</MkTab>
<XNotes v-if="tab === 'hot'" :pagination="hotPagination"/>
<XTimeline
v-if="tab === 'hot'"
ref="tl"
class="tl"
src="hot"
:sound="true"
/>
<XTimeline
v-else-if="tab === 'recommended'"
ref="tl"
@ -24,7 +30,6 @@
</template>
<script lang="ts" setup>
import XNotes from '@/components/MkNotes.vue';
import XTimeline from '@/components/MkTimeline.vue';
import MkTab from '@/components/MkTab.vue';
import { defaultStore } from '@/store';
@ -32,14 +37,6 @@ import { i18n } from '@/i18n';
import { instance } from '@/instance';
import { $i } from '@/account';
const hotPagination = {
endpoint: 'notes/featured' as const,
limit: 20,
params: {
origin: 'combined',
}
}
const tab = $computed({
get: () => defaultStore.reactiveState.discoverTl.value.src,
set: (x) => saveSrc(x),

View File

@ -30,7 +30,6 @@
</template>
<script lang="ts" setup>
// import XNotes from '@/components/MkNotes.vue';
import XTimeline from '@/components/MkTimeline.vue';
import MkTab from '@/components/MkTab.vue';
import { defaultStore } from '@/store';