feat(form): add loading state and replace custom switch component
This commit introduces a loading state for form submissions and replaces the custom switch component with a third-party library for improved user experience and maintainability. - Adds `react-switch` as a dependency to replace the custom-built switch component, providing a more robust and feature-rich solution. - Implements a loading indicator on form submission buttons and in the confirmation modal by utilizing the `useIsMutating` hook from TanStack Query. This provides clear visual feedback to the user during asynchronous operations. - Creates a reusable `FormFooter` component to encapsulate the submit and cancel buttons, centralizing the form submission logic and loading state. - Refactors the company create/edit forms to use the new `FormFooter` and `react-switch` components. - Moves the `BreadcrumbItem` type to a shared types file for better code organization.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { title } from "process";
|
||||
import * as Icons from "../icons";
|
||||
import { z } from "zod";
|
||||
import * as Icons from "../icons";
|
||||
const navSubItemSchema: z.ZodType<any> = z.lazy(() =>
|
||||
z.object({
|
||||
title: z.string(),
|
||||
@@ -36,10 +35,16 @@ export const NAV_DATA: NavData = [
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
title: "Companies",
|
||||
url: "/companies",
|
||||
title: "Manage Companies",
|
||||
icon: Icons.Building,
|
||||
items: [],
|
||||
items: [
|
||||
{ Icons: Icons.Building, url: "/companies", title: "Companies" },
|
||||
{
|
||||
Icons: Icons.Building,
|
||||
url: "/companies/categories",
|
||||
title: "Company Categories",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Customers",
|
||||
|
||||
Reference in New Issue
Block a user