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() {
|
||||
const router = useRouter();
|
||||
// states
|
||||
|
||||
const [keyId, setKeyId] = useState("");
|
||||
const [keyIdDel, setKeyIdDel] = useState("");
|
||||
const [titleCat, setTitleCat] = useState("");
|
||||
|
|
@ -88,6 +88,7 @@ export default function AdminCategories() {
|
|||
} = useQuery({
|
||||
queryKey: ["CategoriesList"],
|
||||
queryFn: () => GetAllCategories(),
|
||||
// refetchOnWindowFocus: false,
|
||||
});
|
||||
|
||||
// Edit
|
||||
|
|
@ -208,12 +209,12 @@ export default function AdminCategories() {
|
|||
});
|
||||
}
|
||||
|
||||
const resetFormAdd = () => {
|
||||
const resetFormAdd = () => {
|
||||
formAdd.reset({
|
||||
titleCategory: "",
|
||||
description: "",
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="w-full min-h-[85vh] flex justify-center">
|
||||
|
|
@ -243,12 +244,7 @@ export default function AdminCategories() {
|
|||
<p className="text-[#464646] text-base font-bold">
|
||||
افزودن دسته بندی
|
||||
</p>
|
||||
<AlertDialogCancel
|
||||
className="h-auto p-0 border-0"
|
||||
onClick={() => {
|
||||
resetFormAdd();
|
||||
}}
|
||||
>
|
||||
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
||||
<IoMdClose />
|
||||
</AlertDialogCancel>
|
||||
</AlertDialogTitle>
|
||||
|
|
@ -313,12 +309,7 @@ export default function AdminCategories() {
|
|||
>
|
||||
افزودن
|
||||
</Button>
|
||||
<AlertDialogCancel
|
||||
className="mt-0 text-white bg-blue rounded-xl"
|
||||
onClick={() => {
|
||||
resetFormAdd();
|
||||
}}
|
||||
>
|
||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl" onClick={() => { resetFormAdd(); }}>
|
||||
بستن
|
||||
</AlertDialogCancel>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -50,6 +50,23 @@ const MAX_FILE_SIZE = 5242880; // 5 MB
|
|||
// Edit Key Form
|
||||
const FormSchemaEditKey = z.object({
|
||||
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
|
||||
|
|
@ -75,8 +92,7 @@ export default function AdminKeysManagement() {
|
|||
const inputPubRef = useRef<HTMLTextAreaElement | null>(null);
|
||||
const inputPrvRef = useRef<HTMLTextAreaElement | null>(null);
|
||||
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
||||
|
||||
|
||||
// ..............Read .txt
|
||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||
const handleFileChange = (event: any) => {
|
||||
const file = event.target.files[0];
|
||||
|
|
@ -190,7 +206,7 @@ export default function AdminKeysManagement() {
|
|||
publicKey: data.publicKey,
|
||||
});
|
||||
}
|
||||
|
||||
// const { resetField } = useForm();
|
||||
|
||||
// List Keys
|
||||
const {
|
||||
|
|
@ -202,6 +218,7 @@ export default function AdminKeysManagement() {
|
|||
} = useQuery({
|
||||
queryKey: ["KeysList"],
|
||||
queryFn: () => GetKeys(),
|
||||
// refetchOnWindowFocus: false,
|
||||
});
|
||||
|
||||
// GenerateKeyPair
|
||||
|
|
@ -236,6 +253,17 @@ export default function AdminKeysManagement() {
|
|||
}
|
||||
}, [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 = () => {
|
||||
ChangeKeyMutation.mutate({
|
||||
privateKey: "",
|
||||
|
|
@ -256,7 +284,6 @@ export default function AdminKeysManagement() {
|
|||
};
|
||||
}
|
||||
}, [polling]);
|
||||
|
||||
const saveTextFile = () => {
|
||||
const textToSave = data2?.privateKey ?? "";
|
||||
const fileName = "privateKey.txt";
|
||||
|
|
|
|||
|
|
@ -177,13 +177,11 @@ export default function AdminNews() {
|
|||
setImageNews(image);
|
||||
// Reset the form with new default values
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (keyId) {
|
||||
refetch2();
|
||||
}
|
||||
}, [keyId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (data2) {
|
||||
formEdit.reset({
|
||||
|
|
@ -194,7 +192,6 @@ export default function AdminNews() {
|
|||
});
|
||||
}
|
||||
}, [data2]);
|
||||
|
||||
// Form Edit
|
||||
type EditNewsFormValues = z.infer<typeof EditNewsFormSchema>;
|
||||
// This can come from your database or API.
|
||||
|
|
@ -350,7 +347,6 @@ export default function AdminNews() {
|
|||
description: "",
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<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 ">
|
||||
|
|
|
|||
|
|
@ -76,8 +76,10 @@ export default function AdminOrganizations() {
|
|||
const [keyIdDel, setKeyIdDel] = useState("");
|
||||
const [titleOrg, setTitleOrg] = useState("");
|
||||
const [descOrg, setDescOrg] = useState("");
|
||||
|
||||
const [openAdd, setOpenAdd] = React.useState(false);
|
||||
const [openEdit, setOpenEdit] = React.useState(false);
|
||||
|
||||
const [delOrg, setDelOrg] = React.useState(false);
|
||||
|
||||
// List Categories
|
||||
|
|
@ -133,8 +135,9 @@ export default function AdminOrganizations() {
|
|||
defaultValues: defaultValuesAdd,
|
||||
mode: "onChange",
|
||||
});
|
||||
// Edit Submit
|
||||
|
||||
|
||||
// ............'Mutation' Change Key Submit
|
||||
const ChangeOrgMutation = useMutation({
|
||||
mutationKey: ["ChangeOrg"],
|
||||
mutationFn: UpdateOrganization,
|
||||
|
|
@ -202,7 +205,6 @@ export default function AdminOrganizations() {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
function onSubmitAdd(data: AddOrgFormValues) {
|
||||
AddOrgMutation.mutate({
|
||||
title: data.titleOrg,
|
||||
|
|
@ -216,7 +218,6 @@ export default function AdminOrganizations() {
|
|||
description: "",
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<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 ">
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ export default function BoxDashboard({
|
|||
}) {
|
||||
|
||||
const boxIcons = {
|
||||
"گزارش ناشناس": <EyeOff className=" mb-2 mx-auto" />,
|
||||
"گزارش شناس": <UserCheck className=" mb-2 mx-auto" />,
|
||||
گزارش: <ClipboardList className=" mb-2 mx-auto" />,
|
||||
"درخواست ناشناس": <EyeOff className=" mb-2 mx-auto" />,
|
||||
"درخواست شناس": <UserCheck className=" mb-2 mx-auto" />,
|
||||
درخواست: <ClipboardList 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 [check, setCheck] = useState<any>(false);
|
||||
const [charCount, setCharCount] = useState<any>(0);
|
||||
const [charCount, setCharCount] = useState(0);
|
||||
|
||||
// Queries
|
||||
const { data, isLoading, refetch } = useQuery({
|
||||
|
|
@ -134,10 +134,7 @@ export default function InspectorOperations({
|
|||
|
||||
// Add the useEffect hook to monitor changes in the description field
|
||||
useEffect(() => {
|
||||
const text = form.watch("text") as string;
|
||||
if (charCount != 0) {
|
||||
setCharCount(text?.length);
|
||||
}
|
||||
setCharCount(form.watch("text")?.length);
|
||||
}, [form.watch("text")]);
|
||||
|
||||
function handleTextChange(event: React.ChangeEvent<HTMLTextAreaElement>) {
|
||||
|
|
@ -322,6 +319,7 @@ export default function InspectorOperations({
|
|||
<FormControl dir="rtl">
|
||||
<RadioGroup
|
||||
onValueChange={(value) => {
|
||||
console.log(field.value);
|
||||
field.onChange(value);
|
||||
setCheck(false);
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ export default function TabController() {
|
|||
setCurrentPage(activePage);
|
||||
}
|
||||
}, []);
|
||||
|
||||
console.log(currentPage);
|
||||
const isZero = totalCount === 0;
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ const TabsList = React.forwardRef<
|
|||
<TabsPrimitive.List
|
||||
ref={ref}
|
||||
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
|
||||
)}
|
||||
{...props}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ const useSignalR = () => {
|
|||
const startConnection = async () => {
|
||||
try {
|
||||
await connection.start();
|
||||
console.log("SignalR connected");
|
||||
console.log(connection.connectionId);
|
||||
|
||||
postConnectionIdMutation.mutate(connection.connectionId);
|
||||
connection.on("Created", (message) => {
|
||||
|
|
@ -50,7 +52,7 @@ const useSignalR = () => {
|
|||
startConnection();
|
||||
}
|
||||
|
||||
|
||||
// console.log(connection.connectionId);
|
||||
|
||||
// return () => {
|
||||
// if (connection.state === "Connected") {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "sootzani",
|
||||
"version": "0.2.23",
|
||||
"version": "0.2.20",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "sootzani",
|
||||
"version": "0.2.23",
|
||||
"version": "0.2.20",
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.2",
|
||||
"@microsoft/signalr": "^8.0.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sootzani",
|
||||
"version": "0.2.23",
|
||||
"version": "0.2.20",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
|
|
|||
Loading…
Reference in New Issue