Skip to content

Commit ced08ff

Browse files
authored
Merge pull request #14 from sweshelo/feat/emoji-import
Feat/emoji import
2 parents b6225e1 + ba509ba commit ced08ff

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

locales/index.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -4916,6 +4916,14 @@ export interface Locale extends ILocale {
49164916
* QRコード
49174917
*/
49184918
"qrcode": string;
4919+
/**
4920+
* このQRコードをスキャンすると、新規登録時の招待コードが自動で入力されます。
4921+
*/
4922+
"qrcodeToInvite": string;
4923+
/**
4924+
* 指定された絵文字は既に存在します。
4925+
*/
4926+
"emojiAlreadyExists": string;
49194927
"_bubbleGame": {
49204928
/**
49214929
* 遊び方

locales/ja-JP.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,8 @@ loading: "読み込み中"
12251225
surrender: "やめる"
12261226
gameRetry: "リトライ"
12271227
qrcode: "QRコード"
1228+
qrcodeToInvite: "このQRコードをスキャンすると、新規登録時の招待コードが自動で入力されます。"
1229+
emojiAlreadyExists: "指定された絵文字は既に存在します。"
12281230

12291231
_bubbleGame:
12301232
howToPlay: "遊び方"

packages/frontend/src/components/MkInviteCode.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ SPDX-License-Identifier: AGPL-3.0-only
5555
<MkButton v-if="!invite.used || moderator" danger rounded @click="deleteCode()"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
5656
</div>
5757
<div v-if="!invite.used && !isExpired">
58-
<div :class="$style.label">{{ i18n.ts.qrcode }}</div>
58+
<div :class="$style.label">{{ i18n.ts.qrcode }} - {{ i18n.ts.qrcodeToInvite }}</div>
5959
<vue-qrcode :value="inviteUrl" :options="option" tag="img"></vue-qrcode>
6060
</div>
6161
</div>

packages/frontend/src/components/global/MkCustomEmoji.vue

+20-7
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,17 @@ const importEmoji = async (emojiName) => {
8787
query: emojiName,
8888
host: props.host,
8989
})).find((_emoji) => _emoji.name === emojiName);
90-
await os.apiWithDialog('admin/emoji/copy', {
91-
emojiId: emoji.id,
90+
if (emoji) {
91+
await os.apiWithDialog('admin/emoji/copy', {
92+
emojiId: emoji.id,
93+
});
94+
}
95+
} else {
96+
os.alert({
97+
title: i18n.ts.error,
98+
text: i18n.ts.emojiAlreadyExists,
9299
});
93100
}
94-
95-
// リアクション
96-
react(`:${emojiName}:`);
97-
sound.playMisskeySfx('reaction');
98101
};
99102

100103
function onClick(ev: MouseEvent) {
@@ -111,10 +114,20 @@ function onClick(ev: MouseEvent) {
111114
os.success();
112115
},
113116
}, ...(props.menuImport && react ? [{
117+
text: i18n.ts.import,
118+
icon: 'ti ti-download',
119+
action: () => {
120+
importEmoji(props.name);
121+
},
122+
}, {
114123
text: i18n.ts.doReaction,
115124
icon: 'ti ti-plus',
116125
action: () => {
117-
importEmoji(props.name);
126+
importEmoji(props.name).then(() => {
127+
// リアクション
128+
react(`:${props.name}:`);
129+
sound.playMisskeySfx('reaction');
130+
});
118131
},
119132
}] : []),
120133
], ev.currentTarget ?? ev.target);

0 commit comments

Comments
 (0)