rudeshark.net/packages/client/src/components/MkQuoteButton.vue

57 lines
1015 B
Vue
Raw Normal View History

2022-09-28 18:22:03 +02:00
<template>
2023-04-08 02:01:42 +02:00
<button
v-if="canRenote && $store.state.seperateRenoteQuote"
v-tooltip.noDelay.bottom="i18n.ts.quote"
class="eddddedb _button"
@click="quote()"
>
<i class="ph-quotes ph-bold ph-lg"></i>
</button>
2022-09-28 18:22:03 +02:00
</template>
<script lang="ts" setup>
2023-04-08 02:01:42 +02:00
import { computed } from "vue";
import type { Note } from "calckey-js/built/entities";
import { pleaseLogin } from "@/scripts/please-login";
import * as os from "@/os";
import { $i } from "@/account";
import { i18n } from "@/i18n";
2022-09-28 18:22:03 +02:00
const props = defineProps<{
note: Note;
}>();
2023-04-08 02:01:42 +02:00
const canRenote = computed(
() =>
["public", "home"].includes(props.note.visibility) ||
props.note.userId === $i?.id
);
2022-09-28 18:22:03 +02:00
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>