2023-07-26 22:31:52 -07:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-09-17 06:39:15 -07:00
|
|
|
<template>
|
2023-05-19 00:20:53 -07:00
|
|
|
<button class="_button" :class="$style.root" @click="menu">
|
|
|
|
<img :src="emoji.url" :class="$style.img" loading="lazy"/>
|
|
|
|
<div :class="$style.body">
|
|
|
|
<div :class="$style.name" class="_monospace">{{ emoji.name }}</div>
|
|
|
|
<div :class="$style.info">{{ emoji.aliases.join(' ') }}</div>
|
2021-09-17 06:39:15 -07:00
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
|
2022-01-12 09:36:51 -08:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2023-09-19 00:37:43 -07:00
|
|
|
import * as os from '@/os.js';
|
2024-01-04 01:32:46 -08:00
|
|
|
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
2023-09-19 00:37:43 -07:00
|
|
|
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
2021-09-17 06:39:15 -07:00
|
|
|
|
2022-01-12 09:36:51 -08:00
|
|
|
const props = defineProps<{
|
2023-01-22 23:19:13 -08:00
|
|
|
emoji: {
|
|
|
|
name: string;
|
|
|
|
aliases: string[];
|
|
|
|
category: string;
|
|
|
|
url: string;
|
|
|
|
};
|
2022-01-12 09:36:51 -08:00
|
|
|
}>();
|
2021-09-17 06:39:15 -07:00
|
|
|
|
2022-01-12 09:36:51 -08:00
|
|
|
function menu(ev) {
|
|
|
|
os.popupMenu([{
|
|
|
|
type: 'label',
|
|
|
|
text: ':' + props.emoji.name + ':',
|
|
|
|
}, {
|
2022-01-27 18:39:49 -08:00
|
|
|
text: i18n.ts.copy,
|
2022-12-19 02:01:30 -08:00
|
|
|
icon: 'ti ti-copy',
|
2022-01-12 09:36:51 -08:00
|
|
|
action: () => {
|
|
|
|
copyToClipboard(`:${props.emoji.name}:`);
|
|
|
|
os.success();
|
2022-12-21 23:01:59 -08:00
|
|
|
},
|
2023-03-17 04:24:47 -07:00
|
|
|
}, {
|
|
|
|
text: i18n.ts.info,
|
|
|
|
icon: 'ti ti-info-circle',
|
|
|
|
action: () => {
|
2024-01-04 01:32:46 -08:00
|
|
|
misskeyApiGet('emoji', { name: props.emoji.name }).then(res => {
|
2023-03-17 04:24:47 -07:00
|
|
|
os.alert({
|
|
|
|
type: 'info',
|
2023-11-29 21:59:42 -08:00
|
|
|
text: `Name: ${res.name}\nAliases: ${res.aliases.join(' ')}\nCategory: ${res.category}\nisSensitive: ${res.isSensitive}\nlocalOnly: ${res.localOnly}\nLicense: ${res.license}\nURL: ${res.url}`,
|
2023-03-17 04:24:47 -07:00
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
2022-01-27 18:53:12 -08:00
|
|
|
}], ev.currentTarget ?? ev.target);
|
2022-01-12 09:36:51 -08:00
|
|
|
}
|
2021-09-17 06:39:15 -07:00
|
|
|
</script>
|
|
|
|
|
2023-05-19 00:20:53 -07:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2021-09-17 06:39:15 -07:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 12px;
|
|
|
|
text-align: left;
|
|
|
|
background: var(--panel);
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
border-color: var(--accent);
|
|
|
|
}
|
2023-05-19 00:20:53 -07:00
|
|
|
}
|
2021-09-17 06:39:15 -07:00
|
|
|
|
2023-05-19 00:20:53 -07:00
|
|
|
.img {
|
|
|
|
width: 42px;
|
|
|
|
height: 42px;
|
|
|
|
object-fit: contain;
|
|
|
|
}
|
2021-09-17 06:39:15 -07:00
|
|
|
|
2023-05-19 00:20:53 -07:00
|
|
|
.body {
|
|
|
|
padding: 0 0 0 8px;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
2021-09-17 06:39:15 -07:00
|
|
|
|
2023-05-19 00:20:53 -07:00
|
|
|
.name {
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
2021-09-17 06:39:15 -07:00
|
|
|
|
2023-05-19 00:20:53 -07:00
|
|
|
.info {
|
|
|
|
opacity: 0.5;
|
|
|
|
font-size: 0.9em;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
2021-09-17 06:39:15 -07:00
|
|
|
}
|
|
|
|
</style>
|