mirror of
https://codeberg.org/yeentown/barkey
synced 2024-12-05 04:27:26 +00:00
fa9c4a19b9
* refactor(frontend): os.tsに引き込んだscripts/api.tsの再exportをやめる * fix * fix * renate to "misskeyApi" * rename file
95 lines
1.9 KiB
Vue
95 lines
1.9 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<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>
|
|
</div>
|
|
</button>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { } from 'vue';
|
|
import * as os from '@/os.js';
|
|
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
|
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
const props = defineProps<{
|
|
emoji: {
|
|
name: string;
|
|
aliases: string[];
|
|
category: string;
|
|
url: string;
|
|
};
|
|
}>();
|
|
|
|
function menu(ev) {
|
|
os.popupMenu([{
|
|
type: 'label',
|
|
text: ':' + props.emoji.name + ':',
|
|
}, {
|
|
text: i18n.ts.copy,
|
|
icon: 'ti ti-copy',
|
|
action: () => {
|
|
copyToClipboard(`:${props.emoji.name}:`);
|
|
os.success();
|
|
},
|
|
}, {
|
|
text: i18n.ts.info,
|
|
icon: 'ti ti-info-circle',
|
|
action: () => {
|
|
misskeyApiGet('emoji', { name: props.emoji.name }).then(res => {
|
|
os.alert({
|
|
type: 'info',
|
|
text: `Name: ${res.name}\nAliases: ${res.aliases.join(' ')}\nCategory: ${res.category}\nisSensitive: ${res.isSensitive}\nlocalOnly: ${res.localOnly}\nLicense: ${res.license}\nURL: ${res.url}`,
|
|
});
|
|
});
|
|
},
|
|
}], ev.currentTarget ?? ev.target);
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.root {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 12px;
|
|
text-align: left;
|
|
background: var(--panel);
|
|
border-radius: 8px;
|
|
|
|
&:hover {
|
|
border-color: var(--accent);
|
|
}
|
|
}
|
|
|
|
.img {
|
|
width: 42px;
|
|
height: 42px;
|
|
object-fit: contain;
|
|
}
|
|
|
|
.body {
|
|
padding: 0 0 0 8px;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.name {
|
|
text-overflow: ellipsis;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.info {
|
|
opacity: 0.5;
|
|
font-size: 0.9em;
|
|
text-overflow: ellipsis;
|
|
overflow: hidden;
|
|
}
|
|
</style>
|