Skip to content

Commit

Permalink
enhance(frontend): 번역을 완료하면 진동으로 알림
Browse files Browse the repository at this point in the history
  • Loading branch information
noridev committed Nov 22, 2023
1 parent efb64e3 commit 248743e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG_CHERRYPICK.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGE
### Client
- Enhance: 리액션 상태에 따라 버튼의 툴팁을 다르게 표시함
- Enhance: 노트 헤더의 편집됨 아이콘에 커서를 올리면 마지막으로 노트를 편집한 시간을 툴팁으로 표시함
- Enhance: 번역을 완료하면 진동으로 알림
- Fix: 역할 설정에 잘못된 설정이 표시됨
- Fix: 비공개 노트에 답글을 달 수 있음
- 답글이 달리면 해당 비공개 노트의 내용을 다른 사람이 볼 수 있음
Expand Down
5 changes: 5 additions & 0 deletions packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
Expand All @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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() {
Expand Down
5 changes: 5 additions & 0 deletions packages/frontend/src/components/MkSubNoteContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -407,6 +410,8 @@ async function translate(): Promise<void> {
});
translating.value = false;
translation.value = res;

vibrate(ColdDeviceStorage.get('vibrateSystem') ? [5, 5, 10] : []);
}

function focus() {
Expand Down
8 changes: 7 additions & 1 deletion packages/frontend/src/pages/user/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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], () => {
Expand Down

0 comments on commit 248743e

Please sign in to comment.