refactor(frontend): menuのdividerをnullで表現するのをやめる

This commit is contained in:
syuilo 2023-12-12 10:26:37 +09:00
parent ebdb443180
commit b691126bff
17 changed files with 44 additions and 45 deletions

View file

@ -61,7 +61,7 @@ export async function getNoteClipMenu(props: {
},
);
},
})), null, {
})), { type: 'divider' }, {
icon: 'ti ti-plus',
text: i18n.ts.createNew,
action: async () => {
@ -94,7 +94,7 @@ export async function getNoteClipMenu(props: {
}];
}
export function getAbuseNoteMenu(note: misskey.entities.Note, text: string): MenuItem {
export function getAbuseNoteMenu(note: Misskey.entities.Note, text: string): MenuItem {
return {
icon: 'ti ti-exclamation-circle',
text,
@ -108,7 +108,7 @@ export function getAbuseNoteMenu(note: misskey.entities.Note, text: string): Men
};
}
export function getCopyNoteLinkMenu(note: misskey.entities.Note, text: string): MenuItem {
export function getCopyNoteLinkMenu(note: Misskey.entities.Note, text: string): MenuItem {
return {
icon: 'ti ti-link',
text,
@ -264,7 +264,7 @@ export function getNoteMenu(props: {
text: i18n.ts.unclip,
danger: true,
action: unclip,
}, null] : []
}, { type: 'divider' }] : []
), {
icon: 'ti ti-info-circle',
text: i18n.ts.details,
@ -291,7 +291,7 @@ export function getNoteMenu(props: {
text: i18n.ts.translate,
action: translate,
} : undefined,
null,
{ type: 'divider' },
statePromise.then(state => state.isFavorited ? {
icon: 'ti ti-star-off',
text: i18n.ts.unfavorite,
@ -338,7 +338,7 @@ export function getNoteMenu(props: {
},
/*
...($i.isModerator || $i.isAdmin ? [
null,
{ type: 'divider' },
{
icon: 'ti ti-speakerphone',
text: i18n.ts.promote,
@ -347,13 +347,13 @@ export function getNoteMenu(props: {
: []
),*/
...(appearNote.userId !== $i.id ? [
null,
{ type: 'divider' },
appearNote.userId !== $i.id ? getAbuseNoteMenu(appearNote, i18n.ts.reportAbuse) : undefined,
]
: []
),
...(appearNote.userId === $i.id || $i.isModerator || $i.isAdmin ? [
null,
{ type: 'divider' },
appearNote.userId === $i.id ? {
icon: 'ti ti-edit',
text: i18n.ts.deleteAndEdit,
@ -528,10 +528,9 @@ export function getRenoteMenu(props: {
}]);
}
// nullを挟むことで区切り線を出せる
const renoteItems = [
...normalRenoteItems,
...(channelRenoteItems.length > 0 && normalRenoteItems.length > 0) ? [null] : [],
...(channelRenoteItems.length > 0 && normalRenoteItems.length > 0) ? [{ type: 'divider' }] : [],
...channelRenoteItems,
];