Merge pull request '[PR]: Improve the order of note menu items' (#10290) from naskya/calckey:chore/note-menu-order into develop

Reviewed-on: https://codeberg.org/calckey/calckey/pulls/10290
This commit is contained in:
Kainoa Kanter 2023-06-08 17:53:32 +00:00
commit 1186969ee6
3 changed files with 60 additions and 42 deletions

View file

@ -128,7 +128,7 @@
<button
v-else-if="!item.hidden"
class="_button item"
:class="{ danger: item.danger, active: item.active }"
:class="{ danger: item.danger, accent: item.accent, active: item.active }"
:disabled="item.active"
@click="clicked(item.action, $event)"
@mouseenter.passive="onItemMouseEnter(item)"
@ -398,6 +398,26 @@ onBeforeUnmount(() => {
}
}
&.accent {
color: var(--accent);
&:hover {
color: var(--accent);
&:before {
background: var(--accentedBg);
}
}
&:active {
color: var(--fgOnAccent);
&:before {
background: var(--accent);
}
}
}
&.active {
color: var(--fgOnAccent);
opacity: 1;

View file

@ -262,13 +262,6 @@ export function getNoteMenu(props: {
null,
]
: []),
instance.features.postEditing && isAppearAuthor
? {
icon: "ph-pencil-line ph-bold ph-lg",
text: i18n.ts.edit,
action: edit,
}
: undefined,
{
icon: "ph-clipboard-text ph-bold ph-lg",
text: i18n.ts.copyContent,
@ -372,33 +365,45 @@ export function getNoteMenu(props: {
}]
: []
),*/
...(!isAppearAuthor
? [
null,
{
icon: "ph-warning-circle ph-bold ph-lg",
text: i18n.ts.reportAbuse,
action: () => {
const u =
appearNote.url ||
appearNote.uri ||
`${url}/notes/${appearNote.id}`;
os.popup(
defineAsyncComponent(
() => import("@/components/MkAbuseReportWindow.vue"),
),
{
user: appearNote.user,
initialComment: `Note: ${u}\n-----\n`,
},
{},
"closed",
);
},
null,
!isAppearAuthor
? {
icon: "ph-warning-circle ph-bold ph-lg",
text: i18n.ts.reportAbuse,
action: () => {
const u =
appearNote.url ||
appearNote.uri ||
`${url}/notes/${appearNote.id}`;
os.popup(
defineAsyncComponent(
() => import("@/components/MkAbuseReportWindow.vue"),
),
{
user: appearNote.user,
initialComment: `Note: ${u}\n-----\n`,
},
{},
"closed",
);
},
]
: []),
}
: undefined,
instance.features.postEditing && isAppearAuthor
? {
icon: "ph-pencil-line ph-bold ph-lg",
text: i18n.ts.edit,
accent: true,
action: edit,
}
: undefined,
isAppearAuthor
? {
icon: "ph-eraser ph-bold ph-lg",
text: i18n.ts.deleteAndEdit,
action: delEdit,
}
: undefined,
isAppearAuthor || isModerator
? {
icon: "ph-trash ph-bold ph-lg",
@ -407,14 +412,6 @@ export function getNoteMenu(props: {
action: del,
}
: undefined,
isAppearAuthor
? {
icon: "ph-eraser ph-bold ph-lg",
text: i18n.ts.deleteAndEdit,
action: delEdit,
}
: undefined,
].filter((x) => x !== undefined);
} else {
menu = [

View file

@ -51,6 +51,7 @@ export type MenuButton = {
icon?: string;
indicate?: boolean;
danger?: boolean;
accent?: boolean;
active?: boolean;
hidden?: boolean;
avatar?: Misskey.entities.User;