2022-10-25 21:20:41 -06:00
|
|
|
<template>
|
2022-11-26 22:37:23 -07:00
|
|
|
<button v-tooltip.noDelay.bottom="i18n.ts._gallery.like" class="skdfgljsdkf _button" @click="star($event)">
|
2022-11-06 19:49:47 -07:00
|
|
|
<i class="ph-star-bold ph-lg"></i>
|
2022-10-25 21:20:41 -06:00
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2022-12-12 11:19:18 -07:00
|
|
|
import type { Note } from 'calckey-js/built/entities';
|
2022-10-25 21:33:09 -06:00
|
|
|
import Ripple from '@/components/MkRipple.vue';
|
2022-10-25 21:20:41 -06:00
|
|
|
import { pleaseLogin } from '@/scripts/please-login';
|
|
|
|
import * as os from '@/os';
|
2022-11-26 22:37:23 -07:00
|
|
|
import { i18n } from '@/i18n';
|
2022-11-25 04:46:10 -07:00
|
|
|
|
2022-10-25 21:20:41 -06:00
|
|
|
const props = defineProps<{
|
|
|
|
note: Note;
|
|
|
|
}>();
|
|
|
|
|
2022-10-25 21:33:09 -06:00
|
|
|
function star(ev?: MouseEvent): void {
|
2022-10-25 21:20:41 -06:00
|
|
|
pleaseLogin();
|
|
|
|
os.api('notes/reactions/create', {
|
|
|
|
noteId: props.note.id,
|
|
|
|
reaction: '⭐',
|
|
|
|
});
|
2022-10-25 21:33:09 -06:00
|
|
|
const el = ev && (ev.currentTarget ?? ev.target) as HTMLElement | null | undefined;
|
|
|
|
if (el) {
|
|
|
|
const rect = el.getBoundingClientRect();
|
|
|
|
const x = rect.left + (el.offsetWidth / 2);
|
|
|
|
const y = rect.top + (el.offsetHeight / 2);
|
|
|
|
os.popup(Ripple, { x, y }, {}, 'end');
|
|
|
|
}
|
2022-10-25 21:20:41 -06:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.skdfgljsdkf {
|
|
|
|
display: inline-block;
|
|
|
|
height: 32px;
|
|
|
|
margin: 2px;
|
|
|
|
padding: 0 6px;
|
|
|
|
}
|
|
|
|
</style>
|