mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 15:34:13 +00:00 
			
		
		
		
	Refactor renote tooltip text
This commit is contained in:
		
							parent
							
								
									3717654309
								
							
						
					
					
						commit
						5a76b7069f
					
				
					 7 changed files with 21 additions and 31 deletions
				
			
		| 
						 | 
					@ -239,7 +239,7 @@ import { getNoteSummary } from '@/scripts/get-note-summary.js';
 | 
				
			||||||
import MkRippleEffect from '@/components/MkRippleEffect.vue';
 | 
					import MkRippleEffect from '@/components/MkRippleEffect.vue';
 | 
				
			||||||
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
 | 
					import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
 | 
				
			||||||
import { useRouter } from '@/router/supplier.js';
 | 
					import { useRouter } from '@/router/supplier.js';
 | 
				
			||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
 | 
					import { boostMenuItems, type Visibility, computeRenoteTooltip } from '@/scripts/boost-quote.js';
 | 
				
			||||||
import { isEnabledUrlPreview } from '@/instance.js';
 | 
					import { isEnabledUrlPreview } from '@/instance.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';
 | 
				
			||||||
| 
						 | 
					@ -339,10 +339,7 @@ const pleaseLoginContext = computed<OpenOnRemoteOptions>(() => ({
 | 
				
			||||||
	url: `https://${host}/notes/${appearNote.value.id}`,
 | 
						url: `https://${host}/notes/${appearNote.value.id}`,
 | 
				
			||||||
}));
 | 
					}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const renoteTooltip = computed(() => {
 | 
					const renoteTooltip = computeRenoteTooltip(renoted);
 | 
				
			||||||
	if (renoted.value) return i18n.ts.unrenote;
 | 
					 | 
				
			||||||
	return defaultStore.state.showVisibilitySelectorOnBoost ? i18n.ts.renote : i18n.ts.renoteShift;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Overload FunctionにLintが対応していないのでコメントアウト
 | 
					/* Overload FunctionにLintが対応していないのでコメントアウト
 | 
				
			||||||
function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array<string | string[]> | undefined | null, checkOnly: true): boolean;
 | 
					function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array<string | string[]> | undefined | null, checkOnly: true): boolean;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -281,7 +281,7 @@ import MkUserCardMini from '@/components/MkUserCardMini.vue';
 | 
				
			||||||
import MkPagination, { type Paging } from '@/components/MkPagination.vue';
 | 
					import MkPagination, { type Paging } from '@/components/MkPagination.vue';
 | 
				
			||||||
import MkReactionIcon from '@/components/MkReactionIcon.vue';
 | 
					import MkReactionIcon from '@/components/MkReactionIcon.vue';
 | 
				
			||||||
import MkButton from '@/components/MkButton.vue';
 | 
					import MkButton from '@/components/MkButton.vue';
 | 
				
			||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
 | 
					import { boostMenuItems, type Visibility, computeRenoteTooltip } from '@/scripts/boost-quote.js';
 | 
				
			||||||
import { isEnabledUrlPreview } from '@/instance.js';
 | 
					import { isEnabledUrlPreview } from '@/instance.js';
 | 
				
			||||||
import { getAppearNote } from '@/scripts/get-appear-note.js';
 | 
					import { getAppearNote } from '@/scripts/get-appear-note.js';
 | 
				
			||||||
import { type Keymap } from '@/scripts/hotkey.js';
 | 
					import { type Keymap } from '@/scripts/hotkey.js';
 | 
				
			||||||
| 
						 | 
					@ -348,10 +348,7 @@ const quotes = ref<Misskey.entities.Note[]>([]);
 | 
				
			||||||
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
 | 
					const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
 | 
				
			||||||
const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
 | 
					const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const renoteTooltip = computed(() => {
 | 
					const renoteTooltip = computeRenoteTooltip(renoted);
 | 
				
			||||||
	if (renoted.value) return i18n.ts.unrenote;
 | 
					 | 
				
			||||||
	return defaultStore.state.showVisibilitySelectorOnBoost ? i18n.ts.renote : i18n.ts.renoteShift;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
watch(() => props.expandAllCws, (expandAllCws) => {
 | 
					watch(() => props.expandAllCws, (expandAllCws) => {
 | 
				
			||||||
	if (expandAllCws !== showContent.value) showContent.value = expandAllCws;
 | 
						if (expandAllCws !== showContent.value) showContent.value = expandAllCws;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,7 +107,7 @@ import { reactionPicker } from '@/scripts/reaction-picker.js';
 | 
				
			||||||
import { claimAchievement } from '@/scripts/achievements.js';
 | 
					import { claimAchievement } from '@/scripts/achievements.js';
 | 
				
			||||||
import { getNoteMenu } from '@/scripts/get-note-menu.js';
 | 
					import { getNoteMenu } from '@/scripts/get-note-menu.js';
 | 
				
			||||||
import { useNoteCapture } from '@/scripts/use-note-capture.js';
 | 
					import { useNoteCapture } from '@/scripts/use-note-capture.js';
 | 
				
			||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
 | 
					import { boostMenuItems, type Visibility, computeRenoteTooltip } from '@/scripts/boost-quote.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
 | 
					const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -136,10 +136,7 @@ const quoteButton = shallowRef<HTMLElement>();
 | 
				
			||||||
const menuButton = shallowRef<HTMLElement>();
 | 
					const menuButton = shallowRef<HTMLElement>();
 | 
				
			||||||
const likeButton = shallowRef<HTMLElement>();
 | 
					const likeButton = shallowRef<HTMLElement>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const renoteTooltip = computed(() => {
 | 
					const renoteTooltip = computeRenoteTooltip(computed);
 | 
				
			||||||
	if (renoted.value) return i18n.ts.unrenote;
 | 
					 | 
				
			||||||
	return defaultStore.state.showVisibilitySelectorOnBoost ? i18n.ts.renote : i18n.ts.renoteShift;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
let appearNote = computed(() => isRenote ? props.note.renote as Misskey.entities.Note : props.note);
 | 
					let appearNote = computed(() => isRenote ? props.note.renote as Misskey.entities.Note : props.note);
 | 
				
			||||||
const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
 | 
					const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -239,7 +239,7 @@ import { getNoteSummary } from '@/scripts/get-note-summary.js';
 | 
				
			||||||
import MkRippleEffect from '@/components/MkRippleEffect.vue';
 | 
					import MkRippleEffect from '@/components/MkRippleEffect.vue';
 | 
				
			||||||
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
 | 
					import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
 | 
				
			||||||
import { useRouter } from '@/router/supplier.js';
 | 
					import { useRouter } from '@/router/supplier.js';
 | 
				
			||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
 | 
					import { boostMenuItems, type Visibility, computeRenoteTooltip } from '@/scripts/boost-quote.js';
 | 
				
			||||||
import { isEnabledUrlPreview } from '@/instance.js';
 | 
					import { isEnabledUrlPreview } from '@/instance.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';
 | 
				
			||||||
| 
						 | 
					@ -334,10 +334,7 @@ const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.
 | 
				
			||||||
const animated = computed(() => parsed.value ? checkAnimationFromMfm(parsed.value) : null);
 | 
					const animated = computed(() => parsed.value ? checkAnimationFromMfm(parsed.value) : null);
 | 
				
			||||||
const allowAnim = ref(defaultStore.state.advancedMfm && defaultStore.state.animatedMfm ? true : false);
 | 
					const allowAnim = ref(defaultStore.state.advancedMfm && defaultStore.state.animatedMfm ? true : false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const renoteTooltip = computed(() => {
 | 
					const renoteTooltip = computeRenoteTooltip(renoted);
 | 
				
			||||||
	if (renoted.value) return i18n.ts.unrenote;
 | 
					 | 
				
			||||||
	return defaultStore.state.showVisibilitySelectorOnBoost ? i18n.ts.renote : i18n.ts.renoteShift;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const pleaseLoginContext = computed<OpenOnRemoteOptions>(() => ({
 | 
					const pleaseLoginContext = computed<OpenOnRemoteOptions>(() => ({
 | 
				
			||||||
	type: 'lookup',
 | 
						type: 'lookup',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -286,7 +286,7 @@ import MkUserCardMini from '@/components/MkUserCardMini.vue';
 | 
				
			||||||
import MkPagination, { type Paging } from '@/components/MkPagination.vue';
 | 
					import MkPagination, { type Paging } from '@/components/MkPagination.vue';
 | 
				
			||||||
import MkReactionIcon from '@/components/MkReactionIcon.vue';
 | 
					import MkReactionIcon from '@/components/MkReactionIcon.vue';
 | 
				
			||||||
import MkButton from '@/components/MkButton.vue';
 | 
					import MkButton from '@/components/MkButton.vue';
 | 
				
			||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
 | 
					import { boostMenuItems, type Visibility, computeRenoteTooltip } from '@/scripts/boost-quote.js';
 | 
				
			||||||
import { isEnabledUrlPreview } from '@/instance.js';
 | 
					import { isEnabledUrlPreview } from '@/instance.js';
 | 
				
			||||||
import { getAppearNote } from '@/scripts/get-appear-note.js';
 | 
					import { getAppearNote } from '@/scripts/get-appear-note.js';
 | 
				
			||||||
import { type Keymap } from '@/scripts/hotkey.js';
 | 
					import { type Keymap } from '@/scripts/hotkey.js';
 | 
				
			||||||
| 
						 | 
					@ -354,10 +354,7 @@ const quotes = ref<Misskey.entities.Note[]>([]);
 | 
				
			||||||
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
 | 
					const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
 | 
				
			||||||
const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
 | 
					const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const renoteTooltip = computed(() => {
 | 
					const renoteTooltip = computeRenoteTooltip(renoted);
 | 
				
			||||||
	if (renoted.value) return i18n.ts.unrenote;
 | 
					 | 
				
			||||||
	return defaultStore.state.showVisibilitySelectorOnBoost ? i18n.ts.renote : i18n.ts.renoteShift;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
watch(() => props.expandAllCws, (expandAllCws) => {
 | 
					watch(() => props.expandAllCws, (expandAllCws) => {
 | 
				
			||||||
	if (expandAllCws !== showContent.value) showContent.value = expandAllCws;
 | 
						if (expandAllCws !== showContent.value) showContent.value = expandAllCws;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,7 +115,7 @@ import { reactionPicker } from '@/scripts/reaction-picker.js';
 | 
				
			||||||
import { claimAchievement } from '@/scripts/achievements.js';
 | 
					import { claimAchievement } from '@/scripts/achievements.js';
 | 
				
			||||||
import { getNoteMenu } from '@/scripts/get-note-menu.js';
 | 
					import { getNoteMenu } from '@/scripts/get-note-menu.js';
 | 
				
			||||||
import { useNoteCapture } from '@/scripts/use-note-capture.js';
 | 
					import { useNoteCapture } from '@/scripts/use-note-capture.js';
 | 
				
			||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
 | 
					import { boostMenuItems, type Visibility, computeRenoteTooltip } from '@/scripts/boost-quote.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
 | 
					const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
 | 
				
			||||||
const hideLine = computed(() => { return props.detail ? true : false; });
 | 
					const hideLine = computed(() => { return props.detail ? true : false; });
 | 
				
			||||||
| 
						 | 
					@ -150,10 +150,7 @@ const quoteButton = shallowRef<HTMLElement>();
 | 
				
			||||||
const menuButton = shallowRef<HTMLElement>();
 | 
					const menuButton = shallowRef<HTMLElement>();
 | 
				
			||||||
const likeButton = shallowRef<HTMLElement>();
 | 
					const likeButton = shallowRef<HTMLElement>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const renoteTooltip = computed(() => {
 | 
					const renoteTooltip = computeRenoteTooltip(renoted);
 | 
				
			||||||
	if (renoted.value) return i18n.ts.unrenote;
 | 
					 | 
				
			||||||
	return defaultStore.state.showVisibilitySelectorOnBoost ? i18n.ts.renote : i18n.ts.renoteShift;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
let appearNote = computed(() => isRenote ? props.note.renote as Misskey.entities.Note : props.note);
 | 
					let appearNote = computed(() => isRenote ? props.note.renote as Misskey.entities.Note : props.note);
 | 
				
			||||||
const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
 | 
					const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
 * SPDX-License-Identifier: AGPL-3.0-only
 | 
					 * SPDX-License-Identifier: AGPL-3.0-only
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { ref, Ref } from 'vue';
 | 
					import { ref, Ref, computed, ComputedRef } from 'vue';
 | 
				
			||||||
import * as Misskey from 'misskey-js';
 | 
					import * as Misskey from 'misskey-js';
 | 
				
			||||||
import { i18n } from '@/i18n.js';
 | 
					import { i18n } from '@/i18n.js';
 | 
				
			||||||
import { defaultStore } from '@/store.js';
 | 
					import { defaultStore } from '@/store.js';
 | 
				
			||||||
| 
						 | 
					@ -79,3 +79,11 @@ export function boostMenuItems(appearNote: Ref<Misskey.entities.Note>, renote: (
 | 
				
			||||||
		} as MenuItem,
 | 
							} as MenuItem,
 | 
				
			||||||
	];
 | 
						];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function computeRenoteTooltip(renoted: Ref<boolean>): ComputedRef<string> {
 | 
				
			||||||
 | 
						return computed(() => {
 | 
				
			||||||
 | 
							if (renoted.value) return i18n.ts.unrenote;
 | 
				
			||||||
 | 
							if (defaultStore.state.showVisibilitySelectorOnBoost) return i18n.ts.renote;
 | 
				
			||||||
 | 
							return i18n.ts.renoteShift;
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue