iceshrimp/packages/client/src/components/MkQuoteButton.vue

53 lines
997 B
Vue
Raw Normal View History

2022-09-29 01:22:03 +09:00
<template>
<button
v-if="canRenote && $store.state.seperateRenoteQuote"
2022-11-25 20:46:10 +09:00
v-tooltip.noDelay.bottom="i18n.ts.quote"
2022-11-27 14:37:23 +09:00
class="eddddedb _button"
2022-09-29 01:22:03 +09:00
@click="quote()"
>
2022-11-07 11:49:47 +09:00
<i class="ph-quotes-bold ph-lg"></i>
2022-09-29 01:22:03 +09:00
</button>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
2022-09-30 11:01:14 +09:00
import type { Note } from 'misskey-js/built/entities';
2022-09-29 01:22:03 +09:00
import { pleaseLogin } from '@/scripts/please-login';
import * as os from '@/os';
import { $i } from '@/account';
2022-11-25 20:46:10 +09:00
import { i18n } from '@/i18n';
2022-09-29 01:22:03 +09:00
const props = defineProps<{
note: Note;
}>();
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i?.id);
function quote(): void {
pleaseLogin();
os.post({
renote: props.note,
});
}
</script>
<style lang="scss" scoped>
.eddddedb {
display: inline-block;
height: 32px;
margin: 2px;
padding: 0 6px;
border-radius: 4px;
&.renoted {
background: var(--accent);
}
> .count {
display: inline;
margin-left: 8px;
opacity: 0.7;
}
}
</style>