improve menu

This commit is contained in:
まっちゃとーにゅ 2024-03-07 05:23:50 +09:00
parent b4fc96ca5b
commit e814f3d740
No known key found for this signature in database
GPG key ID: 6AFBBF529601C1DB
3 changed files with 85 additions and 35 deletions

View file

@ -112,9 +112,7 @@ const hide = ref((defaultStore.state.nsfw === 'force' || defaultStore.state.data
const menuShowing = ref(false);
function showMenu(ev: MouseEvent) {
let menu: MenuItem[] = [];
menu = [
const menu: MenuItem[] = [
// TODO:
{
text: i18n.ts.hide,
@ -125,6 +123,12 @@ function showMenu(ev: MouseEvent) {
},
];
if ($i?.id === props.video.userId || iAmModerator) {
menu.push({
type: 'divider',
});
}
if (iAmModerator) {
menu.push({
text: props.video.isSensitive ? i18n.ts.unmarkAsSensitive : i18n.ts.markAsSensitive,
@ -132,12 +136,19 @@ function showMenu(ev: MouseEvent) {
danger: true,
action: () => toggleSensitive(props.video),
});
if ($i?.id !== props.video.userId) {
menu.push({
type: 'link' as const,
text: i18n.ts._fileViewer.title,
icon: 'ti ti-info-circle',
to: `/admin/file/${props.video.id}`,
});
}
}
if ($i?.id === props.video.userId) {
menu.push({
type: 'divider',
}, {
type: 'link' as const,
text: i18n.ts._fileViewer.title,
icon: 'ti ti-info-circle',