@@ -30,12 +30,11 @@ SPDX-License-Identifier: AGPL-3.0-only
3030</template >
3131
3232<script lang="ts" setup>
33- import { computed , watch , provide , useTemplateRef , ref , onMounted , onActivated , defineAsyncComponent } from ' vue' ;
33+ import { computed , watch , useTemplateRef , ref , onMounted , onActivated , defineAsyncComponent } from ' vue' ;
3434import type { Tab } from ' @/components/global/MkPageHeader.tabs.vue' ;
3535import type { MenuItem } from ' @/types/menu.js' ;
3636import type { BasicTimelineType } from ' @/timelines.js' ;
3737import MkStreamingNotesTimeline from ' @/components/MkStreamingNotesTimeline.vue' ;
38- import MkInfo from ' @/components/MkInfo.vue' ;
3938const MkPostForm = defineAsyncComponent (() => import (' @/components/MkPostForm.vue' ));
4039import * as os from ' @/os.js' ;
4140import { store } from ' @/store.js' ;
@@ -49,6 +48,7 @@ import { miLocalStorage } from '@/local-storage.js';
4948import { availableBasicTimelines , hasWithReplies , isAvailableBasicTimeline , isBasicTimeline , basicTimelineIconClass } from ' @/timelines.js' ;
5049import { prefer } from ' @/preferences.js' ;
5150import { ui } from ' @@/js/config.js' ;
51+ import { timelineHeaderItemDef } from ' @/timeline-header' ;
5252const XPostForm = defineAsyncComponent (() => import (' @/components/XPostForm.vue' ));
5353
5454const tlComponent = useTemplateRef (' tlComponent' );
@@ -203,6 +203,7 @@ function saveSrc(newSrc: TimelinePageSrc): void {
203203
204204function saveTlFilter(key : keyof typeof store .s .tl .filter , newValue : boolean ) {
205205 if (key !== ' withReplies' || $i ) {
206+ const out = deepMerge ({ filter: { [key ]: newValue } }, store .s .tl );
206207 store .set (' tl' , out );
207208 }
208209}
@@ -284,32 +285,39 @@ const headerActions = computed(() => {
284285 return items ;
285286});
286287
287- const headerTabs = computed (() => [... (prefer .r .pinnedUserLists .value .map (l => ({
288- key: ' list:' + l .id ,
289- title: l .name ,
290- icon: ' ti ti-star' ,
291- iconOnly: true ,
292- }))), ... availableBasicTimelines ().map (tl => ({
293- key: tl ,
294- title: i18n .ts ._timelines [tl ],
295- icon: basicTimelineIconClass (tl ),
296- iconOnly: true ,
297- })), {
298- icon: ' ti ti-list' ,
299- title: i18n .ts .lists ,
300- iconOnly: true ,
301- onClick: chooseList ,
302- }, {
303- icon: ' ti ti-antenna' ,
304- title: i18n .ts .antennas ,
305- iconOnly: true ,
306- onClick: chooseAntenna ,
307- }, {
308- icon: ' ti ti-device-tv' ,
309- title: i18n .ts .channel ,
310- iconOnly: true ,
311- onClick: chooseChannel ,
312- }] as Tab []);
288+ const headerTabs = computed (() => {
289+ const timelineHeaderValue = prefer .s .timelineHeader ;
290+ console .log (prefer .s .timelineHeader );
291+ if (! Array .isArray (timelineHeaderValue )) {
292+ console .error (' timelineHeader is not an array:' , timelineHeaderValue );
293+ return [] as Tab [];
294+ }
295+
296+ return timelineHeaderValue .map (tab => {
297+ const tabDef = timelineHeaderItemDef [tab ];
298+ if (! tabDef ) {
299+ return {};
300+ }
301+
302+ return {
303+ ... (! [' channels' , ' antennas' , ' lists' ].includes (tab ) ? {
304+ key: tab ,
305+ } : {}),
306+ title: tabDef .title ,
307+ icon: tabDef .icon ,
308+ iconOnly: tabDef .iconOnly ,
309+ ... (tab === ' lists' ? {
310+ onClick : (ev ) => chooseList (ev ),
311+ } : {}),
312+ ... (tab === ' antennas' ? {
313+ onClick : (ev ) => chooseAntenna (ev ),
314+ } : {}),
315+ ... (tab === ' channels' ? {
316+ onClick : (ev ) => chooseChannel (ev ),
317+ } : {}),
318+ };
319+ }) as Tab [];
320+ });
313321
314322const headerTabsWhenNotLogin = computed (() => [... availableBasicTimelines ().map (tl => ({
315323 key: tl ,
0 commit comments