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