pnpm format
This commit is contained in:
parent
cd3cfe4203
commit
282f07dd72
|
@ -606,8 +606,7 @@ export default async (
|
|||
});
|
||||
|
||||
async function renderNoteOrRenoteActivity(data: Option, note: Note) {
|
||||
if (data.localOnly ||
|
||||
note.visibility !== "hidden") return null;
|
||||
if (data.localOnly || note.visibility !== "hidden") return null;
|
||||
|
||||
const content =
|
||||
data.renote &&
|
||||
|
|
|
@ -144,10 +144,7 @@ export default async (
|
|||
});
|
||||
|
||||
//#region deliver
|
||||
if (
|
||||
Users.isLocalUser(user) &&
|
||||
!note.localOnly
|
||||
) {
|
||||
if (Users.isLocalUser(user) && !note.localOnly) {
|
||||
const content = renderActivity(await renderLike(record, note));
|
||||
const dm = new DeliverManager(user, content);
|
||||
if (note.userHost !== null) {
|
||||
|
|
|
@ -13,7 +13,12 @@
|
|||
>
|
||||
<template v-for="(item, i) in items2">
|
||||
<div v-if="item === null" class="divider"></div>
|
||||
<template v-else-if="item.hidden || item.visible !== undefined && !item.visible" />
|
||||
<template
|
||||
v-else-if="
|
||||
item.hidden ||
|
||||
(item.visible !== undefined && !item.visible)
|
||||
"
|
||||
/>
|
||||
<span v-else-if="item.type === 'label'" class="label item">
|
||||
<span :style="item.textStyle || ''">{{
|
||||
item.text
|
||||
|
@ -79,7 +84,10 @@
|
|||
<button
|
||||
v-else-if="item.type === 'user'"
|
||||
class="_button item"
|
||||
:class="{ active: item.active, ...classMap(item.classes) }"
|
||||
:class="{
|
||||
active: item.active,
|
||||
...classMap(item.classes),
|
||||
}"
|
||||
:disabled="item.active"
|
||||
@click="clicked(item.action, $event)"
|
||||
@mouseenter.passive="onItemMouseEnter(item)"
|
||||
|
@ -128,7 +136,10 @@
|
|||
<button
|
||||
v-else-if="item.type === 'parent'"
|
||||
class="_button item parent"
|
||||
:class="{ childShowing: childShowingItem === item, ...classMap(item.classes) }"
|
||||
:class="{
|
||||
childShowing: childShowingItem === item,
|
||||
...classMap(item.classes),
|
||||
}"
|
||||
@mouseenter="showChildren(item, $event)"
|
||||
@click="showChildren(item, $event)"
|
||||
>
|
||||
|
@ -149,7 +160,11 @@
|
|||
<button
|
||||
v-else
|
||||
class="_button item"
|
||||
:class="{ danger: item.danger, active: item.active, ...classMap(item.classes) }"
|
||||
:class="{
|
||||
danger: item.danger,
|
||||
active: item.active,
|
||||
...classMap(item.classes),
|
||||
}"
|
||||
:disabled="item.active"
|
||||
@click="clicked(item.action, $event)"
|
||||
@mouseenter.passive="onItemMouseEnter(item)"
|
||||
|
@ -208,7 +223,13 @@ import {
|
|||
import { focusPrev, focusNext } from "@/scripts/focus";
|
||||
import FormSwitch from "@/components/form/switch.vue";
|
||||
import FormInput from "@/components/form/input.vue";
|
||||
import { MenuItem, InnerMenuItem, MenuPending, MenuAction, MenuClasses } from "@/types/menu";
|
||||
import {
|
||||
MenuItem,
|
||||
InnerMenuItem,
|
||||
MenuPending,
|
||||
MenuAction,
|
||||
MenuClasses,
|
||||
} from "@/types/menu";
|
||||
import * as os from "@/os";
|
||||
import { i18n } from "@/i18n";
|
||||
import { FocusTrap } from "focus-trap-vue";
|
||||
|
@ -269,14 +290,13 @@ let childTarget = $ref<HTMLElement | null>();
|
|||
function classMap(classes?: MenuClasses) {
|
||||
if (!classes) return {};
|
||||
|
||||
return (
|
||||
Array.isArray(classes)
|
||||
? classes
|
||||
: classes.value
|
||||
).reduce((acc, cls) => {
|
||||
return (Array.isArray(classes) ? classes : classes.value).reduce(
|
||||
(acc, cls) => {
|
||||
acc[cls] = true;
|
||||
return acc;
|
||||
}, {});
|
||||
},
|
||||
{}
|
||||
);
|
||||
}
|
||||
|
||||
function closeChild() {
|
||||
|
|
|
@ -49,14 +49,13 @@ let modal = $ref<InstanceType<typeof MkModal>>();
|
|||
function classMap(classes?: MenuClasses) {
|
||||
if (!classes) return {};
|
||||
|
||||
return (
|
||||
Array.isArray(classes)
|
||||
? classes
|
||||
: classes.value
|
||||
).reduce((acc, cls) => {
|
||||
return (Array.isArray(classes) ? classes : classes.value).reduce(
|
||||
(acc, cls) => {
|
||||
acc[cls] = true;
|
||||
return acc;
|
||||
}, {});
|
||||
},
|
||||
{}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ const cwInput = ref<string>(props.renoteCw ?? "");
|
|||
|
||||
const canRenote = computed(
|
||||
() =>
|
||||
["public", "home","hidden"].includes(props.note.visibility) ||
|
||||
["public", "home", "hidden"].includes(props.note.visibility) ||
|
||||
props.note.userId === $i.id
|
||||
);
|
||||
|
||||
|
@ -83,7 +83,10 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => {
|
|||
|
||||
let buttonActions: Array<MenuItem> = [];
|
||||
|
||||
if (props.note.visibility === "public" || props.note.visibility === "hidden") {
|
||||
if (
|
||||
props.note.visibility === "public" ||
|
||||
props.note.visibility === "hidden"
|
||||
) {
|
||||
buttonActions.push({
|
||||
text: i18n.ts.renote,
|
||||
textStyle: "font-weight: bold",
|
||||
|
@ -111,7 +114,7 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => {
|
|||
});
|
||||
}
|
||||
|
||||
if (["public", "home","hidden"].includes(props.note.visibility)) {
|
||||
if (["public", "home", "hidden"].includes(props.note.visibility)) {
|
||||
buttonActions.push({
|
||||
text: `${i18n.ts.renote} (${i18n.ts._visibility.home})`,
|
||||
icon: "ph-house ph-bold ph-lg",
|
||||
|
@ -198,6 +201,7 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => {
|
|||
type: "switch",
|
||||
ref: addCw,
|
||||
text: "Add content warning",
|
||||
hidden: addCw,
|
||||
});
|
||||
|
||||
buttonActions.push({
|
||||
|
|
|
@ -97,7 +97,11 @@
|
|||
<div v-if="appearNote.files.length > 0" class="files">
|
||||
<XMediaList :media-list="appearNote.files" />
|
||||
</div>
|
||||
<XPoll v-if="appearNote.poll" :note="appearNote" class="poll" />
|
||||
<XPoll
|
||||
v-if="appearNote.poll"
|
||||
:note="appearNote"
|
||||
class="poll"
|
||||
/>
|
||||
<template v-if="detailed">
|
||||
<MkUrlPreview
|
||||
v-for="url in urls"
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
// TODO: なんでもかんでもos.tsに突っ込むのやめたいのでよしなに分割する
|
||||
|
||||
import { Component, markRaw, Ref, ref, defineAsyncComponent, ComputedRef } from "vue";
|
||||
import {
|
||||
Component,
|
||||
markRaw,
|
||||
Ref,
|
||||
ref,
|
||||
defineAsyncComponent,
|
||||
ComputedRef,
|
||||
} from "vue";
|
||||
import { EventEmitter } from "eventemitter3";
|
||||
import insertTextAtCursor from "insert-text-at-cursor";
|
||||
import * as Misskey from "calckey-js";
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
import * as Misskey from "calckey-js";
|
||||
import { ComputedRef, Ref } from "vue";
|
||||
|
||||
export type MenuClasses = Array<string> | Ref<Array<string>> | ComputedRef<Array<string>>;
|
||||
export type MenuClasses =
|
||||
| Array<string>
|
||||
| Ref<Array<string>>
|
||||
| ComputedRef<Array<string>>;
|
||||
export type MenuBase = {
|
||||
classes?: MenuClasses;
|
||||
hidden?: boolean | Ref<boolean>;
|
||||
visible?: boolean | Ref<boolean>;
|
||||
}
|
||||
};
|
||||
|
||||
export type MenuAction = (ev: MouseEvent) => void;
|
||||
|
||||
|
|
Loading…
Reference in New Issue