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> <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> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, provide, onUnmounted } from 'vue'; import { computed, provide, onUnmounted } from 'vue';
import XNotes from '@/components/MkNotes.vue'; import XNotes from '@/components/MkNotes.vue';
import * as os from '@/os';
import { stream } from '@/stream'; import { stream } from '@/stream';
import * as sound from '@/scripts/sound'; import * as sound from '@/scripts/sound';
import { $i } from '@/account'; import { $i } from '@/account';
import { defaultStore } from '@/store';
const props = defineProps<{ const props = defineProps<{
src: string; src: string;
@ -89,6 +89,13 @@ if (props.src === 'antenna') {
endpoint = 'notes/global-timeline'; endpoint = 'notes/global-timeline';
connection = stream.useChannel('globalTimeline'); connection = stream.useChannel('globalTimeline');
connection.on('note', prepend); 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') { } else if (props.src === 'mentions') {
endpoint = 'notes/mentions'; endpoint = 'notes/mentions';
connection = stream.useChannel('main'); connection = stream.useChannel('main');

View File

@ -41,7 +41,7 @@ const props = defineProps<{
tag?: string; tag?: string;
}>(); }>();
const tabs = ['featured', 'users']; const tabs = ['users', 'featured'];
let tab = $ref(tabs[0]); let tab = $ref(tabs[0]);
watch($$(tab), () => (syncSlide(tabs.indexOf(tab)))); 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="isRecommendedTimelineAvailable" value="recommended">{{ i18n.ts._timelines.recommended }}</option>
<option v-if="isGlobalTimelineAvailable" value="global">{{ i18n.ts._timelines.global }}</option> <option v-if="isGlobalTimelineAvailable" value="global">{{ i18n.ts._timelines.global }}</option>
</MkTab> </MkTab>
<XNotes v-if="tab === 'hot'" :pagination="hotPagination"/> <XTimeline
v-if="tab === 'hot'"
ref="tl"
class="tl"
src="hot"
:sound="true"
/>
<XTimeline <XTimeline
v-else-if="tab === 'recommended'" v-else-if="tab === 'recommended'"
ref="tl" ref="tl"
@ -24,7 +30,6 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import XNotes from '@/components/MkNotes.vue';
import XTimeline from '@/components/MkTimeline.vue'; import XTimeline from '@/components/MkTimeline.vue';
import MkTab from '@/components/MkTab.vue'; import MkTab from '@/components/MkTab.vue';
import { defaultStore } from '@/store'; import { defaultStore } from '@/store';
@ -32,14 +37,6 @@ import { i18n } from '@/i18n';
import { instance } from '@/instance'; import { instance } from '@/instance';
import { $i } from '@/account'; import { $i } from '@/account';
const hotPagination = {
endpoint: 'notes/featured' as const,
limit: 20,
params: {
origin: 'combined',
}
}
const tab = $computed({ const tab = $computed({
get: () => defaultStore.reactiveState.discoverTl.value.src, get: () => defaultStore.reactiveState.discoverTl.value.src,
set: (x) => saveSrc(x), set: (x) => saveSrc(x),

View File

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