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 <button
v-else-if="!item.hidden" v-else-if="!item.hidden"
class="_button item" class="_button item"
:class="{ danger: item.danger, active: item.active }" :class="{ danger: item.danger, accent: item.accent, active: item.active }"
:disabled="item.active" :disabled="item.active"
@click="clicked(item.action, $event)" @click="clicked(item.action, $event)"
@mouseenter.passive="onItemMouseEnter(item)" @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 { &.active {
color: var(--fgOnAccent); color: var(--fgOnAccent);
opacity: 1; opacity: 1;

View file

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

View file

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