mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
feat: ✨ Add more preferences
This commit is contained in:
parent
5203f47409
commit
bb5de77bb1
6 changed files with 123 additions and 19 deletions
|
|
@ -27,6 +27,8 @@
|
|||
import { Ellipsis, Heart, Quote, Repeat, Reply } from "lucide-vue-next";
|
||||
import { toast } from "vue-sonner";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { SettingIds } from "~/settings";
|
||||
import { confirmModalService } from "../modals/composable";
|
||||
import Menu from "./menu.vue";
|
||||
|
||||
const { noteId } = defineProps<{
|
||||
|
|
@ -50,7 +52,23 @@ const emit = defineEmits<{
|
|||
delete: [];
|
||||
}>();
|
||||
|
||||
const confirmLikes = useSetting(SettingIds.ConfirmLike);
|
||||
const confirmReblogs = useSetting(SettingIds.ConfirmReblog);
|
||||
|
||||
const like = async () => {
|
||||
if (confirmLikes.value.value) {
|
||||
const confirmation = await confirmModalService.confirm({
|
||||
title: "Like status",
|
||||
message: "Are you sure you want to like this status?",
|
||||
confirmText: "Like",
|
||||
inputType: "none",
|
||||
});
|
||||
|
||||
if (!confirmation.confirmed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const id = toast.loading("Liking status...");
|
||||
const { data } = await client.value.favouriteStatus(noteId);
|
||||
toast.dismiss(id);
|
||||
|
|
@ -59,6 +77,19 @@ const like = async () => {
|
|||
};
|
||||
|
||||
const unlike = async () => {
|
||||
if (confirmLikes.value.value) {
|
||||
const confirmation = await confirmModalService.confirm({
|
||||
title: "Unlike status",
|
||||
message: "Are you sure you want to unlike this status?",
|
||||
confirmText: "Unlike",
|
||||
inputType: "none",
|
||||
});
|
||||
|
||||
if (!confirmation.confirmed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const id = toast.loading("Unliking status...");
|
||||
const { data } = await client.value.unfavouriteStatus(noteId);
|
||||
toast.dismiss(id);
|
||||
|
|
@ -67,6 +98,19 @@ const unlike = async () => {
|
|||
};
|
||||
|
||||
const reblog = async () => {
|
||||
if (confirmReblogs.value.value) {
|
||||
const confirmation = await confirmModalService.confirm({
|
||||
title: "Reblog status",
|
||||
message: "Are you sure you want to reblog this status?",
|
||||
confirmText: "Reblog",
|
||||
inputType: "none",
|
||||
});
|
||||
|
||||
if (!confirmation.confirmed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const id = toast.loading("Reblogging status...");
|
||||
const { data } = await client.value.reblogStatus(noteId);
|
||||
toast.dismiss(id);
|
||||
|
|
@ -75,6 +119,19 @@ const reblog = async () => {
|
|||
};
|
||||
|
||||
const unreblog = async () => {
|
||||
if (confirmReblogs.value.value) {
|
||||
const confirmation = await confirmModalService.confirm({
|
||||
title: "Unreblog status",
|
||||
message: "Are you sure you want to unreblog this status?",
|
||||
confirmText: "Unreblog",
|
||||
inputType: "none",
|
||||
});
|
||||
|
||||
if (!confirmation.confirmed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const id = toast.loading("Unreblogging status...");
|
||||
const { data } = await client.value.unreblogStatus(noteId);
|
||||
toast.dismiss(id);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import {
|
|||
} from "lucide-vue-next";
|
||||
import { toast } from "vue-sonner";
|
||||
import { confirmModalService } from "~/components/modals/composable.ts";
|
||||
import { SettingIds } from "~/settings";
|
||||
|
||||
const { authorId, noteId } = defineProps<{
|
||||
apiNoteString: string;
|
||||
|
|
@ -40,6 +41,8 @@ const { copy } = useClipboard();
|
|||
const loggedIn = !!identity.value;
|
||||
const authorIsMe = loggedIn && authorId === identity.value?.account.id;
|
||||
|
||||
const confirmDeletes = useSetting(SettingIds.ConfirmDelete);
|
||||
|
||||
const copyText = (text: string) => {
|
||||
copy(text);
|
||||
toast.success("Copied to clipboard");
|
||||
|
|
@ -54,15 +57,17 @@ const blockUser = async (userId: string) => {
|
|||
};
|
||||
|
||||
const _delete = async () => {
|
||||
const confirmation = await confirmModalService.confirm({
|
||||
title: "Delete status",
|
||||
message: "Are you sure you want to delete this status?",
|
||||
confirmText: "Delete",
|
||||
inputType: "none",
|
||||
});
|
||||
if (confirmDeletes.value.value) {
|
||||
const confirmation = await confirmModalService.confirm({
|
||||
title: "Delete status",
|
||||
message: "Are you sure you want to delete this status?",
|
||||
confirmText: "Delete",
|
||||
inputType: "none",
|
||||
});
|
||||
|
||||
if (!confirmation.confirmed) {
|
||||
return;
|
||||
if (!confirmation.confirmed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const id = toast.loading("Deleting status...");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue