added "Like section" in Request card , RTL mapbox , Query for CitizinRequest , ExpireToken

master
YasamanKahdooei 2024-05-16 16:01:40 +03:30
parent eecb99ee5c
commit 47c79aff83
14 changed files with 499 additions and 162 deletions

View File

@ -4,9 +4,10 @@ import React from "react";
export default function page() {
return (
<section className="flex w-full md:grid md:grid-cols-2 h-full items-start flex-col overflow-y-auto p-5 scrollbar-thin scrollbar-thumb-yellow scrollbar-track-white">
<section className="no-scrollbar flex w-full md:grid md:grid-cols-2 md:gap-4 h-full items-start flex-col overflow-y-auto p-5 scrollbar-thin scrollbar-thumb-yellow scrollbar-track-white scrollbar-thumb-rounded-lg ">
<RequestCard isSelfRequest={true} />
{/* <RequestList /> */}
</section>
// <RequestList />
);
}

View File

@ -1,17 +1,25 @@
import SideMenu from "@/components/Menu/SideMenu";
import UserHeader from "@/components/User/UserHeader";
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
export default function RequestLayout({
children, // will be a page or nested layout
}: {
children: React.ReactNode;
}) {
const cookieStore = cookies();
const token = cookieStore.get("Shahrbin_Token");
if (!token) {
redirect("/");
}
return (
<section className="flex justify-end">
{/* Include shared UI here e.g. a header or sidebar */}
<SideMenu />
<UserHeader />
<div className=" w-[calc(100%-208px)] h-[calc(100%-100px)] flex flex-1 p-10 flex-col overflow-hidden overflow-y-scroll fixed top-[60px] left-0 transition-all scrollbar-thin scrollbar-thumb-yellow scrollbar-track-white">{children}</div>
<div className=" w-[calc(100%-208px)] h-[calc(100%-100px)] flex flex-1 p-10 flex-col overflow-hidden overflow-y-auto fixed top-[60px] left-0 transition-all scrollbar-thin scrollbar-thumb-yellow scrollbar-track-white">{children}</div>
</section>
);
}

View File

@ -7,6 +7,28 @@ 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

@ -7,9 +7,13 @@ 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 || "";
mapboxgl.setRTLTextPlugin(
"https://cdn.parsimap.ir/third-party/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js",
() => {}
);
const MapContainer = ReactMapboxGl({
accessToken: accessToken,
minZoom: 8,
@ -17,24 +21,37 @@ const MapContainer = ReactMapboxGl({
// zoom: 9,
});
interface MyItemType {
id: number;
name: string;
description: string;
abbreviation: string;
cityId: number;
city: string;
englishName: string;
latitude: number;
longitude: number;
}
const OnMapRequests = () => {
const [selected, setSelected] = useState<any | null>(null);
const [citizenInstance, setCitizenInstance] = useState<any | null>(null);
const [citizenInstance, setCitizenInstance] = useState<MyItemType | null>(
null
);
const [locations, setLocations] = useState<any | null>(null);
useEffect(() => {
const CtizenInstances = localStorage.getItem("SH_CT_INSTANCE");
setCitizenInstance(CtizenInstances);
console.log("🚀 ~ useEffect ~ CtizenInstancessssss:", citizenInstance);
console.log("🚀 ~ useEffect ~ CtizenInstancessssssss:", CtizenInstances);
const defaultCoords = {
// latitude: citizenInstance.latitude,
// longitude: citizenInstance.longitude,
};
if (CtizenInstances) {
const parsedItem = JSON.parse(CtizenInstances);
setCitizenInstance(parsedItem);
}
}, [citizenInstance]);
const defaultCoords = {
latitude: citizenInstance?.latitude || 0,
longitude: citizenInstance?.longitude || 0,
};
// refs
const detailsRef = useRef(null);
const wrappersRef = useRef(null);
@ -74,18 +91,10 @@ const OnMapRequests = () => {
useEffect(() => {
if (LocationData) {
console.log("🚀 ~ OnMapRequests ~ LocationData:", LocationData);
console.log(
"🚀 ~ OnMapRequestssss ~ LocationDataa:",
LocationData?.data?.locations[0]?.locations
);
setLocations(LocationData?.data?.locations[0]?.locations);
}
}, [isSuccess]);
if (isError) {
console.log("have a errorrrrrrr ");
}
return (
<div className="w-full h-full">
@ -104,22 +113,14 @@ const OnMapRequests = () => {
</div>
) : (
<MapContainer
// center={[
// store.instance?.longitude || defaultCoords.longitude,
// store.instance?.latitude || defaultCoords.latitude,
// ]}
center={[defaultCoords.longitude, defaultCoords.latitude]}
zoom={[10]}
center={[31.887935423191124, 54.355335268625275]}
containerStyle={{ height: "100%", width: "100%", borderRadius: 20 }}
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]}
// coordinates={[ 31.887935423191124, 54.355335268625275,]}
>
<Marker key={d.reportId} coordinates={[d.longitude, d.latitude]}>
<img src={marker} />
{/* <img src={marker} onClick={() => showDetails(d)} /> */}
</Marker>
@ -141,6 +142,7 @@ const OnMapRequests = () => {
{selected && <RequestCard request={selected} />}
</div>
</Marker> */}
<ZoomControl />
</MapContainer>
)}
@ -151,3 +153,43 @@ 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

@ -41,7 +41,7 @@ function RecentRequests() {
{/* Right */}
<div className="w-full rounded-md bg-rose-100">
<div id="map" aria-label="نقشه">
<OnMapRequests />
{/* <OnMapRequests /> */}
</div>
</div>

View File

@ -3,7 +3,8 @@ import RequestCard from "../Requests/RequestCard";
const RequestList = () => {
return (
<section className="flex flex-1 w-full items-center flex-col overflow-y-scroll overflow-x-hidden pl-5 scrollbar-thin scrollbar-thumb-yellow scrollbar-track-white ">
<section className="flex flex-1 w-full h-[28rem] items-center flex-col overflow-y-scroll pl-5 scrollbar-thin scrollbar-thumb-yellow scrollbar-track-white scrollbar-thumb-rounded-lg" style={{direction:'rtl'}}>
{/* <section className="flex flex-1 w-full items-center flex-col overflow-y-scroll overflow-x-hidden pl-5 scrollbar-thin scrollbar-thumb-yellow scrollbar-track-white "> */}
<RequestCard isSelfRequest={false} />
</section>
);

View File

@ -24,7 +24,7 @@ const RequestCard: React.FC<RequestCardProps> = ({ isSelfRequest = false }) => {
queryKey: ["CitizenReport"],
queryFn: () =>
getCitizenReport({ PageNumber: 1, PageSize: 10, instanceId: 1 }),
refetchOnWindowFocus: false,
// refetchOnWindowFocus: false,
});
useEffect(() => {
@ -37,11 +37,13 @@ const RequestCard: React.FC<RequestCardProps> = ({ isSelfRequest = false }) => {
}, [data]);
return (
<div>
// <div className="overflow-x-hidden overflow-y-scroll pl-5 scrollbar-thin scrollbar-thumb-yellow scrollbar-track-white">
<>
{reportData?.map((item: any) => {
return (
<Link
href={`MyRequest/${1}`}
<div
// href={`MyRequest/${1}`}
// href={'#'}
className="w-full bg-white flex items-stretch mb-3 min-h-[170px] md:p-3 md:rounded-md md:border-0 md:shadow-[0_2px_5px_rgba(0,0,0,0.05)]"
style={{ direction: "rtl" }}
key={item.id}
@ -57,13 +59,13 @@ const RequestCard: React.FC<RequestCardProps> = ({ isSelfRequest = false }) => {
quality={100}
height={100}
width={100}
className="w-full h-full rounded-md object-contain"
className="w-[80%] h-full rounded-md object-contain"
/>
</div>
<div className="flex-1 pr-2">
{/* 1 requestCardInfoRow */}
<div className="w-full flex items-center justify-between mb-2">
<div className="w-full flex items-center justify-between mb-[10px]">
<p className="text-xs font-bold text-ellipsis">
{item.categoryTitle}
</p>
@ -71,7 +73,7 @@ const RequestCard: React.FC<RequestCardProps> = ({ isSelfRequest = false }) => {
</div>
{/* 2 */}
<div className="w-full flex items-center justify-between mb-2">
<div className="w-full flex items-center justify-between mb-[10px]">
<div className="flex items-center text-sm text-gray-500 text-ellipsis">
<MdLocationOn className="text-blue ml-1 text-xl" />
<p className="line-clamp-1 ">{item.addressDetail}</p>
@ -79,7 +81,7 @@ const RequestCard: React.FC<RequestCardProps> = ({ isSelfRequest = false }) => {
</div>
{/* 3 */}
<div className="w-full flex items-center justify-between mb-2">
<div className="w-full flex items-center justify-between mb-[10px]">
<div className="text-xs text-gray-500">
<span>کد رهگیری: </span>
<span>{item.trackingNumber}</span>
@ -90,19 +92,20 @@ const RequestCard: React.FC<RequestCardProps> = ({ isSelfRequest = false }) => {
</div>
{/* 4 */}
<div className="w-full flex items-center justify-between mb-2">
<div className="w-full flex items-center justify-between mb-[10px]">
<RequestProcessIcon />
<div className="flex items-center justify-center">
<RequestViolation />
<RequestLike />
<RequestLike reportId={item.id} initialIsLiked={item.isLiked} initialLikes={item.likes}/>
<RequestComments />
</div>
</div>
</div>
</Link>
</div>
);
})}
</div>
</>
// </div>
);
};

View File

@ -1,14 +1,130 @@
import React from "react";
"use client";
import React, { useState } from "react";
import { FiHeart } from "react-icons/fi";
import { IoMdHeart } from "react-icons/io";
import { FcLike } from "react-icons/fc";
import { GoHeart } from "react-icons/go";
import { PiHeart } from "react-icons/pi";
import { ImHeart } from "react-icons/im";
import { SlHeart } from "react-icons/sl";
import { useQuery } from "@tanstack/react-query";
import { useParams } from "next/navigation";
import { SetLike } from "@/utils/CitizenReport";
// const RequestLike = ({ RequestId = "" }) => {
// const id = RequestId;
// // const params = useParams<{ tag: string; item: string }>();
// // states
// const [isLiked, setIsLiked] = useState(false);
// const [likes, setLikes] = useState(0);
// const onLike = async (isLiked: boolean) => {
// setIsLiked(isLiked);
// const params = {
// reportId: id,
// // isLiked: !isLiked, // Toggle the like status
// isLiked,
// };
// try {
// const { data, isLoading, isError, isSuccess, refetch } = useQuery({
// queryKey: ["CitizenLike"],
// queryFn: () =>
// SetLike({
// id: params.reportId,
// isLiked: params.isLiked,
// }),
// refetchOnWindowFocus: false,
// });
// if (isSuccess) {
// console.log(data);
// setLikes((prevLikes) => (isLiked ? prevLikes + 1 : prevLikes - 1));
// console.log("Likkeee");
// } else {
// setIsLiked(!isLiked);
// console.log("DisssLikkeee");
// }
// } catch (err) {
// setIsLiked(!isLiked);
// }
// };
// return (
// <>
// <span className="flex items-center justify-center text-black text-lg font-bold cursor-pointer">
// {isLiked ? (
// <ImHeart
// className="fill-red"
// onClick={(e) => {
// e.stopPropagation();
// onLike(!isLiked);
// }}
// />
// ) : (
// <SlHeart
// onClick={(e) => {
// e.stopPropagation();
// onLike(!isLiked);
// }}
// />
// )}
// </span>
// <span>{likes}</span>
// </>
// );
// };
// export default RequestLike;
// Define types for props
interface RequestLikeProps {
reportId: string;
initialIsLiked: boolean;
initialLikes: number;
}
// Define the RequestLike component
const RequestLike: React.FC<RequestLikeProps> = ({
reportId,
initialIsLiked,
initialLikes,
}) => {
// Component state
const [isLiked, setIsLiked] = useState<boolean>(initialIsLiked);
const [likes, setLikes] = useState<number>(initialLikes);
// Handle the PUT request
const onLike = async (
newIsLiked: boolean,
event: React.MouseEvent<SVGElement>
) => {
event.stopPropagation();
try {
await SetLike({ id: reportId, isLiked: newIsLiked });
setIsLiked(newIsLiked);
setLikes((prevLikes) => (newIsLiked ? prevLikes + 1 : prevLikes - 1));
} catch (error) {
console.error("Error liking the report:", error);
}
};
const RequestLike = () => {
return (
<>
<span className="flex items-center justify-center text-black text-lg font-bold cursor-pointer">
<FiHeart />
{isLiked ? (
<ImHeart
className="fill-red mx-1 ml-[3px] cursor-pointer"
onClick={(e) => onLike(!isLiked, e)}
/>
) : (
<SlHeart
className="mx-1 ml-[3px] cursor-pointer"
onClick={(e) => onLike(!isLiked, e)}
/>
)}
</span>
<span>0</span>
<span>{likes}</span>
</>
);
};

View File

@ -1,13 +1,41 @@
// import { statusColors } from "@/utils/variables";
import React from "react";
interface RequestStatusProps {
lastStatus?: String;
}
interface StatusColors {
[key: string]: string;
}
export const statusColors: StatusColors = {
"در انتظار تأیید اپراتور": "bg-yellow",
"ارجاع به واحد اجرایی": "bg-gray-400",
"ارجاع به پیمانکار": "bg-purple-500",
"پایان یافته": "bg-lightGreen",
"ارجاع به واحد بازرسی": "bg-red",
"بررسی توسط واحد بازرسی": "bg-red",
"ثبت درخواست در سامانه": "bg-blue2",
"در انتظار تأیید در سامانه": "bg-blue3",
"تأیید درخواست در سامانه": "#79B473",
"ارجاع به شهروند": "bg-purple-800",
"ارجاع به اپراتور": "bg-blue",
"پاسخ به شهروند": "bg-purple-800",
"ایجاد شده": "bg-yellow",
"در حال بررسی": "bg-gray-400",
};
const RequestStatus: React.FC<RequestStatusProps> = ({ lastStatus }) => {
const statusColorClass = lastStatus && statusColors[lastStatus.toLowerCase()];
return (
<>
<span className="rounded-3xl bg-white text-ellipsis text-center py-[2px] px-1 text-xs font-bold min-h-6 flex items-center justify-center max-w-[80px] w-full text-black">
<span
className={`rounded-3xl text-ellipsis text-center py-[2px] px-1 text-[10px] font-bold min-h-6 flex items-center justify-center max-w-[80px] w-full text-black ${statusColorClass}`}
// ${statusColors[lastStatus]}
// style={{ backgroundColor: statusColors[lastStatus] }}
>
{lastStatus}
</span>
</>

View File

@ -22,6 +22,6 @@ export function convertFullTime(date: string) {
const convertedDate = dayjs(date + "Z")
.calendar("jalali")
.locale("fa")
.format(" HH:mm ساعت YYYY/MM/DD");
.format("DD MMMM YYYY ساعت HH:mm ");
return convertedDate;
}

176
package-lock.json generated
View File

@ -24,6 +24,7 @@
"jalaliday": "^2.3.0",
"jwt-decode": "^4.0.0",
"lucide-react": "^0.365.0",
"mapbox-gl": "^3.3.0",
"next": "14.1.4",
"next-nprogress-bar": "^2.3.11",
"next-themes": "^0.3.0",
@ -43,6 +44,7 @@
"zustand": "^4.5.2"
},
"devDependencies": {
"@types/mapbox-gl": "^3.1.0",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
@ -288,7 +290,6 @@
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/@mapbox/geojson-rewind/-/geojson-rewind-0.5.2.tgz",
"integrity": "sha512-tJaT+RbYGJYStt7wI3cq4Nl4SXxG8W7JDG5DMJu97V25RnbNg3QtQtf+KD+VLjNpWKYsRvXDNmNrBgEETr1ifA==",
"peer": true,
"dependencies": {
"get-stream": "^6.0.1",
"minimist": "^1.2.6"
@ -297,53 +298,38 @@
"geojson-rewind": "geojson-rewind"
}
},
"node_modules/@mapbox/geojson-types": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@mapbox/geojson-types/-/geojson-types-1.0.2.tgz",
"integrity": "sha512-e9EBqHHv3EORHrSfbR9DqecPNn+AmuAoQxV6aL8Xu30bJMJR1o8PZLZzpk1Wq7/NfCbuhmakHTPYRhoqLsXRnw==",
"peer": true
},
"node_modules/@mapbox/jsonlint-lines-primitives": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz",
"integrity": "sha512-rY0o9A5ECsTQRVhv7tL/OyDpGAoUB4tTvLiW1DSzQGq4bvTPhNw1VpSNjDJc5GFZ2XuyOtSWSVN05qOtcD71qQ==",
"peer": true,
"engines": {
"node": ">= 0.6"
}
},
"node_modules/@mapbox/mapbox-gl-supported": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-1.5.0.tgz",
"integrity": "sha512-/PT1P6DNf7vjEEiPkVIRJkvibbqWtqnyGaBz3nfRdcxclNSnSdaLU5tfAgcD7I8Yt5i+L19s406YLl1koLnLbg==",
"peer": true,
"peerDependencies": {
"mapbox-gl": ">=0.32.1 <2.0.0"
}
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-3.0.0.tgz",
"integrity": "sha512-2XghOwu16ZwPJLOFVuIOaLbN0iKMn867evzXFyf0P22dqugezfJwLmdanAgU25ITvz1TvOfVP4jsDImlDJzcWg=="
},
"node_modules/@mapbox/point-geometry": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz",
"integrity": "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ==",
"peer": true
"integrity": "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ=="
},
"node_modules/@mapbox/tiny-sdf": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-1.2.5.tgz",
"integrity": "sha512-cD8A/zJlm6fdJOk6DqPUV8mcpyJkRz2x2R+/fYcWDYG3oWbG7/L7Yl/WqQ1VZCjnL9OTIMAn6c+BC5Eru4sQEw==",
"peer": true
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.6.tgz",
"integrity": "sha512-qMqa27TLw+ZQz5Jk+RcwZGH7BQf5G/TrutJhspsca/3SHwmgKQ1iq+d3Jxz5oysPVYTGP6aXxCo5Lk9Er6YBAA=="
},
"node_modules/@mapbox/unitbezier": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.0.tgz",
"integrity": "sha512-HPnRdYO0WjFjRTSwO3frz1wKaU649OBFPX3Zo/2WZvuRi6zMiRGui8SnPQiQABgqCf8YikDe5t3HViTVw1WUzA==",
"peer": true
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz",
"integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw=="
},
"node_modules/@mapbox/vector-tile": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-1.3.1.tgz",
"integrity": "sha512-MCEddb8u44/xfQ3oD+Srl/tNcQoqTw3goGk2oLsrFxOTc3dUp+kAnby3PvAeeBYSMSjSPD1nd1AJA6W49WnoUw==",
"peer": true,
"dependencies": {
"@mapbox/point-geometry": "~0.1.0"
}
@ -352,7 +338,6 @@
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz",
"integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==",
"peer": true,
"engines": {
"node": ">=6.0.0"
}
@ -1073,6 +1058,15 @@
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
"dev": true
},
"node_modules/@types/mapbox-gl": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-3.1.0.tgz",
"integrity": "sha512-hI6cQDjw1bkJw7MC/eHMqq5TWUamLwsujnUUeiIX2KDRjxRNSYMjnHz07+LATz9I9XIsKumOtUz4gRYnZOJ/FA==",
"dev": true,
"dependencies": {
"@types/geojson": "*"
}
},
"node_modules/@types/node": {
"version": "20.12.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.4.tgz",
@ -1767,6 +1761,11 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/cheap-ruler": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/cheap-ruler/-/cheap-ruler-3.0.2.tgz",
"integrity": "sha512-02T332h1/HTN6cDSufLP8x4JzDs2+VC+8qZ/N0kWIVPyc2xUkWwWh3B2fJxR7raXkL4Mq7k554mfuM9ofv/vGg=="
},
"node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
@ -1931,8 +1930,7 @@
"node_modules/csscolorparser": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/csscolorparser/-/csscolorparser-1.0.3.tgz",
"integrity": "sha512-umPSgYwZkdFoUrH5hIq5kf0wPSXiro51nPw0j2K/c83KflkPSTBGMz6NJvMB+07VlL0y7VPo6QJcDjcgKTTm3w==",
"peer": true
"integrity": "sha512-umPSgYwZkdFoUrH5hIq5kf0wPSXiro51nPw0j2K/c83KflkPSTBGMz6NJvMB+07VlL0y7VPo6QJcDjcgKTTm3w=="
},
"node_modules/cssesc": {
"version": "3.0.0",
@ -2129,8 +2127,7 @@
"node_modules/earcut": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz",
"integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==",
"peer": true
"integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ=="
},
"node_modules/eastasianwidth": {
"version": "0.2.0",
@ -2804,6 +2801,11 @@
"reusify": "^1.0.4"
}
},
"node_modules/fflate": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz",
"integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A=="
},
"node_modules/file-entry-cache": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
@ -3013,8 +3015,7 @@
"node_modules/geojson-vt": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-3.2.1.tgz",
"integrity": "sha512-EvGQQi/zPrDA6zr6BnJD/YhwAkBP8nnJ9emh3EnHQKVMfg/MRVtPbMYdgVy/IaEmn4UfagD2a6fafPDL5hbtwg==",
"peer": true
"integrity": "sha512-EvGQQi/zPrDA6zr6BnJD/YhwAkBP8nnJ9emh3EnHQKVMfg/MRVtPbMYdgVy/IaEmn4UfagD2a6fafPDL5hbtwg=="
},
"node_modules/get-intrinsic": {
"version": "1.2.4",
@ -3039,7 +3040,6 @@
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
"peer": true,
"engines": {
"node": ">=10"
},
@ -3079,8 +3079,7 @@
"node_modules/gl-matrix": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz",
"integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==",
"peer": true
"integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA=="
},
"node_modules/glob": {
"version": "10.3.10",
@ -3212,8 +3211,7 @@
"node_modules/grid-index": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/grid-index/-/grid-index-1.1.0.tgz",
"integrity": "sha512-HZRwumpOGUrHyxO5bqKZL0B0GlUpwtCAzZ42sgxUPniu33R1LSFH5yrIcBCHjkctCAh3mtWKcKd9J4vDDdeVHA==",
"peer": true
"integrity": "sha512-HZRwumpOGUrHyxO5bqKZL0B0GlUpwtCAzZ42sgxUPniu33R1LSFH5yrIcBCHjkctCAh3mtWKcKd9J4vDDdeVHA=="
},
"node_modules/has-bigints": {
"version": "1.0.2",
@ -3312,8 +3310,7 @@
"type": "consulting",
"url": "https://feross.org/support"
}
],
"peer": true
]
},
"node_modules/ignore": {
"version": "5.3.1",
@ -3937,6 +3934,11 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ=="
},
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@ -3971,36 +3973,51 @@
}
},
"node_modules/mapbox-gl": {
"version": "1.13.3",
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-1.13.3.tgz",
"integrity": "sha512-p8lJFEiqmEQlyv+DQxFAOG/XPWN0Wp7j/Psq93Zywz7qt9CcUKFYDBOoOEKzqe6gudHVJY8/Bhqw6VDpX2lSBg==",
"peer": true,
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-3.3.0.tgz",
"integrity": "sha512-cVeAu9PxPTx113AnJAzcSKbBtL5F5EpJ6/NuYgNib9zNduNSoDG2oVX6xK0bAP/VwwVwRh9SEhcyM7nh4GThvQ==",
"dependencies": {
"@mapbox/geojson-rewind": "^0.5.2",
"@mapbox/geojson-types": "^1.0.2",
"@mapbox/jsonlint-lines-primitives": "^2.0.2",
"@mapbox/mapbox-gl-supported": "^1.5.0",
"@mapbox/mapbox-gl-supported": "^3.0.0",
"@mapbox/point-geometry": "^0.1.0",
"@mapbox/tiny-sdf": "^1.1.1",
"@mapbox/unitbezier": "^0.0.0",
"@mapbox/tiny-sdf": "^2.0.6",
"@mapbox/unitbezier": "^0.0.1",
"@mapbox/vector-tile": "^1.3.1",
"@mapbox/whoots-js": "^3.1.0",
"cheap-ruler": "^3.0.1",
"csscolorparser": "~1.0.3",
"earcut": "^2.2.2",
"earcut": "^2.2.4",
"fflate": "^0.8.1",
"geojson-vt": "^3.2.1",
"gl-matrix": "^3.2.1",
"gl-matrix": "^3.4.3",
"grid-index": "^1.1.0",
"kdbush": "^4.0.1",
"lodash.clonedeep": "^4.5.0",
"murmurhash-js": "^1.0.0",
"pbf": "^3.2.1",
"potpack": "^1.0.1",
"potpack": "^2.0.0",
"quickselect": "^2.0.0",
"rw": "^1.3.3",
"supercluster": "^7.1.0",
"serialize-to-js": "^3.1.2",
"supercluster": "^8.0.0",
"tiny-lru": "^11.2.5",
"tinyqueue": "^2.0.3",
"vt-pbf": "^3.1.1"
"tweakpane": "^4.0.3",
"vt-pbf": "^3.1.3"
}
},
"engines": {
"node": ">=6.4.0"
"node_modules/mapbox-gl/node_modules/kdbush": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/kdbush/-/kdbush-4.0.2.tgz",
"integrity": "sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA=="
},
"node_modules/mapbox-gl/node_modules/supercluster": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/supercluster/-/supercluster-8.0.1.tgz",
"integrity": "sha512-IiOea5kJ9iqzD2t7QJq/cREyLHTtSmUT6gQsweojg9WH2sYJqZK9SswTu6jrscO6D1G5v5vYZ9ru/eq85lXeZQ==",
"dependencies": {
"kdbush": "^4.0.2"
}
},
"node_modules/merge2": {
@ -4079,8 +4096,7 @@
"node_modules/murmurhash-js": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz",
"integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==",
"peer": true
"integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw=="
},
"node_modules/mz": {
"version": "2.7.0",
@ -4491,7 +4507,6 @@
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz",
"integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==",
"peer": true,
"dependencies": {
"ieee754": "^1.1.12",
"resolve-protobuf-schema": "^2.1.0"
@ -4683,10 +4698,9 @@
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="
},
"node_modules/potpack": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/potpack/-/potpack-1.0.2.tgz",
"integrity": "sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==",
"peer": true
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/potpack/-/potpack-2.0.0.tgz",
"integrity": "sha512-Q+/tYsFU9r7xoOJ+y/ZTtdVQwTWfzjbiXBDMM/JKUux3+QPP02iUuIoeBQ+Ot6oEDlC+/PGjB/5A3K7KKb7hcw=="
},
"node_modules/prelude-ls": {
"version": "1.2.1",
@ -4710,8 +4724,7 @@
"node_modules/protocol-buffers-schema": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz",
"integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==",
"peer": true
"integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw=="
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
@ -4749,8 +4762,7 @@
"node_modules/quickselect": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz",
"integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==",
"peer": true
"integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw=="
},
"node_modules/react": {
"version": "18.2.0",
@ -4964,7 +4976,6 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz",
"integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==",
"peer": true,
"dependencies": {
"protocol-buffers-schema": "^3.3.1"
}
@ -5038,8 +5049,7 @@
"node_modules/rw": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz",
"integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==",
"peer": true
"integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ=="
},
"node_modules/safe-array-concat": {
"version": "1.1.2",
@ -5111,6 +5121,14 @@
"node": ">=10"
}
},
"node_modules/serialize-to-js": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/serialize-to-js/-/serialize-to-js-3.1.2.tgz",
"integrity": "sha512-owllqNuDDEimQat7EPG0tH7JjO090xKNzUtYz6X+Sk2BXDnOCilDdNLwjWeFywG9xkJul1ULvtUQa9O4pUaY0w==",
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/set-function-length": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
@ -5653,11 +5671,18 @@
"node": ">=0.8"
}
},
"node_modules/tiny-lru": {
"version": "11.2.6",
"resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-11.2.6.tgz",
"integrity": "sha512-0PU3c9PjMnltZaFo2sGYv/nnJsMjG0Cxx8X6FXHPPGjFyoo1SJDxvUXW1207rdiSxYizf31roo+GrkIByQeZoA==",
"engines": {
"node": ">=12"
}
},
"node_modules/tinyqueue": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-2.0.3.tgz",
"integrity": "sha512-ppJZNDuKGgxzkHihX8v9v9G5f+18gzaTfrukGrq6ueg0lmH4nqVnA2IPG0AEH3jKEk2GRJCUhDoqpoiw3PHLBA==",
"peer": true
"integrity": "sha512-ppJZNDuKGgxzkHihX8v9v9G5f+18gzaTfrukGrq6ueg0lmH4nqVnA2IPG0AEH3jKEk2GRJCUhDoqpoiw3PHLBA=="
},
"node_modules/to-regex-range": {
"version": "5.0.1",
@ -5704,6 +5729,14 @@
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
},
"node_modules/tweakpane": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/tweakpane/-/tweakpane-4.0.3.tgz",
"integrity": "sha512-BlcWOAe8oe4c+k9pmLBARGdWB6MVZMszayekkixQXTgkxTaYoTUpHpwVEp+3HkoamZkomodpbBf0CkguIHTgLg==",
"funding": {
"url": "https://github.com/sponsors/cocopon"
}
},
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@ -5891,7 +5924,6 @@
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz",
"integrity": "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==",
"peer": true,
"dependencies": {
"@mapbox/point-geometry": "0.1.0",
"@mapbox/vector-tile": "^1.3.1",

View File

@ -25,6 +25,7 @@
"jalaliday": "^2.3.0",
"jwt-decode": "^4.0.0",
"lucide-react": "^0.365.0",
"mapbox-gl": "^3.3.0",
"next": "14.1.4",
"next-nprogress-bar": "^2.3.11",
"next-themes": "^0.3.0",
@ -44,6 +45,7 @@
"zustand": "^4.5.2"
},
"devDependencies": {
"@types/mapbox-gl": "^3.1.0",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",

View File

@ -10,23 +10,6 @@ axios.interceptors.request.use(function (config) {
return config;
});
// Get Location
export async function getLocations() {
const data = await axios.get(`/api/CitizenReport/Locations?instanceId=1`, {
});
return data.data;
}
// ResendOtp
export async function resendOtp(payload: { otpToken: string | any}) {
const data = await axios.post(
`/api/Authenticate/ResendOtp`,
payload
);
return data.data;
}
// Get CitizenReport
export async function getCitizenReport({
PageNumber = 1,
@ -35,9 +18,107 @@ export async function getCitizenReport({
}: {
PageNumber?: number;
PageSize?: number;
instanceId?:number;
instanceId?: number;
}) {
const data = await axios.get(`/api/CitizenReport?instanceId=${instanceId}&PageNumber=${PageNumber}&PageSize=${PageSize}`, {
});
const data = await axios.get(
`/api/CitizenReport?instanceId=${instanceId}&PageNumber=${PageNumber}&PageSize=${PageSize}`,
{}
);
return data.data;
}
// Post CitizenReport
export async function postCitizenReport(payload: {
instanceId: number;
categoryId: number;
comments: string;
address: {
regionId: number;
latitude: number;
longitude: number;
detail: string;
};
attachments: [];
isIdentityVisible: true;
}) {
const data = await axios.post(`api/api/CitizenReport`, payload);
return data.data;
}
// Get CitizenReport Nearest
export async function getCitizenReportNearest({
PageNumber = 1,
PageSize = 10,
instanceId = 1,
}: {
PageNumber?: number;
PageSize?: number;
instanceId?: number;
}) {
const data = await axios.get(
`/api/CitizenReport/Nearest?instanceId=${instanceId}&PageNumber=${PageNumber}&PageSize=${PageSize}`,
{}
);
return data.data;
}
// Get Location
export async function getLocations() {
const data = await axios.get(`/api/CitizenReport/Locations?instanceId=1`);
return data.data;
}
// Get Location {ID}
export async function getSingleLocations(id: any) {
const data = await axios.get(`/api/CitizenReport/Locations/${id}`);
return data.data;
}
// Get CitizenReport Mine
export async function getCitizenReportMine({
PageNumber = 1,
PageSize = 10,
}: {
PageNumber?: number;
PageSize?: number;
}) {
const data = await axios.get(
`/api/CitizenReport/Mine?PageNumber=${PageNumber}&PageSize=${PageSize}`
);
return data.data;
}
// Get CitizenReport Mine {Id}
export async function getSingleCitizenReportMine(id: string) {
const data = await axios.get(`/api/CitizenReport/Mine/${id}`);
return data.data;
}
// Put CitizenReport Like
export async function SetLike({
id,
isLiked,
}: {
id: string;
isLiked: boolean;
}) {
const data = await axios.put(`/api/CitizenReport/Like/${id}?isLiked=${isLiked}`);
return data.data;
}
// Post CitizenReport Comment {id}
export async function postCitizenReportComment(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) {
const data = await axios.get(`/api/CitizenReport/Comments/${id}`);
return data.data;
}

View File

@ -31,6 +31,8 @@ axios.interceptors.response.use(
const refreshToken = getCookie("Shahrbin_Refresh_Token");
//accessToken && refreshToken && !isRefreshing
if (!isRefreshing) {
console.log("2222");
isRefreshing = true;
try {
@ -58,6 +60,16 @@ axios.interceptors.response.use(
}
);
export async function revoke(payload: {
refreshToken: string | CookieValueTypes;
}) {
const token = getCookie("Shahrbin_Token");
const data = await axios.post("api/Authenticate/Revoke", payload, {
headers: { Authorization: `Bearer ${token}` },
});
return data.data;
}
export async function RefreshToken(payload: { token: any; refreshToken: any }) {
try {
@ -72,17 +84,6 @@ export async function RefreshToken(payload: { token: any; refreshToken: any }) {
}
}
export async function revoke(payload: {
refreshToken: string | CookieValueTypes;
}) {
const token = getCookie("Shahrbin_Token");
const data = await axios.post("api/Authenticate/Revoke", payload, {
headers: { Authorization: `Bearer ${token}` },
});
return data.data;
}
export async function logisterCitizen(payload: {
phoneNumber: string;
captcha: {