Skip to content

Commit

Permalink
feat(client): リアクション一覧詳細ダイアログを表示できるように (for v12)
Browse files Browse the repository at this point in the history
Co-authored-by: syuilo <[email protected]>
  • Loading branch information
taiyme and syuilo committed Feb 11, 2023
1 parent 5965289 commit ebd317c
Show file tree
Hide file tree
Showing 28 changed files with 153 additions and 9 deletions.
1 change: 1 addition & 0 deletions locales/ar-SA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "اضغط للعرض"
sensitive: "محتوى حساس"
add: "إضافة"
reaction: "التفاعلات"
reactions: "التفاعلات"
reactionSetting: "التفاعلات المراد عرضها في منتقي التفاعلات."
reactionSettingDescription2: "اسحب لترتيب ، انقر للحذف ، استخدم \"+\" للإضافة."
rememberNoteVisibility: "تذكر إعدادت مدى رؤية الملاحظات"
Expand Down
1 change: 1 addition & 0 deletions locales/bn-BD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "দেখার জন্য ক্লিক করুন"
sensitive: "সংবেদনশীল বিষয়বস্তু"
add: "যুক্ত করুন"
reaction: "প্রতিক্রিয়া"
reactions: "প্রতিক্রিয়া"
reactionSetting: "রিঅ্যাকশন পিকারে যেসকল প্রতিক্রিয়া দেখানো হবে"
reactionSettingDescription2: "পুনরায় সাজাতে টেনে আনুন, মুছতে ক্লিক করুন, যোগ করতে + টিপুন।"
rememberNoteVisibility: "নোটের দৃশ্যমান্যতার সেটিংস মনে রাখুন"
Expand Down
1 change: 1 addition & 0 deletions locales/ca-ES.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ clickToShow: "Fes clic per mostrar"
sensitive: "NSFW"
add: "Afegir"
reaction: "Reaccions"
reactions: "Reaccions"
reactionSetting: "Reaccions a mostrar al selector de reaccions"
reactionSettingDescription2: "Arrossega per reordenar, fes clic per suprimir, prem \"+\" per afegir."
rememberNoteVisibility: "Recorda la configuració de visibilitat de les notes"
Expand Down
1 change: 1 addition & 0 deletions locales/cs-CZ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ clickToShow: "Klikněte pro zobrazení"
sensitive: "NSFW"
add: "Přidat"
reaction: "Reakce"
reactions: "Reakce"
reactionSettingDescription2: "Přetažením změníte pořadí, kliknutím smažete, zmáčkněte \"+\" k přidání"
rememberNoteVisibility: "Zapamatovat nastavení zobrazení poznámky"
attachCancel: "Odstranit přílohu"
Expand Down
1 change: 1 addition & 0 deletions locales/de-DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Zum Anzeigen anklicken"
sensitive: "NSFW"
add: "Hinzufügen"
reaction: "Reaktionen"
reactions: "Reaktionen"
reactionSetting: "In der Reaktionsauswahl anzuzeigende Reaktionen"
reactionSettingDescription2: "Ziehe um Anzuordnen, klicke um zu löschen, drücke „+“ um hinzuzufügen"
rememberNoteVisibility: "Notizsichtbarkeit merken"
Expand Down
1 change: 1 addition & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Click to show"
sensitive: "NSFW"
add: "Add"
reaction: "Reactions"
reactions: "Reactions"
reactionSetting: "Reactions to show in the reaction picker"
reactionSettingDescription2: "Drag to reorder, click to delete, press \"+\" to add."
rememberNoteVisibility: "Remember note visibility settings"
Expand Down
1 change: 1 addition & 0 deletions locales/es-ES.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Click para ver"
sensitive: "Marcado como sensible"
add: "Agregar"
reaction: "Reacción"
reactions: "Reacción"
reactionSetting: "Reacciones para mostrar en el menú de reacciones"
reactionSettingDescription2: "Arrastre para reordenar, click para borrar, apriete la tecla + para añadir."
rememberNoteVisibility: "Recordar visibilidad"
Expand Down
1 change: 1 addition & 0 deletions locales/fr-FR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Cliquer pour afficher"
sensitive: "Contenu sensible"
add: "Ajouter"
reaction: "Réactions"
reactions: "Réactions"
reactionSetting: "Réactions à afficher dans le sélecteur de réactions"
reactionSettingDescription2: "Déplacer pour réorganiser, cliquer pour effacer, utiliser « + » pour ajouter."
rememberNoteVisibility: "Activer l'option \" se souvenir de la visibilité des notes \" vous permet de réutiliser automatiquement la visibilité utilisée lors de la publication de votre note précédente."
Expand Down
1 change: 1 addition & 0 deletions locales/id-ID.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Klik untuk melihat"
sensitive: "Konten sensitif"
add: "Tambahkan"
reaction: "Reaksi"
reactions: "Reaksi"
reactionSetting: "Reaksi untuk dimunculkan di bilah reaksi"
reactionSettingDescription2: "Geser untuk memindah urutkan, klik untuk menghapus, tekan \"+\" untuk menambahkan"
rememberNoteVisibility: "Ingat pengaturan visibilitas catatan"
Expand Down
3 changes: 2 additions & 1 deletion locales/it-IT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ you: "Tu"
clickToShow: "Clicca per visualizzare"
sensitive: "Contenuto sensibile"
add: "Aggiungi"
reaction: "Reazione"
reaction: "Reazioni"
reactions: "Reazioni"
reactionSetting: "Reazioni visualizzate sul pannello"
reactionSettingDescription2: "Trascina per riorganizzare, clicca per cancellare, usa il pulsante \"+\" per aggiungere."
rememberNoteVisibility: "Ricordare le impostazioni di visibilità delle note"
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "クリックして表示"
sensitive: "閲覧注意"
add: "追加"
reaction: "リアクション"
reactions: "リアクション"
reactionSetting: "ピッカーに表示するリアクション"
reactionSettingDescription2: "ドラッグして並び替え、クリックして削除、+を押して追加します。"
rememberNoteVisibility: "公開範囲を記憶する"
Expand Down
1 change: 1 addition & 0 deletions locales/ja-KS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "押したら見えるで"
sensitive: "ちょっとアカンやつやで"
add: "増やす"
reaction: "リアクション"
reactions: "リアクション"
reactionSetting: "Reaction that will be displayed in Picker. "
reactionSettingDescription2: "ドラッグで並び替え、クリックで削除、+を押して追加やで。"
rememberNoteVisibility: "公開範囲覚えといて"
Expand Down
2 changes: 2 additions & 0 deletions locales/ko-KR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "클릭하여 보기"
sensitive: "열람주의"
add: "추가"
reaction: "리액션"
reactions: "리액션"
reactionSetting: "선택기에 표시할 리액션"
reactionSettingDescription2: "끌어서 순서 변경, 클릭해서 삭제, +를 눌러서 추가할 수 있습니다."
rememberNoteVisibility: "공개 범위를 기억하기"
Expand Down Expand Up @@ -1696,6 +1697,7 @@ _notification:
youWereInvitedToGroup: "그룹에 초대되었습니다"
pollEnded: "투표 결과가 발표되었습니다"
emptyPushNotificationMessage: "푸시 알림이 갱신되었습니다"
achievementEarned: "도전 과제를 달성했습니다"
_types:
all: "전부"
follow: "팔로잉"
Expand Down
2 changes: 2 additions & 0 deletions locales/nl-NL.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ clickToShow: "Klik om te bekijken"
sensitive: "NSFW"
add: "Toevoegen"
reaction: "Reacties"
reactions: "Reacties"
reactionSetting: "Reacties die in de reactie-selector worden getoond"
reactionSettingDescription2: "Sleep om opnieuw te ordenen, Klik om te verwijderen, Druk op \"+\" om toe te voegen"
rememberNoteVisibility: "Vergeet niet de notitie zichtbaarheidsinstellingen"
attachCancel: "Verwijder bijlage"
Expand Down
1 change: 1 addition & 0 deletions locales/pl-PL.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Kliknij, aby wyświetlić"
sensitive: "NSFW"
add: "Dodaj"
reaction: "Reakcja"
reactions: "Reakcja"
reactionSetting: "Reakcje do pokazania w wyborniku reakcji"
reactionSettingDescription2: "Przeciągnij aby zmienić kolejność, naciśnij aby usunąć, naciśnij „+” aby dodać"
rememberNoteVisibility: "Zapamiętuj ustawienia widoczności wpisu"
Expand Down
1 change: 1 addition & 0 deletions locales/pt-PT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Clique para ver"
sensitive: "Conteúdo sensível"
add: "Adicionar"
reaction: "Reações"
reactions: "Reações"
reactionSetting: "Quais reações a mostrar no selecionador de reações"
reactionSettingDescription2: "Arraste para reordenar, clique para excluir, pressione + para adicionar."
rememberNoteVisibility: "Lembrar das configurações de visibilidade de notas"
Expand Down
1 change: 1 addition & 0 deletions locales/ro-RO.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Click pentru a afișa"
sensitive: "NSFW"
add: "Adaugă"
reaction: "Reacție"
reactions: "Reacție"
reactionSetting: "Reacții care să apară in selectorul de reacții"
reactionSettingDescription2: "Trage pentru a rearanja, apasă pe \"+\" pentru a adăuga."
rememberNoteVisibility: "Amintește setarea de vizibilitate a notelor"
Expand Down
1 change: 1 addition & 0 deletions locales/ru-RU.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Нажмите для просмотра"
sensitive: "Содержимое не для всех"
add: "Добавить"
reaction: "Реакции"
reactions: "Реакции"
reactionSetting: "Реакции, отображаемые в палитре"
reactionSettingDescription2: "Расставляйте перетаскиванием, удаляйте нажатием, добавляйте кнопкой «+»."
rememberNoteVisibility: "Запоминать видимость заметок"
Expand Down
1 change: 1 addition & 0 deletions locales/sk-SK.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Kliknutím zobrazíte"
sensitive: "NSFW"
add: "Pridať"
reaction: "Reakcie"
reactions: "Reakcie"
reactionSetting: "Reakcie zobrazené vo výbere reakcií"
reactionSettingDescription2: "Ťahaním preusporiadate, kliknutím odstránite, Stlačením \"+\" pridáte"
rememberNoteVisibility: "Zapamätať nastavenia viditeľnosti poznámky"
Expand Down
1 change: 1 addition & 0 deletions locales/sv-SE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ clickToShow: "Klicka för att visa"
sensitive: "Känsligt innehåll"
add: "Lägg till"
reaction: "Reaktioner"
reactions: "Reaktioner"
reactionSetting: "Reaktioner som ska visas i reaktionsväljaren"
reactionSettingDescription2: "Dra för att omordna, klicka för att radera, tryck \"+\" för att lägga till."
rememberNoteVisibility: "Komihåg notvisningsinställningar"
Expand Down
1 change: 1 addition & 0 deletions locales/th-TH.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "คลิกเพื่อแสดง"
sensitive: "เนื้อหาที่ละเอียดอ่อน NSFW"
add: "เพิ่ม"
reaction: "รีแอคชั่น"
reactions: "รีแอคชั่น"
reactionSetting: "รีแอคชั่นไปยังแสดงผลในตัวเลือกการรีแอคชั่น"
reactionSettingDescription2: "กดลากเพื่อจัดลำดับใหม่ กดคลิกเพื่อลบ กด \"+\" เพื่อเพิ่ม"
rememberNoteVisibility: "จดจำการตั้งค่าการมองเห็นตัวโน้ต"
Expand Down
1 change: 1 addition & 0 deletions locales/uk-UA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Натисніть для перегляду"
sensitive: "NSFW"
add: "Додати"
reaction: "Реакції"
reactions: "Реакції"
reactionSetting: "Налаштування реакцій"
reactionSettingDescription2: "Перемістити щоб змінити порядок, Клацнути мишою щоб видалити, Натиснути \"+\" щоб додати."
rememberNoteVisibility: "Пам’ятати параметри видимісті"
Expand Down
1 change: 1 addition & 0 deletions locales/vi-VN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "Nhấn để xem"
sensitive: "Nhạy cảm"
add: "Thêm"
reaction: "Biểu cảm"
reactions: "Biểu cảm"
reactionSetting: "Chọn những biểu cảm hiển thị"
reactionSettingDescription2: "Kéo để sắp xếp, nhấn để xóa, nhấn \"+\" để thêm."
rememberNoteVisibility: "Lưu kiểu tút mặc định"
Expand Down
1 change: 1 addition & 0 deletions locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "点击以显示"
sensitive: "敏感内容"
add: "添加"
reaction: "回应"
reactions: "回应"
reactionSetting: "在选择器中显示的回应"
reactionSettingDescription2: "拖动重新排序,单击删除,点击 + 添加。"
rememberNoteVisibility: "保存上次设置的可见性"
Expand Down
1 change: 1 addition & 0 deletions locales/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ clickToShow: "按一下以顯示"
sensitive: "敏感內容"
add: "新增"
reaction: "情感"
reactions: "情感"
reactionSetting: "在選擇器中顯示反應"
reactionSettingDescription2: "拖動以重新列序,點擊以刪除,按下 + 添加。"
rememberNoteVisibility: "記住貼文可見性"
Expand Down
100 changes: 100 additions & 0 deletions packages/client/src/components/MkReactedUsersDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<template>
<MkModalWindow
ref="dialog"
:width="400"
:height="450"
@close="dialog.close()"
@closed="emit('closed')"
>
<template #header>{{ i18n.ts.reactions }}</template>

<MkSpacer :margin-min="20" :margin-max="28">
<div v-if="note" class="mk-reacted-users-dialog _gaps">
<div v-if="reactions.length === 0" class="_fullinfo">
<img src="https://xn--931a.moe/assets/info.jpg" class="_ghost"/>
<div>{{ i18n.ts.nothing }}</div>
</div>
<template v-else>
<div class="tabs">
<button v-for="reaction in reactions" :key="reaction" class="tab _button" :class="{ tabActive: tab === reaction }" @click="tab = reaction">
<MkReactionIcon :reaction="reaction" :custom-emojis="note.emojis"/>
<span style="margin-left: 4px;">{{ note.reactions[reaction] }}</span>
</button>
</div>
<MkA v-for="user in users" :key="user.id" :to="userPage(user)">
<MkUserCardMini :user="user" :with-chart="false"/>
</MkA>
</template>
</div>
<div v-else>
<MkLoading/>
</div>
</MkSpacer>
</MkModalWindow>
</template>

<script lang="ts" setup>
import { onMounted, watch } from 'vue';
import * as misskey from 'misskey-js';
import MkModalWindow from '@/components/MkModalWindow.vue';
import MkReactionIcon from '@/components/MkReactionIcon.vue';
import MkUserCardMini from '@/components/MkUserCardMini.vue';
import { userPage } from '@/filters/user';
import { i18n } from '@/i18n';
import * as os from '@/os';
const emit = defineEmits<{
(ev: 'closed'): void,
}>();
const props = defineProps<{
noteId: misskey.entities.Note['id'];
}>();
const dialog = $shallowRef<InstanceType<typeof MkModalWindow>>();
let note = $ref<misskey.entities.Note>();
let tab = $ref<string>();
let reactions = $ref<string[]>();
let users = $ref();
watch($$(tab), async () => {
const res = await os.api('notes/reactions', {
noteId: props.noteId,
type: tab,
limit: 30,
});
users = res.map(x => x.user);
});
onMounted(() => {
os.api('notes/show', {
noteId: props.noteId,
}).then((res) => {
reactions = Object.keys(res.reactions);
tab = reactions[0];
note = res;
});
});
</script>

<style lang="scss" scoped>
.mk-reacted-users-dialog {
.tabs {
display: flex;
gap: 8px;
flex-wrap: wrap;
.tab {
padding: 4px 6px;
border: solid 1px var(--divider);
border-radius: 6px;
&.tabActive {
border-color: var(--accent);
}
}
}
}
</style>
20 changes: 14 additions & 6 deletions packages/client/src/components/MkUserCardMini.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,28 @@

<script lang="ts" setup>
import * as misskey from 'misskey-js';
import { onMounted } from 'vue';
import MkMiniChart from '@/components/MkMiniChart.vue';
import * as os from '@/os';
import { acct } from '@/filters/user';
const props = defineProps<{
const props = withDefaults(defineProps<{
user: misskey.entities.User;
}>();
withChart: boolean;
}>(), {
withChart: true,
});
let chartValues = $ref<number[] | null>(null);
os.apiGet('charts/user/notes', { userId: props.user.id, limit: 16 + 1, span: 'day' }).then(res => {
// 今日のぶんの値はまだ途中の値であり、それも含めると大抵の場合前日よりも下降しているようなグラフになってしまうため今日は弾く
res.inc.splice(0, 1);
chartValues = res.inc;
onMounted(() => {
if (props.withChart) {
os.apiGet('charts/user/notes', { userId: props.user.id, limit: 16 + 1, span: 'day' }).then(res => {
// 今日のぶんの値はまだ途中の値であり、それも含めると大抵の場合前日よりも下降しているようなグラフになってしまうため今日は弾く
res.inc.splice(0, 1);
chartValues = res.inc;
});
}
});
</script>

Expand Down
13 changes: 11 additions & 2 deletions packages/client/src/scripts/get-note-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ export function getNoteMenu(props: {
});
}

function showReactions(): void {
os.popup(defineAsyncComponent(() => import('@/components/MkReactedUsersDialog.vue')), {
noteId: appearNote.id,
}, {}, 'closed');
}

async function translate(): Promise<void> {
if (props.translation.value != null) return;
props.translating.value = true;
Expand All @@ -204,8 +210,11 @@ export function getNoteMenu(props: {
danger: true,
action: unclip,
}, null] : []
),
{
), {
icon: 'ti ti-users',
text: i18n.ts.reactions,
action: showReactions,
}, {
icon: 'ti ti-copy',
text: i18n.ts.copyContent,
action: copyContent,
Expand Down

0 comments on commit ebd317c

Please sign in to comment.