enhance(frontend): 번역을 완료하면 진동으로 알림

This commit is contained in:
NoriDev 2023-11-22 17:03:35 +09:00
parent efb64e3014
commit 248743eac3
5 changed files with 24 additions and 1 deletions

View file

@ -36,6 +36,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGE
### Client
- Enhance: 리액션 상태에 따라 버튼의 툴팁을 다르게 표시함
- Enhance: 노트 헤더의 편집됨 아이콘에 커서를 올리면 마지막으로 노트를 편집한 시간을 툴팁으로 표시함
- Enhance: 번역을 완료하면 진동으로 알림
- Fix: 역할 설정에 잘못된 설정이 표시됨
- Fix: 비공개 노트에 답글을 달 수 있음
- 답글이 달리면 해당 비공개 노트의 내용을 다른 사람이 볼 수 있음

View file

@ -231,6 +231,7 @@ import { notePage } from '@/filters/note.js';
import { miLocalStorage } from '@/local-storage.js';
import { instance } from '@/instance.js';
import { concat } from '@/scripts/array.js';
import { vibrate } from '@/scripts/vibrate.js';
let showEl = $ref(false);
@ -569,6 +570,8 @@ async function translate(): Promise<void> {
if (translation.value != null) return;
translating.value = true;
vibrate(ColdDeviceStorage.get('vibrateSystem') ? 5 : []);
if (props.mock) {
return;
}
@ -579,6 +582,8 @@ async function translate(): Promise<void> {
});
translating.value = false;
translation.value = res;
vibrate(ColdDeviceStorage.get('vibrateSystem') ? [5, 5, 10] : []);
}
function showRenoteMenu(viaKeyboard = false): void {

View file

@ -313,6 +313,7 @@ import { miLocalStorage } from '@/local-storage.js';
import { infoImageUrl, instance } from '@/instance.js';
import MkPostForm from '@/components/MkPostFormSimple.vue';
import { deviceKind } from '@/scripts/device-kind.js';
import { vibrate } from '@/scripts/vibrate.js';
const MOBILE_THRESHOLD = 500;
const isMobile = ref(deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD);
@ -593,12 +594,17 @@ function menu(viaKeyboard = false): void {
async function translate(): Promise<void> {
if (translation.value != null) return;
translating.value = true;
vibrate(ColdDeviceStorage.get('vibrateSystem') ? 5 : []);
const res = await os.api('notes/translate', {
noteId: appearNote.id,
targetLang: miLocalStorage.getItem('lang') ?? navigator.language,
});
translating.value = false;
translation.value = res;
vibrate(ColdDeviceStorage.get('vibrateSystem') ? [5, 5, 10] : []);
}
async function clip() {

View file

@ -141,6 +141,7 @@ import { reactionPicker } from '@/scripts/reaction-picker.js';
import { claimAchievement } from '@/scripts/achievements.js';
import { useNoteCapture } from '@/scripts/use-note-capture.js';
import { concat } from '@/scripts/array.js';
import { vibrate } from '@/scripts/vibrate.js';
const props = withDefaults(defineProps<{
note: Misskey.entities.Note;
@ -397,6 +398,8 @@ async function translate(): Promise<void> {
if (translation.value != null) return;
translating.value = true;
vibrate(ColdDeviceStorage.get('vibrateSystem') ? 5 : []);
if (props.mock) {
return;
}
@ -407,6 +410,8 @@ async function translate(): Promise<void> {
});
translating.value = false;
translation.value = res;
vibrate(ColdDeviceStorage.get('vibrateSystem') ? [5, 5, 10] : []);
}
function focus() {

View file

@ -183,9 +183,10 @@ import { confetti } from '@/scripts/confetti.js';
import MkNotes from '@/components/MkNotes.vue';
import { api } from '@/os.js';
import { isFfVisibleForMe } from '@/scripts/isFfVisibleForMe.js';
import { defaultStore } from '@/store.js';
import { ColdDeviceStorage, defaultStore } from '@/store.js';
import { miLocalStorage } from '@/local-storage.js';
import { editNickname } from '@/scripts/edit-nickname.js';
import { vibrate } from '@/scripts/vibrate.js';
function calcAge(birthdate: string): number {
const date = new Date(birthdate);
@ -292,12 +293,17 @@ async function updateMemo() {
async function translate(): Promise<void> {
if (translation.value != null) return;
translating.value = true;
vibrate(ColdDeviceStorage.get('vibrateSystem') ? 5 : []);
const res = await os.api('users/translate', {
userId: props.user.id,
targetLang: miLocalStorage.getItem('lang') ?? navigator.language,
});
translating.value = false;
translation.value = res;
vibrate(ColdDeviceStorage.get('vibrateSystem') ? [5, 5, 10] : []);
}
watch([props.user], () => {