feat: 🎨 add ripple to star react
This commit is contained in:
parent
515ccfecb1
commit
c1ee6140fc
|
@ -1,11 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<button class="skdfgljsdkf _button" @click="star()">
|
<button class="skdfgljsdkf _button" @click="star($event)">
|
||||||
<i class="fas fa-star"></i>
|
<i class="fas fa-star"></i>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { Note } from 'misskey-js/built/entities';
|
import type { Note } from 'misskey-js/built/entities';
|
||||||
|
import Ripple from '@/components/MkRipple.vue';
|
||||||
import { pleaseLogin } from '@/scripts/please-login';
|
import { pleaseLogin } from '@/scripts/please-login';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
|
|
||||||
|
@ -13,12 +14,19 @@ const props = defineProps<{
|
||||||
note: Note;
|
note: Note;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
function star(): void {
|
function star(ev?: MouseEvent): void {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
os.api('notes/reactions/create', {
|
os.api('notes/reactions/create', {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
reaction: '⭐',
|
reaction: '⭐',
|
||||||
});
|
});
|
||||||
|
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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,9 @@ os.api('admin/abuse-user-reports', {
|
||||||
});
|
});
|
||||||
|
|
||||||
os.api('latest-version').then(res => {
|
os.api('latest-version').then(res => {
|
||||||
const cleanRes = parseInt(res?.tag_name.replace(/[^0-9]/g, ''), 10);
|
const cleanRes = res?.tag_name.replace(/[^0-9]/g, '');
|
||||||
const cleanVersion = parseInt(version.replace(/[^0-9]/g, ''), 10);
|
const cleanVersion = version.replace(/[^0-9]/g, '');
|
||||||
if (cleanRes > cleanVersion) {
|
if (cleanRes !== cleanVersion) {
|
||||||
updateAvailable = true;
|
updateAvailable = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue