Compare commits
No commits in common. "main" and "Kahdooie" have entirely different histories.
|
|
@ -68,7 +68,7 @@ const AddCatFormSchema = z.object({
|
||||||
|
|
||||||
export default function AdminCategories() {
|
export default function AdminCategories() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
// states
|
|
||||||
const [keyId, setKeyId] = useState("");
|
const [keyId, setKeyId] = useState("");
|
||||||
const [keyIdDel, setKeyIdDel] = useState("");
|
const [keyIdDel, setKeyIdDel] = useState("");
|
||||||
const [titleCat, setTitleCat] = useState("");
|
const [titleCat, setTitleCat] = useState("");
|
||||||
|
|
@ -88,6 +88,7 @@ export default function AdminCategories() {
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: ["CategoriesList"],
|
queryKey: ["CategoriesList"],
|
||||||
queryFn: () => GetAllCategories(),
|
queryFn: () => GetAllCategories(),
|
||||||
|
// refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
@ -243,12 +244,7 @@ export default function AdminCategories() {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
افزودن دسته بندی
|
افزودن دسته بندی
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel
|
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
||||||
className="h-auto p-0 border-0"
|
|
||||||
onClick={() => {
|
|
||||||
resetFormAdd();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -313,12 +309,7 @@ export default function AdminCategories() {
|
||||||
>
|
>
|
||||||
افزودن
|
افزودن
|
||||||
</Button>
|
</Button>
|
||||||
<AlertDialogCancel
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl" onClick={() => { resetFormAdd(); }}>
|
||||||
className="mt-0 text-white bg-blue rounded-xl"
|
|
||||||
onClick={() => {
|
|
||||||
resetFormAdd();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,23 @@ const MAX_FILE_SIZE = 5242880; // 5 MB
|
||||||
// Edit Key Form
|
// Edit Key Form
|
||||||
const FormSchemaEditKey = z.object({
|
const FormSchemaEditKey = z.object({
|
||||||
uploadPrivateKey: z.any(),
|
uploadPrivateKey: z.any(),
|
||||||
|
// .instanceof(File)
|
||||||
|
|
||||||
|
// .custom<FileList>((val) => val instanceof FileList, "Required")
|
||||||
|
// .refine((files) => files.length <= 1, "Maximum of 1 file is allowed.")
|
||||||
|
// .refine(
|
||||||
|
// (files) =>
|
||||||
|
// Array.from(files).every((file) => file.size <= MAX_IMAGE_SIZE),
|
||||||
|
// "Each file size should be less than 5 MB."
|
||||||
|
// ),
|
||||||
|
|
||||||
|
// .refine((files) => files?.length === 0, "File is required.")
|
||||||
|
// .refine((files) => files?.length >= 1, "Maximum of 1 file is allowed.")
|
||||||
|
// .refine((files) => files?.[0]?.size <= MAX_FILE_SIZE, `Max file size is 5MB.`)
|
||||||
|
|
||||||
|
// publicKeyId: z
|
||||||
|
// .string()
|
||||||
|
// .nullable(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add Key Form
|
// Add Key Form
|
||||||
|
|
@ -75,8 +92,7 @@ export default function AdminKeysManagement() {
|
||||||
const inputPubRef = useRef<HTMLTextAreaElement | null>(null);
|
const inputPubRef = useRef<HTMLTextAreaElement | null>(null);
|
||||||
const inputPrvRef = useRef<HTMLTextAreaElement | null>(null);
|
const inputPrvRef = useRef<HTMLTextAreaElement | null>(null);
|
||||||
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
|
// ..............Read .txt
|
||||||
|
|
||||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||||
const handleFileChange = (event: any) => {
|
const handleFileChange = (event: any) => {
|
||||||
const file = event.target.files[0];
|
const file = event.target.files[0];
|
||||||
|
|
@ -190,7 +206,7 @@ export default function AdminKeysManagement() {
|
||||||
publicKey: data.publicKey,
|
publicKey: data.publicKey,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// const { resetField } = useForm();
|
||||||
|
|
||||||
// List Keys
|
// List Keys
|
||||||
const {
|
const {
|
||||||
|
|
@ -202,6 +218,7 @@ export default function AdminKeysManagement() {
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: ["KeysList"],
|
queryKey: ["KeysList"],
|
||||||
queryFn: () => GetKeys(),
|
queryFn: () => GetKeys(),
|
||||||
|
// refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// GenerateKeyPair
|
// GenerateKeyPair
|
||||||
|
|
@ -236,6 +253,17 @@ export default function AdminKeysManagement() {
|
||||||
}
|
}
|
||||||
}, [handleClickGenerate]);
|
}, [handleClickGenerate]);
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// const isChangingKey = localStorage.getItem("isChangingKey");
|
||||||
|
// if (isChangingKey) {
|
||||||
|
// setPolling(true);
|
||||||
|
// ChangeKeyMutation.mutate({
|
||||||
|
// privateKey: "",
|
||||||
|
// publicKeyId: "cb7258da-64b0-4f43-b4f7-8ee11799d643",
|
||||||
|
// isPolling: true,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }, [polling]);
|
||||||
const refethKey = () => {
|
const refethKey = () => {
|
||||||
ChangeKeyMutation.mutate({
|
ChangeKeyMutation.mutate({
|
||||||
privateKey: "",
|
privateKey: "",
|
||||||
|
|
@ -256,7 +284,6 @@ export default function AdminKeysManagement() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}, [polling]);
|
}, [polling]);
|
||||||
|
|
||||||
const saveTextFile = () => {
|
const saveTextFile = () => {
|
||||||
const textToSave = data2?.privateKey ?? "";
|
const textToSave = data2?.privateKey ?? "";
|
||||||
const fileName = "privateKey.txt";
|
const fileName = "privateKey.txt";
|
||||||
|
|
|
||||||
|
|
@ -177,13 +177,11 @@ export default function AdminNews() {
|
||||||
setImageNews(image);
|
setImageNews(image);
|
||||||
// Reset the form with new default values
|
// Reset the form with new default values
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (keyId) {
|
if (keyId) {
|
||||||
refetch2();
|
refetch2();
|
||||||
}
|
}
|
||||||
}, [keyId]);
|
}, [keyId]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (data2) {
|
if (data2) {
|
||||||
formEdit.reset({
|
formEdit.reset({
|
||||||
|
|
@ -194,7 +192,6 @@ export default function AdminNews() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [data2]);
|
}, [data2]);
|
||||||
|
|
||||||
// Form Edit
|
// Form Edit
|
||||||
type EditNewsFormValues = z.infer<typeof EditNewsFormSchema>;
|
type EditNewsFormValues = z.infer<typeof EditNewsFormSchema>;
|
||||||
// This can come from your database or API.
|
// This can come from your database or API.
|
||||||
|
|
@ -350,7 +347,6 @@ export default function AdminNews() {
|
||||||
description: "",
|
description: "",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full min-h-[85vh] flex justify-center max-lg:pb-20">
|
<div className="w-full min-h-[85vh] flex justify-center max-lg:pb-20">
|
||||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,10 @@ export default function AdminOrganizations() {
|
||||||
const [keyIdDel, setKeyIdDel] = useState("");
|
const [keyIdDel, setKeyIdDel] = useState("");
|
||||||
const [titleOrg, setTitleOrg] = useState("");
|
const [titleOrg, setTitleOrg] = useState("");
|
||||||
const [descOrg, setDescOrg] = useState("");
|
const [descOrg, setDescOrg] = useState("");
|
||||||
|
|
||||||
const [openAdd, setOpenAdd] = React.useState(false);
|
const [openAdd, setOpenAdd] = React.useState(false);
|
||||||
const [openEdit, setOpenEdit] = React.useState(false);
|
const [openEdit, setOpenEdit] = React.useState(false);
|
||||||
|
|
||||||
const [delOrg, setDelOrg] = React.useState(false);
|
const [delOrg, setDelOrg] = React.useState(false);
|
||||||
|
|
||||||
// List Categories
|
// List Categories
|
||||||
|
|
@ -133,8 +135,9 @@ export default function AdminOrganizations() {
|
||||||
defaultValues: defaultValuesAdd,
|
defaultValues: defaultValuesAdd,
|
||||||
mode: "onChange",
|
mode: "onChange",
|
||||||
});
|
});
|
||||||
|
// Edit Submit
|
||||||
|
|
||||||
|
// ............'Mutation' Change Key Submit
|
||||||
const ChangeOrgMutation = useMutation({
|
const ChangeOrgMutation = useMutation({
|
||||||
mutationKey: ["ChangeOrg"],
|
mutationKey: ["ChangeOrg"],
|
||||||
mutationFn: UpdateOrganization,
|
mutationFn: UpdateOrganization,
|
||||||
|
|
@ -202,7 +205,6 @@ export default function AdminOrganizations() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmitAdd(data: AddOrgFormValues) {
|
function onSubmitAdd(data: AddOrgFormValues) {
|
||||||
AddOrgMutation.mutate({
|
AddOrgMutation.mutate({
|
||||||
title: data.titleOrg,
|
title: data.titleOrg,
|
||||||
|
|
@ -216,7 +218,6 @@ export default function AdminOrganizations() {
|
||||||
description: "",
|
description: "",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full min-h-[85vh] flex justify-center">
|
<div className="w-full min-h-[85vh] flex justify-center">
|
||||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ export default function BoxDashboard({
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
const boxIcons = {
|
const boxIcons = {
|
||||||
"گزارش ناشناس": <EyeOff className=" mb-2 mx-auto" />,
|
"درخواست ناشناس": <EyeOff className=" mb-2 mx-auto" />,
|
||||||
"گزارش شناس": <UserCheck className=" mb-2 mx-auto" />,
|
"درخواست شناس": <UserCheck className=" mb-2 mx-auto" />,
|
||||||
گزارش: <ClipboardList className=" mb-2 mx-auto" />,
|
درخواست: <ClipboardList className=" mb-2 mx-auto" />,
|
||||||
کاربر: <User className=" mb-2 mx-auto" />,
|
کاربر: <User className=" mb-2 mx-auto" />,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ export default function InspectorOperations({
|
||||||
}) {
|
}) {
|
||||||
const [file, setFile] = useState<File[]>([]);
|
const [file, setFile] = useState<File[]>([]);
|
||||||
const [check, setCheck] = useState<any>(false);
|
const [check, setCheck] = useState<any>(false);
|
||||||
const [charCount, setCharCount] = useState<any>(0);
|
const [charCount, setCharCount] = useState(0);
|
||||||
|
|
||||||
// Queries
|
// Queries
|
||||||
const { data, isLoading, refetch } = useQuery({
|
const { data, isLoading, refetch } = useQuery({
|
||||||
|
|
@ -134,10 +134,7 @@ export default function InspectorOperations({
|
||||||
|
|
||||||
// Add the useEffect hook to monitor changes in the description field
|
// Add the useEffect hook to monitor changes in the description field
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const text = form.watch("text") as string;
|
setCharCount(form.watch("text")?.length);
|
||||||
if (charCount != 0) {
|
|
||||||
setCharCount(text?.length);
|
|
||||||
}
|
|
||||||
}, [form.watch("text")]);
|
}, [form.watch("text")]);
|
||||||
|
|
||||||
function handleTextChange(event: React.ChangeEvent<HTMLTextAreaElement>) {
|
function handleTextChange(event: React.ChangeEvent<HTMLTextAreaElement>) {
|
||||||
|
|
@ -322,6 +319,7 @@ export default function InspectorOperations({
|
||||||
<FormControl dir="rtl">
|
<FormControl dir="rtl">
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
|
console.log(field.value);
|
||||||
field.onChange(value);
|
field.onChange(value);
|
||||||
setCheck(false);
|
setCheck(false);
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ export default function TabController() {
|
||||||
setCurrentPage(activePage);
|
setCurrentPage(activePage);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
console.log(currentPage);
|
||||||
const isZero = totalCount === 0;
|
const isZero = totalCount === 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ const TabsList = React.forwardRef<
|
||||||
<TabsPrimitive.List
|
<TabsPrimitive.List
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"inline-flex min-h-[3.1rem] items-center justify-start rounded-md bg-[#E9E9E9] p-2 text-muted-foreground",
|
"inline-flex min-h-[3.5rem] items-center justify-start rounded-md bg-[#E9E9E9] p-2 text-muted-foreground",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ const useSignalR = () => {
|
||||||
const startConnection = async () => {
|
const startConnection = async () => {
|
||||||
try {
|
try {
|
||||||
await connection.start();
|
await connection.start();
|
||||||
|
console.log("SignalR connected");
|
||||||
|
console.log(connection.connectionId);
|
||||||
|
|
||||||
postConnectionIdMutation.mutate(connection.connectionId);
|
postConnectionIdMutation.mutate(connection.connectionId);
|
||||||
connection.on("Created", (message) => {
|
connection.on("Created", (message) => {
|
||||||
|
|
@ -50,7 +52,7 @@ const useSignalR = () => {
|
||||||
startConnection();
|
startConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log(connection.connectionId);
|
||||||
|
|
||||||
// return () => {
|
// return () => {
|
||||||
// if (connection.state === "Connected") {
|
// if (connection.state === "Connected") {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "sootzani",
|
"name": "sootzani",
|
||||||
"version": "0.2.23",
|
"version": "0.2.20",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "sootzani",
|
"name": "sootzani",
|
||||||
"version": "0.2.23",
|
"version": "0.2.20",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^3.3.2",
|
"@hookform/resolvers": "^3.3.2",
|
||||||
"@microsoft/signalr": "^8.0.0",
|
"@microsoft/signalr": "^8.0.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "sootzani",
|
"name": "sootzani",
|
||||||
"version": "0.2.23",
|
"version": "0.2.20",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue