2023-12-02 13:09:25 +01:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
|
|
|
<template>
|
2024-02-04 13:20:11 +01:00
|
|
|
<div v-show="!isDeleted" v-if="!muted" ref="el" :class="[$style.root, { [$style.children]: depth > 1, [$style.isReply]: props.isReply, [$style.detailed]: props.detailed }]">
|
2023-12-02 13:09:25 +01:00
|
|
|
<div v-if="!hideLine" :class="$style.line"></div>
|
|
|
|
<div :class="$style.main">
|
|
|
|
<div v-if="note.channel" :class="$style.colorBar" :style="{ background: note.channel.color }"></div>
|
2023-12-02 20:28:22 +01:00
|
|
|
<!-- new avatar container with line (post section) -->
|
|
|
|
<div :class="$style.avatarContainer">
|
|
|
|
<MkAvatar :class="$style.avatar" :user="note.user" link preview/>
|
2023-12-31 18:41:29 +01:00
|
|
|
<template v-if="note.repliesCount > 0 && replies.length > 0">
|
2023-12-02 20:28:22 +01:00
|
|
|
<div v-if="hideLine" :class="$style.threadLine"></div>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
<!-- end new avatar container -->
|
2023-12-02 13:09:25 +01:00
|
|
|
<div :class="$style.body">
|
|
|
|
<SkNoteHeader :class="$style.header" :note="note" :classic="true" :mini="true"/>
|
|
|
|
<div :class="$style.content">
|
|
|
|
<p v-if="note.cw != null" :class="$style.cw">
|
2024-06-07 12:01:49 +02:00
|
|
|
<Mfm v-if="note.cw != ''" style="margin-right: 8px;" :text="note.cw" :isBlock="true" :author="note.user" :nyaize="'respect'"/>
|
2023-12-23 02:09:23 +01:00
|
|
|
<MkCwButton v-model="showContent" :text="note.text" :files="note.files" :poll="note.poll"/>
|
2023-12-02 13:09:25 +01:00
|
|
|
</p>
|
|
|
|
<div v-show="note.cw == null || showContent">
|
2024-02-03 12:55:20 +01:00
|
|
|
<MkSubNoteContent :class="$style.text" :note="note" :translating="translating" :translation="translation" :expandAllCws="props.expandAllCws"/>
|
2023-12-02 13:09:25 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-01-06 17:28:38 +01:00
|
|
|
<MkReactionsViewer ref="reactionsViewer" :note="note"/>
|
2023-12-02 13:09:25 +01:00
|
|
|
<footer :class="$style.footer">
|
|
|
|
<button class="_button" :class="$style.noteFooterButton" @click="reply()">
|
|
|
|
<i class="ph-arrow-u-up-left ph-bold ph-lg"></i>
|
|
|
|
<p v-if="note.repliesCount > 0" :class="$style.noteFooterButtonCount">{{ note.repliesCount }}</p>
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
v-if="canRenote"
|
|
|
|
ref="renoteButton"
|
|
|
|
class="_button"
|
|
|
|
:class="$style.noteFooterButton"
|
|
|
|
:style="renoted ? 'color: var(--accent) !important;' : ''"
|
2023-12-04 00:19:34 +01:00
|
|
|
@mousedown="renoted ? undoRenote() : boostVisibility()"
|
2023-12-02 13:09:25 +01:00
|
|
|
>
|
|
|
|
<i class="ph-rocket-launch ph-bold ph-lg"></i>
|
|
|
|
<p v-if="note.renoteCount > 0" :class="$style.noteFooterButtonCount">{{ note.renoteCount }}</p>
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
v-if="canRenote"
|
|
|
|
ref="quoteButton"
|
|
|
|
class="_button"
|
|
|
|
:class="$style.noteFooterButton"
|
|
|
|
@mousedown="quote()"
|
|
|
|
>
|
|
|
|
<i class="ph-quotes ph-bold ph-lg"></i>
|
|
|
|
</button>
|
|
|
|
<button v-else class="_button" :class="$style.noteFooterButton" disabled>
|
|
|
|
<i class="ph-prohibit ph-bold ph-lg"></i>
|
|
|
|
</button>
|
|
|
|
<button v-if="note.myReaction == null && note.reactionAcceptance !== 'likeOnly'" ref="likeButton" :class="$style.noteFooterButton" class="_button" @mousedown="like()">
|
|
|
|
<i class="ph-heart ph-bold ph-lg"></i>
|
|
|
|
</button>
|
|
|
|
<button v-if="note.myReaction == null" ref="reactButton" :class="$style.noteFooterButton" class="_button" @mousedown="react()">
|
|
|
|
<i v-if="note.reactionAcceptance === 'likeOnly'" class="ph-heart ph-bold ph-lg"></i>
|
|
|
|
<i v-else class="ph-smiley ph-bold ph-lg"></i>
|
|
|
|
</button>
|
|
|
|
<button v-if="note.myReaction != null" ref="reactButton" class="_button" :class="[$style.noteFooterButton, $style.reacted]" @click="undoReact(note)">
|
|
|
|
<i class="ph-minus ph-bold ph-lg"></i>
|
|
|
|
</button>
|
|
|
|
<button ref="menuButton" class="_button" :class="$style.noteFooterButton" @mousedown="menu()">
|
|
|
|
<i class="ph-dots-three ph-bold ph-lg"></i>
|
|
|
|
</button>
|
|
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-12-07 14:54:31 +01:00
|
|
|
<template v-if="depth < numberOfReplies">
|
2024-02-04 13:20:11 +01:00
|
|
|
<SkNoteSub v-for="reply in replies" :key="reply.id" :note="reply" :class="[$style.reply, { [$style.single]: replies.length === 1 }]" :detail="true" :depth="depth + 1" :expandAllCws="props.expandAllCws" :onDeleteCallback="removeReply" :isReply="props.isReply"/>
|
2023-12-02 13:09:25 +01:00
|
|
|
</template>
|
|
|
|
<div v-else :class="$style.more">
|
|
|
|
<MkA class="_link" :to="notePage(note)">{{ i18n.ts.continueThread }} <i class="ph-caret-double-right ph-bold ph-lg"></i></MkA>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div v-else :class="$style.muted" @click="muted = false">
|
|
|
|
<I18n :src="i18n.ts.userSaysSomething" tag="small">
|
|
|
|
<template #name>
|
|
|
|
<MkA v-user-preview="note.userId" :to="userPage(note.user)">
|
|
|
|
<MkUserName :user="note.user"/>
|
|
|
|
</MkA>
|
|
|
|
</template>
|
|
|
|
</I18n>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed, ref, shallowRef, watch } from 'vue';
|
|
|
|
import * as Misskey from 'misskey-js';
|
|
|
|
import SkNoteHeader from '@/components/SkNoteHeader.vue';
|
|
|
|
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
|
|
|
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
|
|
|
|
import MkCwButton from '@/components/MkCwButton.vue';
|
|
|
|
import { notePage } from '@/filters/note.js';
|
|
|
|
import * as os from '@/os.js';
|
2024-01-09 02:57:57 +01:00
|
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
2024-01-02 12:32:49 +01:00
|
|
|
import * as sound from '@/scripts/sound.js';
|
2023-12-02 13:09:25 +01:00
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { $i } from '@/account.js';
|
2023-12-23 02:09:23 +01:00
|
|
|
import { userPage } from '@/filters/user.js';
|
|
|
|
import { checkWordMute } from '@/scripts/check-word-mute.js';
|
|
|
|
import { defaultStore } from '@/store.js';
|
2023-12-02 13:09:25 +01:00
|
|
|
import { pleaseLogin } from '@/scripts/please-login.js';
|
|
|
|
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
|
|
|
|
import MkRippleEffect from '@/components/MkRippleEffect.vue';
|
|
|
|
import { reactionPicker } from '@/scripts/reaction-picker.js';
|
|
|
|
import { claimAchievement } from '@/scripts/achievements.js';
|
|
|
|
import { getNoteMenu } from '@/scripts/get-note-menu.js';
|
|
|
|
import { useNoteCapture } from '@/scripts/use-note-capture.js';
|
2024-02-16 13:24:35 +01:00
|
|
|
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
|
2023-12-02 13:09:25 +01:00
|
|
|
|
|
|
|
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
|
|
|
|
const hideLine = computed(() => { return props.detail ? true : false; });
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<{
|
|
|
|
note: Misskey.entities.Note;
|
|
|
|
detail?: boolean;
|
|
|
|
expandAllCws?: boolean;
|
2023-12-21 17:00:59 +01:00
|
|
|
onDeleteCallback?: (id: Misskey.entities.Note['id']) => void;
|
2023-12-02 13:09:25 +01:00
|
|
|
|
|
|
|
// how many notes are in between this one and the note being viewed in detail
|
|
|
|
depth?: number;
|
2024-01-28 16:20:59 +01:00
|
|
|
|
2024-02-04 13:20:11 +01:00
|
|
|
isReply?: boolean;
|
2024-02-03 13:22:12 +01:00
|
|
|
detailed?: boolean;
|
2023-12-02 13:09:25 +01:00
|
|
|
}>(), {
|
|
|
|
depth: 1,
|
2024-02-04 13:20:11 +01:00
|
|
|
isReply: false,
|
2024-02-03 13:22:12 +01:00
|
|
|
detailed: false,
|
2023-12-02 13:09:25 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
const el = shallowRef<HTMLElement>();
|
|
|
|
const muted = ref($i ? checkWordMute(props.note, $i, $i.mutedWords) : false);
|
|
|
|
const translation = ref<any>(null);
|
|
|
|
const translating = ref(false);
|
|
|
|
const isDeleted = ref(false);
|
|
|
|
const renoted = ref(false);
|
2023-12-07 14:54:31 +01:00
|
|
|
const numberOfReplies = ref(defaultStore.state.numberOfReplies);
|
2023-12-02 13:09:25 +01:00
|
|
|
const reactButton = shallowRef<HTMLElement>();
|
|
|
|
const renoteButton = shallowRef<HTMLElement>();
|
|
|
|
const quoteButton = shallowRef<HTMLElement>();
|
|
|
|
const menuButton = shallowRef<HTMLElement>();
|
|
|
|
const likeButton = shallowRef<HTMLElement>();
|
|
|
|
|
2023-12-23 02:09:23 +01:00
|
|
|
let appearNote = computed(() => isRenote ? props.note.renote as Misskey.entities.Note : props.note);
|
2023-12-02 13:09:25 +01:00
|
|
|
const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
|
2023-12-19 10:07:32 +01:00
|
|
|
const replies = ref<Misskey.entities.Note[]>([]);
|
2023-12-02 13:09:25 +01:00
|
|
|
|
|
|
|
const isRenote = (
|
|
|
|
props.note.renote != null &&
|
|
|
|
props.note.text == null &&
|
2024-02-22 22:16:08 +01:00
|
|
|
props.note.fileIds && props.note.fileIds.length === 0 &&
|
2023-12-02 13:09:25 +01:00
|
|
|
props.note.poll == null
|
|
|
|
);
|
|
|
|
|
2023-12-21 17:00:59 +01:00
|
|
|
async function addReplyTo(replyNote: Misskey.entities.Note) {
|
2023-12-29 18:36:15 +01:00
|
|
|
replies.value.unshift(replyNote);
|
|
|
|
appearNote.value.repliesCount += 1;
|
2023-12-21 17:00:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async function removeReply(id: Misskey.entities.Note['id']) {
|
2023-12-29 18:36:15 +01:00
|
|
|
const replyIdx = replies.value.findIndex(note => note.id === id);
|
|
|
|
if (replyIdx >= 0) {
|
|
|
|
replies.value.splice(replyIdx, 1);
|
|
|
|
appearNote.value.repliesCount -= 1;
|
|
|
|
}
|
2023-12-19 10:07:32 +01:00
|
|
|
}
|
|
|
|
|
2023-12-02 13:09:25 +01:00
|
|
|
useNoteCapture({
|
|
|
|
rootEl: el,
|
2023-12-23 02:09:23 +01:00
|
|
|
note: appearNote,
|
2023-12-02 13:09:25 +01:00
|
|
|
isDeletedRef: isDeleted,
|
2023-12-19 10:07:32 +01:00
|
|
|
// only update replies if we are, in fact, showing replies
|
|
|
|
onReplyCallback: props.detail && props.depth < numberOfReplies.value ? addReplyTo : undefined,
|
2023-12-21 17:00:59 +01:00
|
|
|
onDeleteCallback: props.detail && props.depth < numberOfReplies.value ? props.onDeleteCallback : undefined,
|
2023-12-02 13:09:25 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
if ($i) {
|
2024-01-09 02:57:57 +01:00
|
|
|
misskeyApi('notes/renotes', {
|
2023-12-23 02:09:23 +01:00
|
|
|
noteId: appearNote.value.id,
|
2023-12-02 13:09:25 +01:00
|
|
|
userId: $i.id,
|
|
|
|
limit: 1,
|
|
|
|
}).then((res) => {
|
|
|
|
renoted.value = res.length > 0;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function focus() {
|
|
|
|
el.value.focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
function reply(viaKeyboard = false): void {
|
|
|
|
pleaseLogin();
|
|
|
|
showMovedDialog();
|
|
|
|
os.post({
|
|
|
|
reply: props.note,
|
|
|
|
channel: props.note.channel,
|
|
|
|
animation: !viaKeyboard,
|
|
|
|
}, () => {
|
|
|
|
focus();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function react(viaKeyboard = false): void {
|
|
|
|
pleaseLogin();
|
|
|
|
showMovedDialog();
|
2024-01-09 10:35:10 +01:00
|
|
|
sound.playMisskeySfx('reaction');
|
2023-12-02 13:09:25 +01:00
|
|
|
if (props.note.reactionAcceptance === 'likeOnly') {
|
2024-01-09 02:57:57 +01:00
|
|
|
misskeyApi('notes/like', {
|
2023-12-02 13:09:25 +01:00
|
|
|
noteId: props.note.id,
|
|
|
|
override: defaultLike.value,
|
|
|
|
});
|
|
|
|
const el = reactButton.value as HTMLElement | null | undefined;
|
|
|
|
if (el) {
|
|
|
|
const rect = el.getBoundingClientRect();
|
|
|
|
const x = rect.left + (el.offsetWidth / 2);
|
|
|
|
const y = rect.top + (el.offsetHeight / 2);
|
|
|
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
blur();
|
2024-02-22 22:16:08 +01:00
|
|
|
reactionPicker.show(reactButton.value ?? null, props.note, reaction => {
|
2024-01-09 02:57:57 +01:00
|
|
|
misskeyApi('notes/reactions/create', {
|
2023-12-02 13:09:25 +01:00
|
|
|
noteId: props.note.id,
|
|
|
|
reaction: reaction,
|
|
|
|
});
|
|
|
|
if (props.note.text && props.note.text.length > 100 && (Date.now() - new Date(props.note.createdAt).getTime() < 1000 * 3)) {
|
|
|
|
claimAchievement('reactWithoutRead');
|
|
|
|
}
|
|
|
|
}, () => {
|
|
|
|
focus();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function like(): void {
|
|
|
|
pleaseLogin();
|
|
|
|
showMovedDialog();
|
2024-01-09 10:35:10 +01:00
|
|
|
sound.playMisskeySfx('reaction');
|
2024-01-09 02:57:57 +01:00
|
|
|
misskeyApi('notes/like', {
|
2023-12-02 13:09:25 +01:00
|
|
|
noteId: props.note.id,
|
|
|
|
override: defaultLike.value,
|
|
|
|
});
|
2023-12-29 18:36:15 +01:00
|
|
|
const el = likeButton.value as HTMLElement | null | undefined;
|
2023-12-02 13:09:25 +01:00
|
|
|
if (el) {
|
|
|
|
const rect = el.getBoundingClientRect();
|
|
|
|
const x = rect.left + (el.offsetWidth / 2);
|
|
|
|
const y = rect.top + (el.offsetHeight / 2);
|
|
|
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function undoReact(note): void {
|
|
|
|
const oldReaction = note.myReaction;
|
|
|
|
if (!oldReaction) return;
|
2024-01-09 02:57:57 +01:00
|
|
|
misskeyApi('notes/reactions/delete', {
|
2023-12-02 13:09:25 +01:00
|
|
|
noteId: note.id,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function undoRenote() : void {
|
|
|
|
if (!renoted.value) return;
|
2024-01-09 02:57:57 +01:00
|
|
|
misskeyApi('notes/unrenote', {
|
2023-12-23 02:09:23 +01:00
|
|
|
noteId: appearNote.value.id,
|
2023-12-02 13:09:25 +01:00
|
|
|
});
|
|
|
|
os.toast(i18n.ts.rmboost);
|
|
|
|
renoted.value = false;
|
|
|
|
|
|
|
|
const el = renoteButton.value as HTMLElement | null | undefined;
|
|
|
|
if (el) {
|
|
|
|
const rect = el.getBoundingClientRect();
|
|
|
|
const x = rect.left + (el.offsetWidth / 2);
|
|
|
|
const y = rect.top + (el.offsetHeight / 2);
|
|
|
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-23 02:09:23 +01:00
|
|
|
let showContent = ref(defaultStore.state.uncollapseCW);
|
2023-12-02 13:09:25 +01:00
|
|
|
|
|
|
|
watch(() => props.expandAllCws, (expandAllCws) => {
|
2023-12-23 02:09:23 +01:00
|
|
|
if (expandAllCws !== showContent.value) showContent.value = expandAllCws;
|
2023-12-02 13:09:25 +01:00
|
|
|
});
|
|
|
|
|
2023-12-04 00:19:34 +01:00
|
|
|
function boostVisibility() {
|
2024-01-01 20:34:18 +01:00
|
|
|
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
|
|
|
renote(defaultStore.state.visibilityOnBoost);
|
|
|
|
} else {
|
2024-02-16 13:24:35 +01:00
|
|
|
os.popupMenu(boostMenuItems(appearNote, renote), renoteButton.value);
|
2024-01-01 20:34:18 +01:00
|
|
|
}
|
2023-12-04 00:19:34 +01:00
|
|
|
}
|
|
|
|
|
2024-02-16 13:24:35 +01:00
|
|
|
function renote(visibility: Visibility, localOnly: boolean = false) {
|
2023-12-02 13:09:25 +01:00
|
|
|
pleaseLogin();
|
|
|
|
showMovedDialog();
|
|
|
|
|
2023-12-23 02:09:23 +01:00
|
|
|
if (appearNote.value.channel) {
|
2023-12-02 13:09:25 +01:00
|
|
|
const el = renoteButton.value as HTMLElement | null | undefined;
|
|
|
|
if (el) {
|
|
|
|
const rect = el.getBoundingClientRect();
|
|
|
|
const x = rect.left + (el.offsetWidth / 2);
|
|
|
|
const y = rect.top + (el.offsetHeight / 2);
|
|
|
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
|
|
|
}
|
|
|
|
|
2024-01-09 02:57:57 +01:00
|
|
|
misskeyApi('notes/create', {
|
2024-02-16 13:24:35 +01:00
|
|
|
renoteId: appearNote.value.id,
|
|
|
|
channelId: appearNote.value.channelId,
|
2023-12-02 13:09:25 +01:00
|
|
|
}).then(() => {
|
|
|
|
os.toast(i18n.ts.renoted);
|
|
|
|
renoted.value = true;
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
const el = renoteButton.value as HTMLElement | null | undefined;
|
|
|
|
if (el) {
|
|
|
|
const rect = el.getBoundingClientRect();
|
|
|
|
const x = rect.left + (el.offsetWidth / 2);
|
|
|
|
const y = rect.top + (el.offsetHeight / 2);
|
|
|
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
|
|
|
}
|
|
|
|
|
2024-01-09 02:57:57 +01:00
|
|
|
misskeyApi('notes/create', {
|
2024-02-16 13:24:35 +01:00
|
|
|
renoteId: appearNote.value.id,
|
|
|
|
localOnly: localOnly,
|
|
|
|
visibility: visibility,
|
2023-12-02 13:09:25 +01:00
|
|
|
}).then(() => {
|
|
|
|
os.toast(i18n.ts.renoted);
|
|
|
|
renoted.value = true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function quote() {
|
|
|
|
pleaseLogin();
|
|
|
|
showMovedDialog();
|
|
|
|
|
2023-12-23 02:09:23 +01:00
|
|
|
if (appearNote.value.channel) {
|
2023-12-02 13:09:25 +01:00
|
|
|
os.post({
|
2023-12-23 02:09:23 +01:00
|
|
|
renote: appearNote.value,
|
|
|
|
channel: appearNote.value.channel,
|
2023-12-02 13:09:25 +01:00
|
|
|
}).then(() => {
|
2024-01-09 02:57:57 +01:00
|
|
|
misskeyApi('notes/renotes', {
|
2023-12-02 13:09:25 +01:00
|
|
|
noteId: props.note.id,
|
|
|
|
userId: $i.id,
|
|
|
|
limit: 1,
|
|
|
|
quote: true,
|
|
|
|
}).then((res) => {
|
|
|
|
if (!(res.length > 0)) return;
|
|
|
|
const el = quoteButton.value as HTMLElement | null | undefined;
|
|
|
|
if (el && res.length > 0) {
|
|
|
|
const rect = el.getBoundingClientRect();
|
|
|
|
const x = rect.left + (el.offsetWidth / 2);
|
|
|
|
const y = rect.top + (el.offsetHeight / 2);
|
|
|
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
|
|
|
}
|
|
|
|
|
|
|
|
os.toast(i18n.ts.quoted);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
os.post({
|
2023-12-23 02:09:23 +01:00
|
|
|
renote: appearNote.value,
|
2023-12-02 13:09:25 +01:00
|
|
|
}).then(() => {
|
2024-01-09 02:57:57 +01:00
|
|
|
misskeyApi('notes/renotes', {
|
2023-12-02 13:09:25 +01:00
|
|
|
noteId: props.note.id,
|
|
|
|
userId: $i.id,
|
|
|
|
limit: 1,
|
|
|
|
quote: true,
|
|
|
|
}).then((res) => {
|
|
|
|
if (!(res.length > 0)) return;
|
|
|
|
const el = quoteButton.value as HTMLElement | null | undefined;
|
|
|
|
if (el && res.length > 0) {
|
|
|
|
const rect = el.getBoundingClientRect();
|
|
|
|
const x = rect.left + (el.offsetWidth / 2);
|
|
|
|
const y = rect.top + (el.offsetHeight / 2);
|
|
|
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
|
|
|
}
|
|
|
|
|
|
|
|
os.toast(i18n.ts.quoted);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function menu(viaKeyboard = false): void {
|
|
|
|
const { menu, cleanup } = getNoteMenu({ note: props.note, translating, translation, menuButton, isDeleted });
|
|
|
|
os.popupMenu(menu, menuButton.value, {
|
|
|
|
viaKeyboard,
|
|
|
|
}).then(focus).finally(cleanup);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (props.detail) {
|
2024-01-09 02:57:57 +01:00
|
|
|
misskeyApi('notes/children', {
|
2023-12-02 13:09:25 +01:00
|
|
|
noteId: props.note.id,
|
2023-12-07 14:54:31 +01:00
|
|
|
limit: numberOfReplies.value,
|
2023-12-03 20:43:25 +01:00
|
|
|
showQuotes: false,
|
2023-12-02 13:09:25 +01:00
|
|
|
}).then(res => {
|
2023-12-23 02:09:23 +01:00
|
|
|
replies.value = res;
|
2023-12-02 13:09:25 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
|
|
|
padding: 28px 32px;
|
|
|
|
position: relative;
|
|
|
|
|
2024-01-01 17:44:13 +01:00
|
|
|
--reply-indent: calc(.5 * var(--avatar));
|
|
|
|
|
2023-12-02 13:09:25 +01:00
|
|
|
&.children {
|
2024-01-28 16:20:59 +01:00
|
|
|
padding: 10px 0 0 8px;
|
|
|
|
}
|
|
|
|
|
2024-02-04 13:20:11 +01:00
|
|
|
&.isReply {
|
2024-02-02 12:40:02 +01:00
|
|
|
/* @link https://utopia.fyi/clamp/calculator?a=450,580,26—36 */
|
|
|
|
--avatar: clamp(26px, -8.6154px + 7.6923cqi, 36px);
|
2023-12-02 13:09:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.line {
|
|
|
|
position: absolute;
|
2024-01-01 17:44:13 +01:00
|
|
|
left: calc(32px + .5 * var(--avatar));
|
2023-12-02 13:09:25 +01:00
|
|
|
// using solid instead of dotted, stylelistic choice
|
2024-01-01 17:44:13 +01:00
|
|
|
border-left: var(--thread-width) solid var(--thread);
|
|
|
|
top: calc(28px + var(--avatar)); // 28px of .root padding, plus 58px of avatar height (see SkNote)
|
|
|
|
bottom: -28px;
|
2023-12-02 13:09:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.footer {
|
2024-01-06 17:28:38 +01:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
2023-12-02 13:09:25 +01:00
|
|
|
position: relative;
|
|
|
|
z-index: 1;
|
|
|
|
margin-top: 0.4em;
|
2024-01-06 17:28:38 +01:00
|
|
|
max-width: 400px;
|
2023-12-02 13:09:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.main {
|
2024-01-03 14:42:51 +01:00
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
|
2024-02-04 14:42:43 +01:00
|
|
|
:is(.detailed, .isReply) &::after {
|
2024-01-03 14:42:51 +01:00
|
|
|
content: "";
|
|
|
|
position: absolute;
|
|
|
|
top: -12px;
|
|
|
|
right: -12px;
|
|
|
|
left: -12px;
|
|
|
|
bottom: -12px;
|
|
|
|
background: var(--panelHighlight);
|
|
|
|
border-radius: var(--radius);
|
|
|
|
opacity: 0;
|
|
|
|
transition: opacity .2s, background .2s;
|
|
|
|
z-index: -1;
|
|
|
|
}
|
2024-01-28 16:20:59 +01:00
|
|
|
|
2024-02-04 14:42:43 +01:00
|
|
|
:is(.detailed, .isReply) &:hover::after,
|
|
|
|
:is(.detailed, .isReply) &:focus-within::after {
|
2024-01-03 14:42:51 +01:00
|
|
|
opacity: 1;
|
|
|
|
}
|
2023-12-02 13:09:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.colorBar {
|
|
|
|
position: absolute;
|
|
|
|
top: 8px;
|
|
|
|
left: 8px;
|
|
|
|
width: 5px;
|
|
|
|
height: calc(100% - 8px);
|
|
|
|
border-radius: var(--radius-ellipse);
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.avatar {
|
|
|
|
flex-shrink: 0;
|
|
|
|
display: block;
|
|
|
|
margin: 0 14px 0 0;
|
2024-01-01 17:44:13 +01:00
|
|
|
width: var(--avatar);
|
|
|
|
height: var(--avatar);
|
2023-12-02 13:09:25 +01:00
|
|
|
border-radius: var(--radius-sm);
|
|
|
|
}
|
|
|
|
|
|
|
|
.body {
|
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.text {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.header {
|
|
|
|
margin-bottom: 2px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.noteFooterButton {
|
|
|
|
margin: 0;
|
|
|
|
padding: 8px;
|
|
|
|
padding-top: 10px;
|
|
|
|
opacity: 0.7;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: var(--fgHighlighted);
|
|
|
|
}
|
|
|
|
}
|
2023-12-02 20:28:22 +01:00
|
|
|
// Responsible for Reply borders 448 and 508
|
2023-12-02 13:09:25 +01:00
|
|
|
.reply, .more {
|
2023-12-02 20:28:22 +01:00
|
|
|
//border-left: solid 0.5px var(--divider);
|
2023-12-02 13:09:25 +01:00
|
|
|
margin-top: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.more {
|
|
|
|
padding: 10px 0 0 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@container (max-width: 580px) {
|
|
|
|
.root {
|
|
|
|
padding: 28px 26px 0;
|
2024-01-01 17:44:13 +01:00
|
|
|
--avatar: 46px;
|
2023-12-02 13:09:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.line {
|
2024-01-01 17:44:13 +01:00
|
|
|
left: calc(26px + .5 * var(--avatar));
|
2023-12-02 13:09:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@container (max-width: 500px) {
|
|
|
|
.root {
|
|
|
|
padding: 23px 25px;
|
|
|
|
}
|
2024-01-01 17:44:13 +01:00
|
|
|
|
|
|
|
.line {
|
|
|
|
top: calc(23px + var(--avatar));
|
|
|
|
left: calc(25px + .5 * var(--avatar));
|
|
|
|
}
|
2023-12-02 13:09:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@container (max-width: 400px) {
|
|
|
|
.noteFooterButton {
|
|
|
|
&:not(:last-child) {
|
|
|
|
margin-right: 0.7em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.noteFooterButtonCount {
|
|
|
|
display: inline;
|
|
|
|
margin: 0 0 0 8px;
|
|
|
|
opacity: 0.7;
|
|
|
|
|
|
|
|
&.reacted {
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.cw {
|
|
|
|
display: block;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
overflow-wrap: break-word;
|
|
|
|
}
|
|
|
|
|
|
|
|
.text {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.reply, .more {
|
2023-12-02 20:28:22 +01:00
|
|
|
//border-left: solid 0.5px var(--divider);
|
2023-12-02 13:09:25 +01:00
|
|
|
margin-top: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.more {
|
|
|
|
padding: 10px 0 0 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@container (max-width: 480px) {
|
|
|
|
.root {
|
|
|
|
padding: 22px 24px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.line {
|
2024-01-01 17:44:13 +01:00
|
|
|
top: calc(22px + var(--avatar));
|
|
|
|
left: calc(24px + .5 * var(--avatar));
|
2023-12-02 13:09:25 +01:00
|
|
|
}
|
2024-01-01 17:44:13 +01:00
|
|
|
}
|
2023-12-02 13:09:25 +01:00
|
|
|
|
2024-01-01 17:44:13 +01:00
|
|
|
@container (max-width: 450px) {
|
|
|
|
.root {
|
|
|
|
--avatar: 44px;
|
2023-12-02 13:09:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.muted {
|
|
|
|
text-align: center;
|
|
|
|
padding: 8px !important;
|
|
|
|
border: 1px solid var(--divider);
|
|
|
|
margin: 8px 8px 0 8px;
|
|
|
|
border-radius: var(--radius-sm);
|
|
|
|
}
|
2023-12-02 20:28:22 +01:00
|
|
|
|
|
|
|
// avatar container with line
|
|
|
|
.avatarContainer {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
|
|
|
.threadLine {
|
|
|
|
width: 0;
|
|
|
|
flex-grow: 1;
|
2024-01-01 17:44:13 +01:00
|
|
|
border-left: var(--thread-width) solid var(--thread);
|
|
|
|
margin-left: var(--reply-indent);
|
2023-12-02 20:28:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.reply {
|
2024-01-01 17:44:13 +01:00
|
|
|
margin-left: var(--reply-indent);
|
2023-12-02 20:28:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.reply:not(:last-child) {
|
2024-01-01 17:44:13 +01:00
|
|
|
border-left: var(--thread-width) solid var(--thread);
|
2023-12-02 20:28:22 +01:00
|
|
|
|
|
|
|
&::before {
|
2024-01-01 17:44:13 +01:00
|
|
|
left: calc(-1 * var(--thread-width));
|
2023-12-02 20:28:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.reply::before {
|
|
|
|
position: absolute;
|
|
|
|
content: '';
|
|
|
|
left: 0px;
|
|
|
|
top: -10px;
|
2024-01-01 17:44:13 +01:00
|
|
|
height: calc(10px + 10px + .5 * var(--avatar));
|
2023-12-02 20:28:22 +01:00
|
|
|
width: 15px;
|
2024-01-01 17:44:13 +01:00
|
|
|
border-left: var(--thread-width) solid var(--thread);
|
|
|
|
border-bottom: var(--thread-width) solid var(--thread);
|
2023-12-02 20:28:22 +01:00
|
|
|
border-bottom-left-radius: 15px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.single {
|
|
|
|
margin-left: 0;
|
|
|
|
padding-left: 0 !important;
|
|
|
|
|
|
|
|
&::before {
|
2024-01-01 17:44:13 +01:00
|
|
|
left: var(--reply-indent);
|
2023-12-02 20:28:22 +01:00
|
|
|
width: 0;
|
|
|
|
border-bottom: unset;
|
|
|
|
}
|
|
|
|
}
|
2023-12-02 13:09:25 +01:00
|
|
|
</style>
|