Added part of RequestComment Componnet

master
YasamanKahdooei 2024-05-21 15:31:29 +03:30
parent a7f7da0e0b
commit cc5f57fdf2
9 changed files with 498 additions and 134 deletions

View File

@ -7,28 +7,6 @@ import ProgressBarProviders from "@/components/ProgressBar/ProgressBar";
const inter = Inter({ subsets: ["latin"] });
// mapboxgl.setRTLTextPlugin(
// "https://cdn.parsimap.ir/third-party/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js",
// null
// );
// mapboxgl.setRTLTextPlugin(
// "https://cdn.parsimap.ir/third-party/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js",
// (error) => {
// if (error) {
// console.error('Failed to load RTL text plugin:', error);
// }
// }
// );
// mapboxgl.setRTLTextPlugin(
// "https://cdn.parsimap.ir/third-party/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js",
// () => {}
// );
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",

View File

@ -5,8 +5,6 @@ import { useQuery } from "@tanstack/react-query";
import { ThreeDots } from "react-loader-spinner";
import ReactMapboxGl, { Marker, ZoomControl } from "react-mapbox-gl";
import marker from "@/assets/images/location.svg";
import RequestCard from "../Requests/RequestCard";
import { cn } from "@/lib/utils";
import mapboxgl from "mapbox-gl";
const accessToken = process.env.REACT_APP_ACCESS_TOKEN || "";
@ -18,7 +16,6 @@ const MapContainer = ReactMapboxGl({
accessToken: accessToken,
minZoom: 8,
maxZoom: 15,
// zoom: 9,
});
interface MyItemType {
@ -32,69 +29,53 @@ interface MyItemType {
latitude: number;
longitude: number;
}
const OnMapRequests = () => {
interface LocationData {
reportId: number;
longitude: number;
latitude: number;
}
const OnMapRequests: React.FC = () => {
const [selected, setSelected] = useState<any | null>(null);
const [citizenInstance, setCitizenInstance] = useState<MyItemType | null>(
null
);
const [locations, setLocations] = useState<any | null>(null);
const [citizenInstance, setCitizenInstance] = useState<MyItemType | null>(null);
const [locations, setLocations] = useState<LocationData[] | null>(null);
useEffect(() => {
const CtizenInstances = localStorage.getItem("SH_CT_INSTANCE");
if (CtizenInstances) {
const parsedItem = JSON.parse(CtizenInstances);
const parsedItem: MyItemType = JSON.parse(CtizenInstances);
setCitizenInstance(parsedItem);
}
}, [citizenInstance]);
}, []); // Remove citizenInstance from the dependency array
const defaultCoords = {
latitude: citizenInstance?.latitude || 0,
longitude: citizenInstance?.longitude || 0,
};
// refs
const detailsRef = useRef(null);
const wrappersRef = useRef(null);
// hooks
// const [detailsClicked, setDetailsClicked] = useClick({
// element: detailsRef,
// // whitelists,
// });
const detailsRef = useRef<HTMLDivElement | null>(null);
const wrappersRef = useRef<HTMLDivElement | null>(null);
// functions
// const showDetails = (request) => {
// setSelected(request);
// setDetailsClicked(true);
// };
const showDetails = () => {
// setSelected(request);
// setDetailsClicked(true);
};
// const onMapClicked = (e, x) => {
// setSelected(null);
// };
const showDetails = () => {};
const {
data: LocationData,
data: locationData,
isLoading,
isError,
isSuccess,
refetch,
} = useQuery({
queryKey: ["Locations"],
queryFn: () => getLocations(),
queryFn: getLocations,
refetchOnWindowFocus: false,
});
useEffect(() => {
if (LocationData) {
setLocations(LocationData?.data?.locations[0]?.locations);
if (locationData) {
setLocations(locationData?.data?.locations[0]?.locations);
}
}, [isSuccess]);
}, [locationData]); // Use locationData instead of isSuccess
return (
<div className="w-full h-full">
@ -115,34 +96,19 @@ const OnMapRequests = () => {
<MapContainer
center={[defaultCoords.longitude, defaultCoords.latitude]}
zoom={[10]}
containerStyle={{ height: "100%", width: "100%", borderRadius: 20 , direction: "rtl",}}
containerStyle={{
height: "100%",
width: "100%",
borderRadius: 20,
direction: "rtl",
}}
style={`https://api.parsimap.ir/styles/parsimap-streets-v11?key=${process.env.NEXT_PUBLIC_PMI_TOKEN}`}
// onClick={onMapClicked}
>
{locations?.map((d: any) => (
<Marker key={d.reportId} coordinates={[d.longitude, d.latitude]}>
<img src={marker} />
{/* <img src={marker} onClick={() => showDetails(d)} /> */}
{locations?.map((d: LocationData) => (
<Marker key={d.reportId} coordinates={[d.longitude, d.latitude] as [number, number]}>
<img src={marker} alt="location marker" />
</Marker>
))}
{/* Open CardData */}
{/* <Marker
coordinates={[
31.887935423191124, 54.355335268625275,
selected?.address?.longitude || defaultCoords.latitude,
selected?.address?.latitude || defaultCoords.longitude,
]}
>
<div
ref={detailsRef}
className={cn.join("mapDetailsBox", selected ? "show" : "")}
style={{ width: wrappersRef?.current?.offsetWidth - 20 || 200 }}
>
{selected && <RequestCard request={selected} />}
</div>
</Marker> */}
<ZoomControl />
</MapContainer>
)}
@ -153,43 +119,3 @@ const OnMapRequests = () => {
};
export default OnMapRequests;
// return (
// <div className="flex justify-center items-center text-center w-full h-full">
// <ThreeDots
// visible={true}
// height="50"
// width="50"
// color="#003778"
// radius="9"
// ariaLabel="three-dots-loading"
// wrapperStyle={{}}
// wrapperClass=""
// />
// </div>
// );
// }
// if (isError) {
// return <p>Map Failed</p>;
// }
// return (
// <div className="w-full h-full">
// <MapContainer
// center={[defaultCoords.longitude, defaultCoords.latitude]}
// zoom={[10]}
// containerStyle={{ height: "100%", width: "100%", borderRadius: 20 }}
// style={`https://api.parsimap.ir/styles/parsimap-streets-v11?key=${process.env.NEXT_PUBLIC_PMI_TOKEN}`}
// >
// {locations?.map((d: any) => (
// <Marker key={d.reportId} coordinates={[d.longitude, d.latitude]}>
// <img src={marker} />
// </Marker>
// ))}
// <ZoomControl />
// </MapContainer>
// </div>
// );
// };
// export default OnMapRequests;

View File

@ -6,11 +6,15 @@ import NearestRequests from "./NearestRequests";
import { TabRequests } from "./TabRequests";
import { useQuery } from "@tanstack/react-query";
import { getInstances } from "@/utils/CitizenCommon";
import dynamic from 'next/dynamic'
// import UserContainer from "../User/UserContainer";
// import { useRouter } from "next/navigation";
// import { useMutation } from "@tanstack/react-query";
// import { deleteCookie, getCookie } from "cookies-next";
const ComponentMap = dynamic(() => import('./OnMapRequests'), { ssr: false })
function RecentRequests() {
const [citizenInstance, setCitizenInstance] = useState<any | null>(null);
@ -42,6 +46,7 @@ function RecentRequests() {
<div className="w-full rounded-md bg-rose-100">
<div id="map" aria-label="نقشه">
{/* <OnMapRequests /> */}
<ComponentMap />
</div>
</div>

View File

@ -33,6 +33,7 @@ interface RequestItem {
medias: Media[];
isLiked: boolean;
likes: number;
commentsCount:number;
}
interface RequestCardProps {
@ -109,7 +110,7 @@ const RequestCard: React.FC<RequestCardProps> = ({ item, isSelfRequest }) => {
initialIsLiked={item.isLiked}
initialLikes={item.likes}
/>
<RequestComments />
<RequestComments reportId={item.id} commentsCount={item.commentsCount}/>
</div>
</div>
</div>

View File

@ -1,13 +1,117 @@
import React from "react";
"use client";
import { getComments } from "@/utils/CitizenReport";
import { useQuery } from "@tanstack/react-query";
import React, { useState } from "react";
import { FaRegComment } from "react-icons/fa";
import {
Drawer,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer";
import { Button } from "../ui/button";
import { MdSend } from "react-icons/md";
import { Textarea } from "../ui/textarea";
// Define types for props
interface RequestCommentsProps {
reportId: string;
commentsCount: number;
}
const RequestComments: React.FC<RequestCommentsProps> = ({
reportId,
commentsCount,
}) => {
// Component state
const [commentsCounts, setCommentsCounts] = useState<number>(commentsCount);
const [comment, setComment] = useState("");
const { data, isLoading, isError, isSuccess, refetch } = useQuery({
queryKey: ["Comments"],
queryFn: () => getComments(reportId),
// refetchOnWindowFocus: false,
});
const handleSubmit = async (event: React.FormEvent) => {
event.preventDefault();
const requestBody = {
comment: comment,
};
try {
const response = await fetch(`/api/comments/${reportId}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(requestBody),
});
if (!response.ok) {
throw new Error("Network response was not ok");
}
// Handle success (e.g., clear the input, show a success message, etc.)
setComment("");
console.log("Comment submitted successfully!");
} catch (error) {
// Handle error
console.error("There was an error submitting the comment:", error);
}
};
const RequestComments = () => {
return (
<>
<span className="flex items-center justify-center text-black text-lg font-bold">
<Drawer>
<DrawerTrigger onClick={(e) => e.stopPropagation()}>
<FaRegComment className="mx-1 cursor-pointer" />
</DrawerTrigger>
<DrawerContent className="bg-rose-400 px-64">
<DrawerHeader className="bg-yellow">
<p>
هنوز نظری برای این درخواست ثبت نشده است.
</p>
</DrawerHeader>
<form
onSubmit={handleSubmit}
className="flex justify-between bg-blue"
>
<button type="submit" className="ml-2">
<MdSend />
</button>
<Textarea
placeholder="نظر جدید..."
className="w-full min-h-5"
onChange={(e) => setComment(e.target.value)}
id="comment"
value={comment}
/>
{/* <input
className="w-full pr-10"
type="text"
id="comment"
value={comment}
placeholder="نظر جدید..."
onChange={(e) => setComment(e.target.value)}
/> */}
</form>
<DrawerFooter>
<DrawerClose>
<Button variant="outline">Cancel</Button>
</DrawerClose>
</DrawerFooter>
</DrawerContent>
</Drawer>
</span>
<span className="mx-[2px]">0</span>
<span className="mx-[2px]">{commentsCounts}</span>
</>
);
};

118
components/ui/drawer.tsx Normal file
View File

@ -0,0 +1,118 @@
"use client"
import * as React from "react"
import { Drawer as DrawerPrimitive } from "vaul"
import { cn } from "@/lib/utils"
const Drawer = ({
shouldScaleBackground = true,
...props
}: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
<DrawerPrimitive.Root
shouldScaleBackground={shouldScaleBackground}
{...props}
/>
)
Drawer.displayName = "Drawer"
const DrawerTrigger = DrawerPrimitive.Trigger
const DrawerPortal = DrawerPrimitive.Portal
const DrawerClose = DrawerPrimitive.Close
const DrawerOverlay = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DrawerPrimitive.Overlay
ref={ref}
className={cn("fixed inset-0 z-50 bg-black/80", className)}
{...props}
/>
))
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName
const DrawerContent = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DrawerPortal>
<DrawerOverlay />
<DrawerPrimitive.Content
ref={ref}
className={cn(
"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
className
)}
{...props}
>
<div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
{children}
</DrawerPrimitive.Content>
</DrawerPortal>
))
DrawerContent.displayName = "DrawerContent"
const DrawerHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn("grid gap-1.5 p-4 text-center", className)}
{...props}
/>
)
DrawerHeader.displayName = "DrawerHeader"
const DrawerFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
{...props}
/>
)
DrawerFooter.displayName = "DrawerFooter"
const DrawerTitle = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
>(({ className, ...props }, ref) => (
<DrawerPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className
)}
{...props}
/>
))
DrawerTitle.displayName = DrawerPrimitive.Title.displayName
const DrawerDescription = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
>(({ className, ...props }, ref) => (
<DrawerPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
DrawerDescription.displayName = DrawerPrimitive.Description.displayName
export {
Drawer,
DrawerPortal,
DrawerOverlay,
DrawerTrigger,
DrawerClose,
DrawerContent,
DrawerHeader,
DrawerFooter,
DrawerTitle,
DrawerDescription,
}

231
package-lock.json generated
View File

@ -40,6 +40,7 @@
"tailwind-merge": "^2.2.2",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss-animate": "^1.0.7",
"vaul": "^0.9.1",
"zod": "^3.22.4",
"zustand": "^4.5.2"
},
@ -600,6 +601,42 @@
}
}
},
"node_modules/@radix-ui/react-dialog": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.0.5.tgz",
"integrity": "sha512-GjWJX/AUpB703eEBanuBnIWdIXg6NvJFCXcNlSZk4xdszCdhrJgBoUd1cGk67vFO+WdA2pfI/plOpqz/5GUP6Q==",
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/primitive": "1.0.1",
"@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-context": "1.0.1",
"@radix-ui/react-dismissable-layer": "1.0.5",
"@radix-ui/react-focus-guards": "1.0.1",
"@radix-ui/react-focus-scope": "1.0.4",
"@radix-ui/react-id": "1.0.1",
"@radix-ui/react-portal": "1.0.4",
"@radix-ui/react-presence": "1.0.1",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-slot": "1.0.2",
"@radix-ui/react-use-controllable-state": "1.0.1",
"aria-hidden": "^1.1.1",
"react-remove-scroll": "2.5.5"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-direction": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.0.1.tgz",
@ -644,6 +681,48 @@
}
}
},
"node_modules/@radix-ui/react-focus-guards": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.0.1.tgz",
"integrity": "sha512-Rect2dWbQ8waGzhMavsIbmSVCgYxkXLxxR3ZvCX79JOglzdEy4JXMb98lq4hPxUbLr77nP0UOGf4rcMU+s1pUA==",
"dependencies": {
"@babel/runtime": "^7.13.10"
},
"peerDependencies": {
"@types/react": "*",
"react": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-focus-scope": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.0.4.tgz",
"integrity": "sha512-sL04Mgvf+FmyvZeYfNu1EPAaaxD+aw7cYeIB9L9Fvq8+urhltTRaEo5ysKOpHuKPclsZcSUMKlN05x4u+CINpA==",
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-use-callback-ref": "1.0.1"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-id": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.0.1.tgz",
@ -1334,6 +1413,17 @@
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"node_modules/aria-hidden": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.4.tgz",
"integrity": "sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==",
"dependencies": {
"tslib": "^2.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/aria-query": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz",
@ -2090,6 +2180,11 @@
"node": ">=6"
}
},
"node_modules/detect-node-es": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz",
"integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ=="
},
"node_modules/didyoumean": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
@ -3036,6 +3131,14 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-nonce": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-nonce/-/get-nonce-1.0.1.tgz",
"integrity": "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==",
"engines": {
"node": ">=6"
}
},
"node_modules/get-stream": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
@ -3376,6 +3479,14 @@
"node": ">= 0.4"
}
},
"node_modules/invariant": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
"integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
"dependencies": {
"loose-envify": "^1.0.0"
}
},
"node_modules/is-array-buffer": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz",
@ -4875,6 +4986,73 @@
"react-dom": ">=16.8.6 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/react-remove-scroll": {
"version": "2.5.5",
"resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz",
"integrity": "sha512-ImKhrzJJsyXJfBZ4bzu8Bwpka14c/fQt0k+cyFp/PBhTfyDnU5hjOtM4AG/0AMyy8oKzOTR0lDgJIM7pYXI0kw==",
"dependencies": {
"react-remove-scroll-bar": "^2.3.3",
"react-style-singleton": "^2.2.1",
"tslib": "^2.1.0",
"use-callback-ref": "^1.3.0",
"use-sidecar": "^1.1.2"
},
"engines": {
"node": ">=10"
},
"peerDependencies": {
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
}
},
"node_modules/react-remove-scroll-bar": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.6.tgz",
"integrity": "sha512-DtSYaao4mBmX+HDo5YWYdBWQwYIQQshUV/dVxFxK+KM26Wjwp1gZ6rv6OC3oujI6Bfu6Xyg3TwK533AQutsn/g==",
"dependencies": {
"react-style-singleton": "^2.2.1",
"tslib": "^2.0.0"
},
"engines": {
"node": ">=10"
},
"peerDependencies": {
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
}
},
"node_modules/react-style-singleton": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.1.tgz",
"integrity": "sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==",
"dependencies": {
"get-nonce": "^1.0.0",
"invariant": "^2.2.4",
"tslib": "^2.0.0"
},
"engines": {
"node": ">=10"
},
"peerDependencies": {
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
}
},
"node_modules/read-cache": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
@ -5907,6 +6085,47 @@
"punycode": "^2.1.0"
}
},
"node_modules/use-callback-ref": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.2.tgz",
"integrity": "sha512-elOQwe6Q8gqZgDA8mrh44qRTQqpIHDcZ3hXTLjBe1i4ph8XpNJnO+aQf3NaG+lriLopI4HMx9VjQLfPQ6vhnoA==",
"dependencies": {
"tslib": "^2.0.0"
},
"engines": {
"node": ">=10"
},
"peerDependencies": {
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
}
},
"node_modules/use-sidecar": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.2.tgz",
"integrity": "sha512-epTbsLuzZ7lPClpz2TyryBfztm7m+28DlEv2ZCQ3MDr5ssiwyOwGH/e5F9CkfWjJ1t4clvI58yF822/GUkjjhw==",
"dependencies": {
"detect-node-es": "^1.1.0",
"tslib": "^2.0.0"
},
"engines": {
"node": ">=10"
},
"peerDependencies": {
"@types/react": "^16.9.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
}
},
"node_modules/use-sync-external-store": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz",
@ -5920,6 +6139,18 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/vaul": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/vaul/-/vaul-0.9.1.tgz",
"integrity": "sha512-fAhd7i4RNMinx+WEm6pF3nOl78DFkAazcN04ElLPFF9BMCNGbY/kou8UMhIcicm0rJCNePJP0Yyza60gGOD0Jw==",
"dependencies": {
"@radix-ui/react-dialog": "^1.0.4"
},
"peerDependencies": {
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
}
},
"node_modules/vt-pbf": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz",

View File

@ -41,6 +41,7 @@
"tailwind-merge": "^2.2.2",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss-animate": "^1.0.7",
"vaul": "^0.9.1",
"zod": "^3.22.4",
"zustand": "^4.5.2"
},

View File

@ -112,13 +112,13 @@ export async function SetLike({
// Post CitizenReport Comment {id}
export async function postCitizenReportComment(id: string, comment: string) {
export async function postComment(id: string, comment: string) {
const data = await axios.post(`/api/CitizenReport/Comment/${id}`, { comment });
return data.data;
}
// Get CitizenReport Comment {id}
export async function getCitizenReportComment(id: string) {
export async function getComments(id: string) {
const data = await axios.get(`/api/CitizenReport/Comments/${id}`);
return data.data;
}