Update MkNote.vue
This commit is contained in:
		
							parent
							
								
									5a2bce041c
								
							
						
					
					
						commit
						9d572ca6ff
					
				packages/frontend/src/components
|  | @ -18,11 +18,11 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||||
| 	<!--<div v-if="appearNote._featuredId_" class="tip"><i class="ti ti-bolt"></i> {{ i18n.ts.featured }}</div>--> | 	<!--<div v-if="appearNote._featuredId_" class="tip"><i class="ti ti-bolt"></i> {{ i18n.ts.featured }}</div>--> | ||||||
| 	<div v-if="isRenote" :class="$style.renote"> | 	<div v-if="isRenote" :class="$style.renote"> | ||||||
| 		<div v-if="note.channel" :class="$style.colorBar" :style="{ background: note.channel.color }"></div> | 		<div v-if="note.channel" :class="$style.colorBar" :style="{ background: note.channel.color }"></div> | ||||||
| 		<MkAvatar :class="$style.renoteAvatar" :user="note.user" link :preview="!inEmbedPage && !mock"/> | 		<MkAvatar :class="$style.renoteAvatar" :user="note.user" link preview/> | ||||||
| 		<i class="ti ti-repeat" style="margin-right: 4px;"></i> | 		<i class="ti ti-repeat" style="margin-right: 4px;"></i> | ||||||
| 		<I18n :src="i18n.ts.renotedBy" tag="span" :class="$style.renoteText"> | 		<I18n :src="i18n.ts.renotedBy" tag="span" :class="$style.renoteText"> | ||||||
| 			<template #user> | 			<template #user> | ||||||
| 				<MkA v-user-preview="inEmbedPage ? undefined : note.userId" :class="$style.renoteUserName" :to="userPage(note.user)"> | 				<MkA v-user-preview="note.userId" :class="$style.renoteUserName" :to="userPage(note.user)"> | ||||||
| 					<MkUserName :user="note.user"/> | 					<MkUserName :user="note.user"/> | ||||||
| 				</MkA> | 				</MkA> | ||||||
| 			</template> | 			</template> | ||||||
|  | @ -42,12 +42,12 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||||
| 		</div> | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
| 	<div v-if="renoteCollapsed" :class="$style.collapsedRenoteTarget"> | 	<div v-if="renoteCollapsed" :class="$style.collapsedRenoteTarget"> | ||||||
| 		<MkAvatar :class="$style.collapsedRenoteTargetAvatar" :user="appearNote.user" link :preview="!inEmbedPage && !mock"/> | 		<MkAvatar :class="$style.collapsedRenoteTargetAvatar" :user="appearNote.user" link preview/> | ||||||
| 		<Mfm :text="getNoteSummary(appearNote)" :plain="true" :nowrap="true" :author="appearNote.user" :nyaize="'respect'" :class="$style.collapsedRenoteTargetText" @click="renoteCollapsed = false"/> | 		<Mfm :text="getNoteSummary(appearNote)" :plain="true" :nowrap="true" :author="appearNote.user" :nyaize="'respect'" :class="$style.collapsedRenoteTargetText" @click="renoteCollapsed = false"/> | ||||||
| 	</div> | 	</div> | ||||||
| 	<article v-else :class="$style.article" @contextmenu.stop="onContextmenu"> | 	<article v-else :class="$style.article" @contextmenu.stop="onContextmenu"> | ||||||
| 		<div v-if="appearNote.channel" :class="$style.colorBar" :style="{ background: appearNote.channel.color }"></div> | 		<div v-if="appearNote.channel" :class="$style.colorBar" :style="{ background: appearNote.channel.color }"></div> | ||||||
| 		<MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!inEmbedPage && !mock"/> | 		<MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!mock"/> | ||||||
| 		<div :class="$style.main"> | 		<div :class="$style.main"> | ||||||
| 			<MkNoteHeader :note="appearNote" :mini="true"/> | 			<MkNoteHeader :note="appearNote" :mini="true"/> | ||||||
| 			<MkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/> | 			<MkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/> | ||||||
|  | @ -67,7 +67,7 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||||
| 							:author="appearNote.user" | 							:author="appearNote.user" | ||||||
| 							:nyaize="'respect'" | 							:nyaize="'respect'" | ||||||
| 							:emojiUrls="appearNote.emojis" | 							:emojiUrls="appearNote.emojis" | ||||||
| 							:enableEmojiMenu="!inEmbedPage" | 							:enableEmojiMenu="true" | ||||||
| 							:enableEmojiMenuReaction="true" | 							:enableEmojiMenuReaction="true" | ||||||
| 						/> | 						/> | ||||||
| 						<div v-if="translating || translation" :class="$style.translation"> | 						<div v-if="translating || translation" :class="$style.translation"> | ||||||
|  | @ -79,10 +79,9 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||||
| 						</div> | 						</div> | ||||||
| 					</div> | 					</div> | ||||||
| 					<div v-if="appearNote.files && appearNote.files.length > 0"> | 					<div v-if="appearNote.files && appearNote.files.length > 0"> | ||||||
| 						<EmMediaList v-if="inEmbedPage" ref="galleryEl" :mediaList="appearNote.files" :originalEntityUrl="`${url}/notes/${appearNote.id}`"/> | 						<MkMediaList ref="galleryEl" :mediaList="appearNote.files"/> | ||||||
| 						<MkMediaList v-else ref="galleryEl" :mediaList="appearNote.files"/> |  | ||||||
| 					</div> | 					</div> | ||||||
| 					<MkPoll v-if="appearNote.poll" :noteId="appearNote.id" :poll="appearNote.poll" :readOnly="inEmbedPage" :class="$style.poll"/> | 					<MkPoll v-if="appearNote.poll" :noteId="appearNote.id" :poll="appearNote.poll" :class="$style.poll"/> | ||||||
| 					<div v-if="isEnabledUrlPreview"> | 					<div v-if="isEnabledUrlPreview"> | ||||||
| 						<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" :class="$style.urlPreview"/> | 						<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" :class="$style.urlPreview"/> | ||||||
| 					</div> | 					</div> | ||||||
|  | @ -101,25 +100,7 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||||
| 					<MkA :to="`/notes/${appearNote.id}/reactions`" :class="[$style.reactionOmitted]">{{ i18n.ts.more }}</MkA> | 					<MkA :to="`/notes/${appearNote.id}/reactions`" :class="[$style.reactionOmitted]">{{ i18n.ts.more }}</MkA> | ||||||
| 				</template> | 				</template> | ||||||
| 			</MkReactionsViewer> | 			</MkReactionsViewer> | ||||||
| 			<footer v-if="inEmbedPage" :class="$style.footer"> | 			<footer :class="$style.footer"> | ||||||
| 				<a :href="`/notes/${appearNote.id}`" target="_blank" rel="noopener" :class="[$style.footerButton, $style.footerButtonLink]" class="_button"> |  | ||||||
| 					<i class="ti ti-arrow-back-up"></i> |  | ||||||
| 				</a> |  | ||||||
| 				<a v-if="canRenote" :href="`/notes/${appearNote.id}`" target="_blank" rel="noopener" :class="[$style.footerButton, $style.footerButtonLink]" class="_button"> |  | ||||||
| 					<i class="ti ti-repeat"></i> |  | ||||||
| 				</a> |  | ||||||
| 				<a v-else :href="`/notes/${appearNote.id}`" target="_blank" rel="noopener" :class="[$style.footerButton, $style.footerButtonLink]" class="_button" disabled> |  | ||||||
| 					<i class="ti ti-ban"></i> |  | ||||||
| 				</a> |  | ||||||
| 				<a :href="`/notes/${appearNote.id}`" target="_blank" rel="noopener" :class="[$style.footerButton, $style.footerButtonLink]" class="_button"> |  | ||||||
| 					<i v-if="appearNote.reactionAcceptance === 'likeOnly'" class="ti ti-heart"></i> |  | ||||||
| 					<i v-else class="ti ti-plus"></i> |  | ||||||
| 				</a> |  | ||||||
| 				<a :href="`/notes/${appearNote.id}`" target="_blank" rel="noopener" :class="[$style.footerButton, $style.footerButtonLink]" class="_button"> |  | ||||||
| 					<i class="ti ti-dots"></i> |  | ||||||
| 				</a> |  | ||||||
| 			</footer> |  | ||||||
| 			<footer v-else :class="$style.footer"> |  | ||||||
| 				<button :class="$style.footerButton" class="_button" @click="reply()"> | 				<button :class="$style.footerButton" class="_button" @click="reply()"> | ||||||
| 					<i class="ti ti-arrow-back-up"></i> | 					<i class="ti ti-arrow-back-up"></i> | ||||||
| 					<p v-if="appearNote.repliesCount > 0" :class="$style.footerButtonCount">{{ number(appearNote.repliesCount) }}</p> | 					<p v-if="appearNote.repliesCount > 0" :class="$style.footerButtonCount">{{ number(appearNote.repliesCount) }}</p> | ||||||
|  | @ -157,14 +138,14 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||||
| <div v-else-if="!hardMuted" :class="$style.muted" @click="muted = false"> | <div v-else-if="!hardMuted" :class="$style.muted" @click="muted = false"> | ||||||
| 	<I18n v-if="muted === 'sensitiveMute'" :src="i18n.ts.userSaysSomethingSensitive" tag="small"> | 	<I18n v-if="muted === 'sensitiveMute'" :src="i18n.ts.userSaysSomethingSensitive" tag="small"> | ||||||
| 		<template #name> | 		<template #name> | ||||||
| 			<MkA v-user-preview="inEmbedPage ? undefined : appearNote.userId" :to="userPage(appearNote.user)"> | 			<MkA v-user-preview="appearNote.userId" :to="userPage(appearNote.user)"> | ||||||
| 				<MkUserName :user="appearNote.user"/> | 				<MkUserName :user="appearNote.user"/> | ||||||
| 			</MkA> | 			</MkA> | ||||||
| 		</template> | 		</template> | ||||||
| 	</I18n> | 	</I18n> | ||||||
| 	<I18n v-else :src="i18n.ts.userSaysSomething" tag="small"> | 	<I18n v-else :src="i18n.ts.userSaysSomething" tag="small"> | ||||||
| 		<template #name> | 		<template #name> | ||||||
| 			<MkA v-user-preview="inEmbedPage ? undefined : appearNote.userId" :to="userPage(appearNote.user)"> | 			<MkA v-user-preview="appearNote.userId" :to="userPage(appearNote.user)"> | ||||||
| 				<MkUserName :user="appearNote.user"/> | 				<MkUserName :user="appearNote.user"/> | ||||||
| 			</MkA> | 			</MkA> | ||||||
| 		</template> | 		</template> | ||||||
|  | @ -188,7 +169,6 @@ import MkNoteSimple from '@/components/MkNoteSimple.vue'; | ||||||
| import MkReactionsViewer from '@/components/MkReactionsViewer.vue'; | import MkReactionsViewer from '@/components/MkReactionsViewer.vue'; | ||||||
| import MkReactionsViewerDetails from '@/components/MkReactionsViewer.details.vue'; | import MkReactionsViewerDetails from '@/components/MkReactionsViewer.details.vue'; | ||||||
| import MkMediaList from '@/components/MkMediaList.vue'; | import MkMediaList from '@/components/MkMediaList.vue'; | ||||||
| import EmMediaList from '@/embed/components/EmMediaList.vue'; |  | ||||||
| import MkCwButton from '@/components/MkCwButton.vue'; | import MkCwButton from '@/components/MkCwButton.vue'; | ||||||
| import MkPoll from '@/components/MkPoll.vue'; | import MkPoll from '@/components/MkPoll.vue'; | ||||||
| import MkUsersTooltip from '@/components/MkUsersTooltip.vue'; | import MkUsersTooltip from '@/components/MkUsersTooltip.vue'; | ||||||
|  | @ -218,7 +198,6 @@ import { showMovedDialog } from '@/scripts/show-moved-dialog.js'; | ||||||
| import { shouldCollapsed } from '@/scripts/collapsed.js'; | import { shouldCollapsed } from '@/scripts/collapsed.js'; | ||||||
| import { host } from '@/config.js'; | import { host } from '@/config.js'; | ||||||
| import { isEnabledUrlPreview } from '@/instance.js'; | import { isEnabledUrlPreview } from '@/instance.js'; | ||||||
| import { url } from '@/config.js'; |  | ||||||
| import { type Keymap } from '@/scripts/hotkey.js'; | import { type Keymap } from '@/scripts/hotkey.js'; | ||||||
| import { focusPrev, focusNext } from '@/scripts/focus.js'; | import { focusPrev, focusNext } from '@/scripts/focus.js'; | ||||||
| import { getAppearNote } from '@/scripts/get-appear-note.js'; | import { getAppearNote } from '@/scripts/get-appear-note.js'; | ||||||
|  | @ -242,7 +221,6 @@ const emit = defineEmits<{ | ||||||
| const inTimeline = inject<boolean>('inTimeline', false); | const inTimeline = inject<boolean>('inTimeline', false); | ||||||
| const inChannel = inject('inChannel', null); | const inChannel = inject('inChannel', null); | ||||||
| const currentClip = inject<Ref<Misskey.entities.Clip> | null>('currentClip', null); | const currentClip = inject<Ref<Misskey.entities.Clip> | null>('currentClip', null); | ||||||
| const inEmbedPage = inject<boolean>('EMBED_PAGE', false); |  | ||||||
| 
 | 
 | ||||||
| const note = ref(deepClone(props.note)); | const note = ref(deepClone(props.note)); | ||||||
| 
 | 
 | ||||||
|  | @ -373,7 +351,7 @@ provide('react', (reaction: string) => { | ||||||
| 	}); | 	}); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| if (props.mock || inEmbedPage) { | if (props.mock) { | ||||||
| 	watch(() => props.note, (to) => { | 	watch(() => props.note, (to) => { | ||||||
| 		note.value = deepClone(to); | 		note.value = deepClone(to); | ||||||
| 	}, { deep: true }); | 	}, { deep: true }); | ||||||
|  | @ -386,7 +364,7 @@ if (props.mock || inEmbedPage) { | ||||||
| 	}); | 	}); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| if (!props.mock && !inEmbedPage) { | if (!props.mock) { | ||||||
| 	useTooltip(renoteButton, async (showing) => { | 	useTooltip(renoteButton, async (showing) => { | ||||||
| 		const renotes = await misskeyApi('notes/renotes', { | 		const renotes = await misskeyApi('notes/renotes', { | ||||||
| 			noteId: appearNote.value.id, | 			noteId: appearNote.value.id, | ||||||
|  | @ -524,7 +502,7 @@ function toggleReact() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function onContextmenu(ev: MouseEvent): void { | function onContextmenu(ev: MouseEvent): void { | ||||||
| 	if (props.mock || inEmbedPage) { | 	if (props.mock) { | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -955,12 +933,6 @@ function emitUpdReaction(emoji: string, delta: number) { | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .footerButtonLink:hover, |  | ||||||
| .footerButtonLink:focus, |  | ||||||
| .footerButtonLink:active { |  | ||||||
| 	text-decoration: none; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .footerButtonCount { | .footerButtonCount { | ||||||
| 	display: inline; | 	display: inline; | ||||||
| 	margin: 0 0 0 8px; | 	margin: 0 0 0 8px; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue