Add: shared skeleton, dark toggle bg, fixed: multi select patching issue

This commit is contained in:
AmirReza Jamali
2025-09-20 19:35:58 +03:30
parent 0ea2ff635b
commit 4a7a1c66f7
14 changed files with 48 additions and 216 deletions
@@ -7,6 +7,7 @@ import {
import { ICreateCompanyCredentials } from "@/lib/api";
import { useIsMutating } from "@tanstack/react-query";
import { useRouter } from "next/navigation";
import { useEffect } from "react";
import { SubmitHandler, useForm } from "react-hook-form";
interface IProps {
@@ -28,15 +29,17 @@ const useCreateCompanyPresenter = ({ defaultValues, editMode, id }: IProps) => {
mode: "onChange",
defaultValues: {
...defaultValues,
tags: {
...defaultValues?.tags,
categories: defaultValues?.tags.categories.map((item) => ({
value: item.id,
text: item.name,
})),
},
},
});
useEffect(() => {
if (defaultValues) {
const categories = defaultValues?.tags.categories.map(
(item: any) => item.id,
);
setValue("tags.categories", categories);
}
}, [defaultValues]);
const router = useRouter();
const { data: companyCategories } = useCompanyCategoriesQuery();
const { mutate: createCompany, isPending: isCreating } = useCreateCompany();