Merge branch 'develop' of https://github.com/misskey-dev/misskey into develop
This commit is contained in:
commit
73de9be6d5
@ -46,8 +46,10 @@ const keymap = {
|
|||||||
const tlComponent = $ref<InstanceType<typeof XTimeline>>();
|
const tlComponent = $ref<InstanceType<typeof XTimeline>>();
|
||||||
const rootEl = $ref<HTMLElement>();
|
const rootEl = $ref<HTMLElement>();
|
||||||
|
|
||||||
let src = $ref<'home' | 'local' | 'social' | 'global'>(defaultStore.state.tl.src);
|
|
||||||
let queue = $ref(0);
|
let queue = $ref(0);
|
||||||
|
const src = $computed(() => defaultStore.reactiveState.tl.value.src);
|
||||||
|
|
||||||
|
watch ($$(src), () => queue = 0);
|
||||||
|
|
||||||
function queueUpdated(q: number): void {
|
function queueUpdated(q: number): void {
|
||||||
queue = q;
|
queue = q;
|
||||||
@ -60,7 +62,7 @@ function top(): void {
|
|||||||
async function chooseList(ev: MouseEvent): Promise<void> {
|
async function chooseList(ev: MouseEvent): Promise<void> {
|
||||||
const lists = await os.api('users/lists/list');
|
const lists = await os.api('users/lists/list');
|
||||||
const items = lists.map(list => ({
|
const items = lists.map(list => ({
|
||||||
type: 'link',
|
type: 'link' as const,
|
||||||
text: list.name,
|
text: list.name,
|
||||||
to: `/timeline/list/${list.id}`,
|
to: `/timeline/list/${list.id}`,
|
||||||
}));
|
}));
|
||||||
@ -70,7 +72,7 @@ async function chooseList(ev: MouseEvent): Promise<void> {
|
|||||||
async function chooseAntenna(ev: MouseEvent): Promise<void> {
|
async function chooseAntenna(ev: MouseEvent): Promise<void> {
|
||||||
const antennas = await os.api('antennas/list');
|
const antennas = await os.api('antennas/list');
|
||||||
const items = antennas.map(antenna => ({
|
const items = antennas.map(antenna => ({
|
||||||
type: 'link',
|
type: 'link' as const,
|
||||||
text: antenna.name,
|
text: antenna.name,
|
||||||
indicate: antenna.hasUnreadNote,
|
indicate: antenna.hasUnreadNote,
|
||||||
to: `/timeline/antenna/${antenna.id}`,
|
to: `/timeline/antenna/${antenna.id}`,
|
||||||
@ -81,7 +83,7 @@ async function chooseAntenna(ev: MouseEvent): Promise<void> {
|
|||||||
async function chooseChannel(ev: MouseEvent): Promise<void> {
|
async function chooseChannel(ev: MouseEvent): Promise<void> {
|
||||||
const channels = await os.api('channels/followed');
|
const channels = await os.api('channels/followed');
|
||||||
const items = channels.map(channel => ({
|
const items = channels.map(channel => ({
|
||||||
type: 'link',
|
type: 'link' as const,
|
||||||
text: channel.name,
|
text: channel.name,
|
||||||
indicate: channel.hasUnreadNote,
|
indicate: channel.hasUnreadNote,
|
||||||
to: `/channels/${channel.id}`,
|
to: `/channels/${channel.id}`,
|
||||||
@ -89,9 +91,10 @@ async function chooseChannel(ev: MouseEvent): Promise<void> {
|
|||||||
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSrc(): void {
|
function saveSrc(newSrc: 'home' | 'local' | 'social' | 'global'): void {
|
||||||
defaultStore.set('tl', {
|
defaultStore.set('tl', {
|
||||||
src: src,
|
...defaultStore.state.tl,
|
||||||
|
src: newSrc,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,25 +138,25 @@ defineExpose({
|
|||||||
title: i18n.ts._timelines.home,
|
title: i18n.ts._timelines.home,
|
||||||
icon: 'fas fa-home',
|
icon: 'fas fa-home',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
onClick: () => { src = 'home'; saveSrc(); },
|
onClick: () => { saveSrc('home'); },
|
||||||
}, ...(isLocalTimelineAvailable ? [{
|
}, ...(isLocalTimelineAvailable ? [{
|
||||||
active: src === 'local',
|
active: src === 'local',
|
||||||
title: i18n.ts._timelines.local,
|
title: i18n.ts._timelines.local,
|
||||||
icon: 'fas fa-comments',
|
icon: 'fas fa-comments',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
onClick: () => { src = 'local'; saveSrc(); },
|
onClick: () => { saveSrc('local'); },
|
||||||
}, {
|
}, {
|
||||||
active: src === 'social',
|
active: src === 'social',
|
||||||
title: i18n.ts._timelines.social,
|
title: i18n.ts._timelines.social,
|
||||||
icon: 'fas fa-share-alt',
|
icon: 'fas fa-share-alt',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
onClick: () => { src = 'social'; saveSrc(); },
|
onClick: () => { saveSrc('social'); },
|
||||||
}] : []), ...(isGlobalTimelineAvailable ? [{
|
}] : []), ...(isGlobalTimelineAvailable ? [{
|
||||||
active: src === 'global',
|
active: src === 'global',
|
||||||
title: i18n.ts._timelines.global,
|
title: i18n.ts._timelines.global,
|
||||||
icon: 'fas fa-globe',
|
icon: 'fas fa-globe',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
onClick: () => { src = 'global'; saveSrc(); },
|
onClick: () => { saveSrc('global'); },
|
||||||
}] : [])],
|
}] : [])],
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user