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,49 +204,54 @@ 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) => { const menuItems: MenuItem[] = [];
const menuItems: MenuItem[] = [];
menuItems.push({
type: 'switch',
icon: 'ti ti-repeat',
text: i18n.ts.showRenotes,
ref: withRenotes,
});
if (isBasicTimeline(src.value) && hasWithReplies(src.value)) {
menuItems.push({ menuItems.push({
type: 'switch', type: 'switch',
icon: 'ti ti-repeat', icon: 'ti ti-messages',
text: i18n.ts.showRenotes, text: i18n.ts.showRepliesToOthersInTimeline,
ref: withRenotes, ref: withReplies,
disabled: onlyFiles,
}); });
}
if (isBasicTimeline(src.value) && hasWithReplies(src.value)) { menuItems.push({
menuItems.push({ type: 'switch',
type: 'switch', icon: 'ti ti-eye-exclamation',
icon: 'ti ti-messages', text: i18n.ts.withSensitive,
text: i18n.ts.showRepliesToOthersInTimeline, ref: withSensitive,
ref: withReplies, }, {
disabled: onlyFiles, type: 'switch',
}); icon: 'ti ti-photo',
} text: i18n.ts.fileAttachedOnly,
ref: onlyFiles,
disabled: isBasicTimeline(src.value) && hasWithReplies(src.value) ? withReplies : false,
}, {
type: 'divider',
}, {
type: 'switch',
text: i18n.ts.showFixedPostForm,
ref: showFixedPostForm,
});
menuItems.push({ os.popupMenu(menuItems, ev.currentTarget ?? ev.target);
type: 'switch',
icon: 'ti ti-eye-exclamation',
text: i18n.ts.withSensitive,
ref: withSensitive,
}, {
type: 'switch',
icon: 'ti ti-photo',
text: i18n.ts.fileAttachedOnly,
ref: onlyFiles,
disabled: isBasicTimeline(src.value) && hasWithReplies(src.value) ? withReplies : false,
});
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 => ({