2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-09-17 15:39:15 +02:00
|
|
|
<template>
|
2023-10-24 09:55:22 +02:00
|
|
|
<button v-if="request" class="_button emoji-request" :class="$style.root" @click="menu">
|
2023-10-21 09:29:09 +02:00
|
|
|
<img :src="emoji.url" :class="$style.img" loading="lazy"/>
|
2023-05-16 17:44:19 +02:00
|
|
|
<div class="body">
|
2023-10-24 09:55:22 +02:00
|
|
|
<div class="name _monospace">{{ emoji.name + ' (request)' }}</div>
|
2023-05-16 17:44:19 +02:00
|
|
|
<div class="info">{{ emoji.aliases.join(' ') }}</div>
|
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
<button v-else class="_button" :class="$style.root" @click="menu">
|
2023-05-19 09:20:53 +02:00
|
|
|
<img :src="emoji.url" :class="$style.img" loading="lazy"/>
|
|
|
|
<div :class="$style.body">
|
2023-10-21 09:29:09 +02:00
|
|
|
<div class="name _monospace">{{ emoji.name }}</div>
|
|
|
|
<div class="info">{{ emoji.aliases.join(' ') }}</div>
|
2021-09-17 15:39:15 +02:00
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
|
2022-01-12 18:36:51 +01:00
|
|
|
<script lang="ts" setup>
|
2023-09-19 09:37:43 +02:00
|
|
|
import * as os from '@/os.js';
|
2024-01-13 07:25:11 +01:00
|
|
|
import * as Misskey from 'misskey-js';
|
2024-01-04 10:32:46 +01:00
|
|
|
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
2023-09-19 09:37:43 +02:00
|
|
|
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
2024-01-13 07:25:11 +01:00
|
|
|
import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialog.vue';
|
2021-09-17 15:39:15 +02:00
|
|
|
|
2022-01-12 18:36:51 +01:00
|
|
|
const props = defineProps<{
|
2024-01-13 07:25:11 +01:00
|
|
|
emoji: Misskey.entities.EmojiSimple;
|
2023-10-24 09:55:22 +02:00
|
|
|
request?: boolean;
|
2022-01-12 18:36:51 +01:00
|
|
|
}>();
|
2021-09-17 15:39:15 +02:00
|
|
|
|
2022-01-12 18:36:51 +01:00
|
|
|
function menu(ev) {
|
|
|
|
os.popupMenu([{
|
|
|
|
type: 'label',
|
|
|
|
text: ':' + props.emoji.name + ':',
|
|
|
|
}, {
|
2022-01-28 03:39:49 +01:00
|
|
|
text: i18n.ts.copy,
|
2022-12-19 11:01:30 +01:00
|
|
|
icon: 'ti ti-copy',
|
2022-01-12 18:36:51 +01:00
|
|
|
action: () => {
|
|
|
|
copyToClipboard(`:${props.emoji.name}:`);
|
|
|
|
os.success();
|
2022-12-22 08:01:59 +01:00
|
|
|
},
|
2023-03-17 12:24:47 +01:00
|
|
|
}, {
|
|
|
|
text: i18n.ts.info,
|
|
|
|
icon: 'ti ti-info-circle',
|
2024-01-13 07:25:11 +01:00
|
|
|
action: async () => {
|
|
|
|
os.popup(MkCustomEmojiDetailedDialog, {
|
|
|
|
emoji: await misskeyApiGet('emoji', {
|
|
|
|
name: props.emoji.name,
|
|
|
|
})
|
|
|
|
}, {
|
|
|
|
anchor: ev.target,
|
2023-03-17 12:24:47 +01:00
|
|
|
});
|
|
|
|
},
|
2022-01-28 03:53:12 +01:00
|
|
|
}], ev.currentTarget ?? ev.target);
|
2022-01-12 18:36:51 +01:00
|
|
|
}
|
2021-09-17 15:39:15 +02:00
|
|
|
</script>
|
|
|
|
|
2023-05-19 09:20:53 +02:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2023-10-21 09:29:09 +02:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 12px;
|
|
|
|
text-align: left;
|
|
|
|
background: var(--panel);
|
|
|
|
border-radius: 8px;
|
2021-09-17 15:39:15 +02:00
|
|
|
|
2023-10-21 09:29:09 +02:00
|
|
|
&:hover {
|
|
|
|
border-color: var(--accent);
|
|
|
|
}
|
2023-05-19 09:20:53 +02:00
|
|
|
}
|
2021-09-17 15:39:15 +02:00
|
|
|
|
2023-05-19 09:20:53 +02:00
|
|
|
.img {
|
2023-10-21 09:29:09 +02:00
|
|
|
width: 42px;
|
|
|
|
height: 42px;
|
|
|
|
object-fit: contain;
|
2023-05-19 09:20:53 +02:00
|
|
|
}
|
2021-09-17 15:39:15 +02:00
|
|
|
|
2023-05-19 09:20:53 +02:00
|
|
|
.body {
|
2023-10-21 09:29:09 +02:00
|
|
|
padding: 0 0 0 8px;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
2023-05-19 09:20:53 +02:00
|
|
|
}
|
2021-09-17 15:39:15 +02:00
|
|
|
|
2023-05-19 09:20:53 +02:00
|
|
|
.name {
|
2023-10-21 09:29:09 +02:00
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
2023-05-19 09:20:53 +02:00
|
|
|
}
|
2021-09-17 15:39:15 +02:00
|
|
|
|
2023-05-19 09:20:53 +02:00
|
|
|
.info {
|
2023-10-21 09:29:09 +02:00
|
|
|
opacity: 0.5;
|
|
|
|
font-size: 0.9em;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
2021-09-17 15:39:15 +02:00
|
|
|
}
|
2023-05-16 17:44:19 +02:00
|
|
|
|
2023-10-24 09:55:22 +02:00
|
|
|
.emoji-request {
|
2023-10-21 09:29:09 +02:00
|
|
|
--c: rgb(255 196 0 / 15%);;
|
|
|
|
background-image: linear-gradient(45deg,var(--c) 16.67%,transparent 16.67%,transparent 50%,var(--c) 50%,var(--c) 66.67%,transparent 66.67%,transparent 100%);
|
|
|
|
background-size: 16px 16px;
|
2023-05-16 17:44:19 +02:00
|
|
|
}
|
2021-09-17 15:39:15 +02:00
|
|
|
</style>
|