Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/emoji import #14

Merged
merged 3 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4916,6 +4916,14 @@ export interface Locale extends ILocale {
* QRコード
*/
"qrcode": string;
/**
* このQRコードをスキャンすると、新規登録時の招待コードが自動で入力されます。
*/
"qrcodeToInvite": string;
/**
* 指定された絵文字は既に存在します。
*/
"emojiAlreadyExists": string;
"_bubbleGame": {
/**
* 遊び方
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,8 @@ loading: "読み込み中"
surrender: "やめる"
gameRetry: "リトライ"
qrcode: "QRコード"
qrcodeToInvite: "このQRコードをスキャンすると、新規登録時の招待コードが自動で入力されます。"
emojiAlreadyExists: "指定された絵文字は既に存在します。"

_bubbleGame:
howToPlay: "遊び方"
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkInviteCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkButton v-if="!invite.used || moderator" danger rounded @click="deleteCode()"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div>
<div v-if="!invite.used && !isExpired">
<div :class="$style.label">{{ i18n.ts.qrcode }}</div>
<div :class="$style.label">{{ i18n.ts.qrcode }} - {{ i18n.ts.qrcodeToInvite }}</div>
<vue-qrcode :value="inviteUrl" :options="option" tag="img"></vue-qrcode>
</div>
</div>
Expand Down
27 changes: 20 additions & 7 deletions packages/frontend/src/components/global/MkCustomEmoji.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,17 @@ const importEmoji = async (emojiName) => {
query: emojiName,
host: props.host,
})).find((_emoji) => _emoji.name === emojiName);
await os.apiWithDialog('admin/emoji/copy', {
emojiId: emoji.id,
if (emoji) {
await os.apiWithDialog('admin/emoji/copy', {
emojiId: emoji.id,
});
}
} else {
os.alert({
title: i18n.ts.error,
text: i18n.ts.emojiAlreadyExists,
});
}

// リアクション
react(`:${emojiName}:`);
sound.playMisskeySfx('reaction');
};

function onClick(ev: MouseEvent) {
Expand All @@ -111,10 +114,20 @@ function onClick(ev: MouseEvent) {
os.success();
},
}, ...(props.menuImport && react ? [{
text: i18n.ts.import,
icon: 'ti ti-download',
action: () => {
importEmoji(props.name);
},
}, {
text: i18n.ts.doReaction,
icon: 'ti ti-plus',
action: () => {
importEmoji(props.name);
importEmoji(props.name).then(() => {
// リアクション
react(`:${props.name}:`);
sound.playMisskeySfx('reaction');
});
},
}] : []),
], ev.currentTarget ?? ev.target);
Expand Down
Loading