added onClick events for marker-cluster
This commit is contained in:
@@ -3,6 +3,8 @@ import { ChatMessage } from "@repo/db";
|
||||
import { socket } from "dispatch/socket";
|
||||
|
||||
interface ChatStore {
|
||||
reportTabOpen: boolean;
|
||||
setReportTabOpen: (open: boolean) => void;
|
||||
ownId: null | string;
|
||||
selectedChat: string | null;
|
||||
chatOpen: boolean;
|
||||
@@ -20,6 +22,8 @@ interface ChatStore {
|
||||
}
|
||||
|
||||
export const useChatStore = create<ChatStore>((set, get) => ({
|
||||
reportTabOpen: false,
|
||||
setReportTabOpen: (open: boolean) => set({ reportTabOpen: open }),
|
||||
ownId: null,
|
||||
chatOpen: false,
|
||||
selectedChat: null,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { popup } from "leaflet";
|
||||
import { create } from "zustand";
|
||||
|
||||
interface MapStore {
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
import { create } from "zustand";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
interface ReportStore {
|
||||
ownId: null | string;
|
||||
reportOpen: boolean;
|
||||
setReportOpen: (open: boolean) => void;
|
||||
setOwnId: (id: string) => void;
|
||||
}
|
||||
|
||||
export const useReportStore = create<ReportStore>((set) => ({
|
||||
ownId: null,
|
||||
reportOpen: false,
|
||||
setReportOpen: (open: boolean) => set({ reportOpen: open }),
|
||||
setOwnId: (id: string) => set({ ownId: id }),
|
||||
}));
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
export const sendReport = async (receiverId: string, message: string) => {
|
||||
try {
|
||||
await prisma.reportMessage.create({
|
||||
data: {
|
||||
receiverId,
|
||||
message,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Failed to send report:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user