enhance(frontend): タイムラインページのメニューから投稿フォームの表示有無を切り替えられるように

This commit is contained in:
syuilo 2025-08-06 14:22:21 +09:00
parent 998beeae59
commit ee9dc94063
1 changed files with 44 additions and 36 deletions

View File

@ -103,6 +103,8 @@ const withSensitive = computed<boolean>({
set: (x) => saveTlFilter('withSensitive', x), set: (x) => saveTlFilter('withSensitive', x),
}); });
const showFixedPostForm = prefer.model('showFixedPostForm');
async function chooseList(ev: MouseEvent): Promise<void> { async function chooseList(ev: MouseEvent): Promise<void> {
const lists = await userListsCache.fetch(); const lists = await userListsCache.fetch();
const items: (MenuItem | undefined)[] = [ const items: (MenuItem | undefined)[] = [
@ -202,8 +204,7 @@ onActivated(() => {
}); });
const headerActions = computed(() => { const headerActions = computed(() => {
const tmp = [ const items = [{
{
icon: 'ti ti-dots', icon: 'ti ti-dots',
text: i18n.ts.options, text: i18n.ts.options,
handler: (ev) => { handler: (ev) => {
@ -237,14 +238,20 @@ const headerActions = computed(() => {
text: i18n.ts.fileAttachedOnly, text: i18n.ts.fileAttachedOnly,
ref: onlyFiles, ref: onlyFiles,
disabled: isBasicTimeline(src.value) && hasWithReplies(src.value) ? withReplies : false, disabled: isBasicTimeline(src.value) && hasWithReplies(src.value) ? withReplies : false,
}, {
type: 'divider',
}, {
type: 'switch',
text: i18n.ts.showFixedPostForm,
ref: showFixedPostForm,
}); });
os.popupMenu(menuItems, ev.currentTarget ?? ev.target); os.popupMenu(menuItems, ev.currentTarget ?? ev.target);
}, },
}, }];
];
if (deviceKind === 'desktop') { if (deviceKind === 'desktop') {
tmp.unshift({ items.unshift({
icon: 'ti ti-refresh', icon: 'ti ti-refresh',
text: i18n.ts.reload, text: i18n.ts.reload,
handler: (ev: Event) => { handler: (ev: Event) => {
@ -252,7 +259,8 @@ const headerActions = computed(() => {
}, },
}); });
} }
return tmp;
return items;
}); });
const headerTabs = computed(() => [...(prefer.r.pinnedUserLists.value.map(l => ({ const headerTabs = computed(() => [...(prefer.r.pinnedUserLists.value.map(l => ({