From 14f36827ab9599d955649baaecfac4aa51300759 Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Tue, 23 Sep 2025 15:08:37 +0330 Subject: [PATCH 1/5] feat(feedback): Add feedback view for companies and customers This commit introduces the ability to view feedback associated with specific companies and customers directly from their respective tables. To support this, the `TenderFeedbackTable` has been refactored into a more generic `FeedbackTable` component. This new component accepts a `paramKey` prop (e.g., "tender_id", "company_id") to filter feedback for different entities. A new feedback icon has been added to the actions column in both the Companies and Customers tables, providing a direct link to the feedback page for each entry. --- .../companies/feedback/[id]/page.tsx | 29 ++++++++++++ src/app/customers/feedback/[id]/page.tsx | 29 ++++++++++++ src/app/tenders/feedback/[id]/page.tsx | 5 +- src/components/Tables/companies/index.tsx | 9 +++- src/components/Tables/customers/index.tsx | 9 +++- .../feedback => feedback-table}/index.tsx | 47 ++++++++++++------- .../useFeedbackTablePresenter.ts | 36 ++++++++++++++ .../feedback/useTenderFeedbackPresenter.ts | 20 -------- 8 files changed, 143 insertions(+), 41 deletions(-) create mode 100644 src/app/(companies)/companies/feedback/[id]/page.tsx create mode 100644 src/app/customers/feedback/[id]/page.tsx rename src/components/Tables/{tenders/feedback => feedback-table}/index.tsx (69%) create mode 100644 src/components/Tables/feedback-table/useFeedbackTablePresenter.ts delete mode 100644 src/components/Tables/tenders/feedback/useTenderFeedbackPresenter.ts diff --git a/src/app/(companies)/companies/feedback/[id]/page.tsx b/src/app/(companies)/companies/feedback/[id]/page.tsx new file mode 100644 index 0000000..4fd39de --- /dev/null +++ b/src/app/(companies)/companies/feedback/[id]/page.tsx @@ -0,0 +1,29 @@ +"use client"; +import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb"; +import FeedbackTable from "@/components/Tables/feedback-table"; + +import { BreadcrumbItem } from "@/types/shared"; +import { use } from "react"; +interface IProps { + params: Promise<{ + id: string; + }>; +} + +const TenderFeedbackPage = ({ params }: IProps) => { + const { id } = use(params); + + const breadcrumbItems: BreadcrumbItem[] = [ + { href: "/", name: "Dashboard" }, + { href: "/companies", name: "Companies" }, + { href: `/companies/feedback/${id}`, name: "Companies feedback" }, + ]; + return ( + <> + + + + ); +}; + +export default TenderFeedbackPage; diff --git a/src/app/customers/feedback/[id]/page.tsx b/src/app/customers/feedback/[id]/page.tsx new file mode 100644 index 0000000..287e86b --- /dev/null +++ b/src/app/customers/feedback/[id]/page.tsx @@ -0,0 +1,29 @@ +"use client"; +import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb"; +import FeedbackTable from "@/components/Tables/feedback-table"; + +import { BreadcrumbItem } from "@/types/shared"; +import { use } from "react"; +interface IProps { + params: Promise<{ + id: string; + }>; +} + +const TenderFeedbackPage = ({ params }: IProps) => { + const { id } = use(params); + + const breadcrumbItems: BreadcrumbItem[] = [ + { href: "/", name: "Dashboard" }, + { href: "/customers", name: "Customers" }, + { href: `/customers/feedback/${id}`, name: "Customers feedback" }, + ]; + return ( + <> + + + + ); +}; + +export default TenderFeedbackPage; diff --git a/src/app/tenders/feedback/[id]/page.tsx b/src/app/tenders/feedback/[id]/page.tsx index 60c1f9a..9b0f4c5 100644 --- a/src/app/tenders/feedback/[id]/page.tsx +++ b/src/app/tenders/feedback/[id]/page.tsx @@ -1,6 +1,7 @@ "use client"; import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb"; -import TenderFeedbackTable from "@/components/Tables/tenders/feedback"; +import FeedbackTable from "@/components/Tables/feedback-table"; + import { BreadcrumbItem } from "@/types/shared"; import { use } from "react"; interface IProps { @@ -20,7 +21,7 @@ const TenderFeedbackPage = ({ params }: IProps) => { return ( <> - + ); }; diff --git a/src/components/Tables/companies/index.tsx b/src/components/Tables/companies/index.tsx index ebea5d1..8fc3357 100644 --- a/src/components/Tables/companies/index.tsx +++ b/src/components/Tables/companies/index.tsx @@ -1,5 +1,5 @@ "use client"; -import { PencilSquareIcon, TrashIcon } from "@/assets/icons"; +import { FeedbackIcon, PencilSquareIcon, TrashIcon } from "@/assets/icons"; import ConfirmationModal from "@/components/ui/ConfirmationModal"; import { Table, @@ -112,6 +112,13 @@ const CompaniesTable = ({}: IProps) => { Edit Company + diff --git a/src/components/Tables/customers/index.tsx b/src/components/Tables/customers/index.tsx index 79c303f..fa72860 100644 --- a/src/components/Tables/customers/index.tsx +++ b/src/components/Tables/customers/index.tsx @@ -1,5 +1,5 @@ "use client"; -import { PencilSquareIcon, TrashIcon } from "@/assets/icons"; +import { FeedbackIcon, PencilSquareIcon, TrashIcon } from "@/assets/icons"; import ConfirmationModal from "@/components/ui/ConfirmationModal"; import { Table, @@ -117,6 +117,13 @@ const CustomersTable = () => { Assign To Company + diff --git a/src/components/Tables/tenders/feedback/index.tsx b/src/components/Tables/feedback-table/index.tsx similarity index 69% rename from src/components/Tables/tenders/feedback/index.tsx rename to src/components/Tables/feedback-table/index.tsx index 509b496..3dbd299 100644 --- a/src/components/Tables/tenders/feedback/index.tsx +++ b/src/components/Tables/feedback-table/index.tsx @@ -1,31 +1,39 @@ -"use client"; - import { ExclamationIcon } from "@/assets/icons"; -import { ShowcaseSection } from "@/components/Layouts/showcase-section"; import { Table, TableBody, TableCell, TableHead, TableHeader, + TableRow, } from "@/components/ui/table"; import TableSkeleton from "@/components/ui/TableSkeleton"; import { cn } from "@/lib/utils"; -import { unixToDate } from "@/utils/shared"; -import { TableRow } from "../../../ui/table"; -import useTenderFeedbackPresenter from "./useTenderFeedbackPresenter"; +import { capitalize, unixToDate } from "@/utils/shared"; +import { ShowcaseSection } from "@/components/Layouts/showcase-section"; +import useFeedbackTablePresenter from "./useFeedbackTablePresenter"; interface IProps { id: string; + paramKey: "tender_id" | "company_id" | "customer_id"; } +const FeedbackTable = ({ id, paramKey }: IProps) => { + const { + columns, + feedback, + isLoading, + pathName, + router, + getShowcaseSectionTitle, + } = useFeedbackTablePresenter({ id, paramKey }); -const TenderFeedbackTable = ({ id }: IProps) => { - const { feedback, isLoading, columns, pathName, router } = - useTenderFeedbackPresenter({ id }); return ( @@ -38,11 +46,16 @@ const TenderFeedbackTable = ({ id }: IProps) => { {isLoading && } + - {feedback?.map((item, index) => - !item ? ( -
No feedback is submitted for this tender
- ) : ( + {!feedback?.length ? ( + + +

No feedback

+
+
+ ) : ( + feedback?.map((item, index) => ( { - ), + )) )}
@@ -82,4 +95,4 @@ const TenderFeedbackTable = ({ id }: IProps) => { ); }; -export default TenderFeedbackTable; +export default FeedbackTable; diff --git a/src/components/Tables/feedback-table/useFeedbackTablePresenter.ts b/src/components/Tables/feedback-table/useFeedbackTablePresenter.ts new file mode 100644 index 0000000..4db3a17 --- /dev/null +++ b/src/components/Tables/feedback-table/useFeedbackTablePresenter.ts @@ -0,0 +1,36 @@ +import { useGetFeedback } from "@/hooks/queries"; +import { usePathname, useRouter } from "next/navigation"; + +interface IProps { + id: string; + paramKey: "tender_id" | "company_id" | "customer_id"; +} +const useFeedbackTablePresenter = ({ id, paramKey }: IProps) => { + const { data, isLoading } = useGetFeedback({ [paramKey]: id }); + const router = useRouter(); + const pathName = usePathname(); + const columns = [ + "row", + "feedback type", + "updated at", + "created at", + "actions", + ]; + const getShowcaseSectionTitle = () => { + if (paramKey === "tender_id") { + return `: ${data?.data?.[0]?.tender?.title}`; + } else { + return ""; + } + }; + return { + isLoading, + feedback: data?.data, + columns, + pathName, + router, + getShowcaseSectionTitle, + }; +}; + +export default useFeedbackTablePresenter; diff --git a/src/components/Tables/tenders/feedback/useTenderFeedbackPresenter.ts b/src/components/Tables/tenders/feedback/useTenderFeedbackPresenter.ts deleted file mode 100644 index 2f10c74..0000000 --- a/src/components/Tables/tenders/feedback/useTenderFeedbackPresenter.ts +++ /dev/null @@ -1,20 +0,0 @@ -"use client"; -import { useGetFeedback } from "@/hooks/queries"; -import { usePathname, useRouter } from "next/navigation"; - -const useTenderFeedbackPresenter = ({ id }: { id: string }) => { - const { data, isLoading } = useGetFeedback({ tender_id: id }); - const router = useRouter(); - const pathName = usePathname(); - const columns = [ - "row", - "feedback type", - "updated at", - - "created at", - "actions", - ]; - return { feedback: data?.data, isLoading, columns, pathName, router }; -}; - -export default useTenderFeedbackPresenter; From c146f1175c477cb7c3c76863a777da556f80c955 Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Tue, 23 Sep 2025 15:25:30 +0330 Subject: [PATCH 2/5] fixed: edit customer company not appearing --- src/components/forms/customers/CreateCustomer.tsx | 3 ++- .../forms/customers/useCreateCustomerPresenter.ts | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/forms/customers/CreateCustomer.tsx b/src/components/forms/customers/CreateCustomer.tsx index f7ccbce..a519cba 100644 --- a/src/components/forms/customers/CreateCustomer.tsx +++ b/src/components/forms/customers/CreateCustomer.tsx @@ -17,7 +17,7 @@ interface IProps { } const CreateCustomer = ({ defaultValues, editMode, id }: IProps) => { - const { errors, handleSubmit, register, onSubmit, companies, router } = + const { errors, handleSubmit, register, watch, onSubmit, companies, router } = useCreateCustomerPresenter({ defaultValues, editMode, id }); return ( @@ -54,6 +54,7 @@ const CreateCustomer = ({ defaultValues, editMode, id }: IProps) => {
({ diff --git a/src/components/forms/customers/useCreateCustomerPresenter.ts b/src/components/forms/customers/useCreateCustomerPresenter.ts index 8e475ca..5060f28 100644 --- a/src/components/forms/customers/useCreateCustomerPresenter.ts +++ b/src/components/forms/customers/useCreateCustomerPresenter.ts @@ -7,6 +7,7 @@ import { } from "@/hooks/queries"; import { CreateCustomerCredentials } from "@/lib/api"; import { useRouter } from "next/navigation"; +import { useEffect } from "react"; import { SubmitHandler, useForm } from "react-hook-form"; interface IProps { @@ -24,6 +25,8 @@ const useCreateCustomerPresenter = ({ register, handleSubmit, formState: { errors }, + setValue, + watch, } = useForm({ mode: "onChange", defaultValues, @@ -34,6 +37,14 @@ const useCreateCustomerPresenter = ({ id as string, ); const { data: companies } = useCompanyFullList(); + useEffect(() => { + if (defaultValues) { + const companies = defaultValues?.companies?.map( + (company: any) => company.id, + ); + setValue("companies", companies); + } + }, [defaultValues]); const onSubmit: SubmitHandler = (data) => { if (editMode) { updateCustomer({ @@ -41,7 +52,6 @@ const useCreateCustomerPresenter = ({ credentials: data, }); } else { - createCustomer({ ...data, employee_count: data.employee_count ? +data.employee_count : undefined, @@ -52,6 +62,7 @@ const useCreateCustomerPresenter = ({ }; return { handleSubmit, + watch, register, errors, onSubmit, From 708f35cf02de3dae81f679a253ff25a72976ebef Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Tue, 23 Sep 2025 15:57:51 +0330 Subject: [PATCH 3/5] changed icons --- src/assets/icons.tsx | 30 +++++++++++------------ src/components/Tables/companies/index.tsx | 5 ++-- src/components/Tables/customers/index.tsx | 5 ++-- src/components/Tables/tenders/index.tsx | 8 +++--- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/assets/icons.tsx b/src/assets/icons.tsx index 4b3433d..7028117 100644 --- a/src/assets/icons.tsx +++ b/src/assets/icons.tsx @@ -214,7 +214,20 @@ export function GlobeIcon(props: IconProps) { ); } - +export function EyeIcon(props: IconProps) { + return ( + + + + ); +} export function UserSettingIcon(props: IconProps) { return ( ); } -export function FeedbackIcon(props: IconProps) { - return ( - - - - ); -} + export function PasswordIcon(props: IconProps) { return ( {
diff --git a/src/components/Tables/customers/index.tsx b/src/components/Tables/customers/index.tsx index fa72860..9a33053 100644 --- a/src/components/Tables/customers/index.tsx +++ b/src/components/Tables/customers/index.tsx @@ -1,5 +1,5 @@ "use client"; -import { FeedbackIcon, PencilSquareIcon, TrashIcon } from "@/assets/icons"; +import { ExclamationIcon, PencilSquareIcon, TrashIcon } from "@/assets/icons"; import ConfirmationModal from "@/components/ui/ConfirmationModal"; import { Table, @@ -118,11 +118,12 @@ const CustomersTable = () => { diff --git a/src/components/Tables/tenders/index.tsx b/src/components/Tables/tenders/index.tsx index 3518cba..547219a 100644 --- a/src/components/Tables/tenders/index.tsx +++ b/src/components/Tables/tenders/index.tsx @@ -11,7 +11,7 @@ import { } from "@/components/ui/table"; import useTenderListPresenter from "./useTenderListPresenter"; -import { ExclamationIcon, FeedbackIcon } from "@/assets/icons"; +import { ExclamationIcon, EyeIcon } from "@/assets/icons"; import Pagination from "@/components/ui/pagination"; import TableSkeleton from "@/components/ui/TableSkeleton"; import { cn } from "@/lib/utils"; @@ -70,19 +70,19 @@ const TendersTable = () => { colSpan={100} > From 3801073fd7bd341d138404b3e3276d0d00018560 Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Wed, 24 Sep 2025 10:45:45 +0330 Subject: [PATCH 4/5] feat: Add loading states and improve form handling This commit introduces several enhancements to form components and user experience across the application. - **Sign-in Form:** - Implemented a loading state using `useIsMutating` from TanStack Query. - The username and password fields are now disabled during the login process to prevent concurrent submissions. - The "Sign in" button displays a spinner while the mutation is pending, providing clear visual feedback. - **Assign to Company Modal:** - Refactored the modal to use `react-hook-form` for more robust state management and validation. - The form submission button is now disabled while the assignment request is in progress. - **Tag Input Component:** - Added a new `shouldAddWithSpace` prop to allow creating tags by pressing the space bar, increasing the component's flexibility. - **Header:** - Corrected the image path for the mobile header logo to display the correct icon. --- src/components/Auth/SigninWithPassword.tsx | 21 ++++++++----- .../FormElements/InputGroup/tag-input.tsx | 10 +++++-- src/components/Layouts/header/index.tsx | 2 +- .../customers/AssignToCompanyModalContent.tsx | 30 +++++++++---------- src/components/Tables/customers/index.tsx | 8 ++++- .../customers/useCustomerListPresenter.ts | 6 ++-- .../forms/companies/CreateCompany.tsx | 1 + .../forms/customers/CreateCustomer.tsx | 3 +- src/constants/regex.ts | 1 + src/hooks/queries/useUsersQueries.ts | 9 +++--- 10 files changed, 58 insertions(+), 33 deletions(-) diff --git a/src/components/Auth/SigninWithPassword.tsx b/src/components/Auth/SigninWithPassword.tsx index 211cb40..f8b86ea 100644 --- a/src/components/Auth/SigninWithPassword.tsx +++ b/src/components/Auth/SigninWithPassword.tsx @@ -1,30 +1,32 @@ "use client"; import { PasswordIcon, UserIcon } from "@/assets/icons"; -import InputGroup from "../FormElements/InputGroup"; -import { SubmitHandler, useForm } from "react-hook-form"; -import { ILoginCredentials } from "@/lib/api"; import { useLoginQuery } from "@/hooks/queries"; -import { useRef, useState } from "react"; +import { ILoginCredentials } from "@/lib/api"; +import { useState } from "react"; +import { SubmitHandler, useForm } from "react-hook-form"; +import InputGroup from "../FormElements/InputGroup"; import { FormErrorMessages } from "@/constants/Texts"; +import { useIsMutating } from "@tanstack/react-query"; export default function SigninWithPassword() { + const isMutating = useIsMutating(); const [passwordFieldInputType, setPasswordFieldInputType] = useState< "password" | "text" >("password"); const { handleSubmit, control, reset, register } = useForm(); - const { mutate, isPending } = useLoginQuery(); + const { mutate } = useLoginQuery(reset); const onSubmit: SubmitHandler = (data) => { mutate(data); - reset(); }; return (
- Sign In + {isMutating ? ( +
+ ) : ( + "Sign in" + )} diff --git a/src/components/FormElements/InputGroup/tag-input.tsx b/src/components/FormElements/InputGroup/tag-input.tsx index 084f2cb..ade2004 100644 --- a/src/components/FormElements/InputGroup/tag-input.tsx +++ b/src/components/FormElements/InputGroup/tag-input.tsx @@ -28,6 +28,7 @@ type TagInputProps = { watch?: UseFormWatch; errors?: FieldErrors; maxTags?: number; + shouldAddWithSpace?: boolean; allowDuplicates?: boolean; tagValidator?: (tag: string) => boolean; } & Partial; @@ -43,6 +44,7 @@ const TagInput = ({ name, register, setValue, + shouldAddWithSpace = false, watch, errors, maxTags, @@ -87,7 +89,11 @@ const TagInput = ({ }; const handleKeyDown = (e: KeyboardEvent) => { - if (e.key === "Enter" || e.key === ",") { + if ( + e.key === "Enter" || + e.key === "," || + (shouldAddWithSpace && e.key === " ") + ) { e.preventDefault(); addTag(inputValue); } else if (e.key === "Backspace" && !inputValue && tags.length > 0) { @@ -167,7 +173,7 @@ const TagInput = ({ 0 ? JSON.stringify(tags) : ''} + value={tags.length > 0 ? JSON.stringify(tags) : ""} ref={ref} /> diff --git a/src/components/Layouts/header/index.tsx b/src/components/Layouts/header/index.tsx index da417b0..a7a7dd3 100644 --- a/src/components/Layouts/header/index.tsx +++ b/src/components/Layouts/header/index.tsx @@ -24,7 +24,7 @@ export function Header() { {isMobile && ( + SetStateAction >; + defaultValues?: TAssignCustomerToCompanyCredentials; } -const AssignToCompanyModalContent: FC = ({ setCompanies }) => { +const AssignToCompanyModalContent: FC = ({ + setCompanies, + defaultValues, +}) => { const [options, setOptions] = useState([]); const { data, status, isSuccess } = useCompanyFullList(); const { handleSubmit, register } = - useForm(); + useForm({ + mode: "onChange", + defaultValues, + }); useEffect(() => { if (isSuccess) { diff --git a/src/components/Tables/customers/index.tsx b/src/components/Tables/customers/index.tsx index 9a33053..0d0d4da 100644 --- a/src/components/Tables/customers/index.tsx +++ b/src/components/Tables/customers/index.tsx @@ -112,6 +112,9 @@ const CustomersTable = () => { onClick={() => { setCurrentCustomer(customer); setIsAssignCompanyModalOpen(true); + setSelectedCompanies({ + company_ids: [customer?.companies?.[0]?.id ?? ""], + }); }} > Assign To Company @@ -145,7 +148,10 @@ const CustomersTable = () => { isOpen={isAssignCompanyModalOpen} onClose={() => setIsAssignCompanyModalOpen(false)} > - + {isModalOpen && ( { const [isAssignCompanyModalOpen, setIsAssignCompanyModalOpen] = useState(false); - const [selectedCompanies, setSelectedCompanies] = - useState(null); + const [selectedCompanies, setSelectedCompanies] = useState< + TAssignCustomerToCompanyCredentials | undefined + >(); const [currentCustomer, setCurrentCustomer] = useState( null, ); @@ -50,6 +51,7 @@ const useCustomerListPresenter = () => { deleteCustomer(currentCustomer.id); } }; + const customers = data?.pages.flatMap((page) => page.data.customers) ?? []; return { allCustomers: customers, diff --git a/src/components/forms/companies/CreateCompany.tsx b/src/components/forms/companies/CreateCompany.tsx index 51c8992..87e9572 100644 --- a/src/components/forms/companies/CreateCompany.tsx +++ b/src/components/forms/companies/CreateCompany.tsx @@ -497,6 +497,7 @@ const CreateCompany = ({ defaultValues, editMode, id }: IProps) => { {...register("tags.cpv_codes")} label="CPV codes" name="tags.cpv_codes" + shouldAddWithSpace watch={watch} setValue={setValue} placeholder="Enter Tag CPV codes" diff --git a/src/components/forms/customers/CreateCustomer.tsx b/src/components/forms/customers/CreateCustomer.tsx index a519cba..3371748 100644 --- a/src/components/forms/customers/CreateCustomer.tsx +++ b/src/components/forms/customers/CreateCustomer.tsx @@ -6,6 +6,7 @@ import MultiSelect from "@/components/FormElements/MultiSelect"; import { Select } from "@/components/FormElements/select"; import { ShowcaseSection } from "@/components/Layouts/showcase-section"; import FormFooter from "@/components/ui/FormFooter"; +import { USERNAME_REGEX } from "@/constants/regex"; import { FormErrorMessages } from "@/constants/Texts"; import { CreateCustomerCredentials } from "@/lib/api"; import useCreateCustomerPresenter from "./useCreateCustomerPresenter"; @@ -36,7 +37,7 @@ const CreateCustomer = ({ defaultValues, editMode, id }: IProps) => { message: FormErrorMessages.maxLength(30), }, pattern: { - value: /^[a-zA-Z0-9](?:[a-zA-Z0-9._]*[a-zA-Z0-9])?$/, + value: USERNAME_REGEX, message: FormErrorMessages.invalidPattern, }, })} diff --git a/src/constants/regex.ts b/src/constants/regex.ts index 72881aa..90e6dcb 100644 --- a/src/constants/regex.ts +++ b/src/constants/regex.ts @@ -1 +1,2 @@ export const PHONE_REGEX = /^[+\d]+$/; +export const USERNAME_REGEX = /^[a-zA-Z0-9](?:[a-zA-Z0-9._]*[a-zA-Z0-9])?$/; diff --git a/src/hooks/queries/useUsersQueries.ts b/src/hooks/queries/useUsersQueries.ts index f8ac8c1..602098f 100644 --- a/src/hooks/queries/useUsersQueries.ts +++ b/src/hooks/queries/useUsersQueries.ts @@ -10,7 +10,7 @@ import { useRouter } from "next/navigation"; import { useMemo } from "react"; import { toast } from "react-toastify"; -export const useLoginQuery = () => { +export const useLoginQuery = (callback?: () => void) => { const mutationKey = useMemo(() => [API_ENDPOINTS.USER.LOGIN], []); const { setAuthState } = useUser(); const router = useRouter(); @@ -18,9 +18,10 @@ export const useLoginQuery = () => { mutationKey, mutationFn: userService.login, onSuccess: (response) => { - if (response.success) { - setAuthState(response.data); - router.replace("/charts"); + setAuthState(response.data); + router.replace("/charts"); + if (callback) { + callback(); } }, }); From 339fb770fa5faf286fe5483c873a111b209abc31 Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Wed, 24 Sep 2025 11:56:46 +0330 Subject: [PATCH 5/5] refactor(companies-table): Simplify table and correct cell component The 'City' and 'Postal Code' columns have been removed from the companies table to simplify the UI and reduce visual clutter. This change is reflected in both the table's JSX structure and the `useCompanyListPresenter` hook that defines the table headers. Additionally, the `TableHead` component was incorrectly used for data cells within the table body. This has been fixed by replacing it with the semantically correct `TableCell` component. --- src/components/Tables/companies/index.tsx | 42 ++++++++----------- .../companies/useCompanyListPresenter.ts | 3 +- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/components/Tables/companies/index.tsx b/src/components/Tables/companies/index.tsx index 2645a7c..f42c1ce 100644 --- a/src/components/Tables/companies/index.tsx +++ b/src/components/Tables/companies/index.tsx @@ -58,39 +58,33 @@ const CompaniesTable = ({}: IProps) => { key={company.id} className="odd:bg-gray-2 dark:odd:bg-gray-7" > - + {index + 1} - - + + {company.name} - - + + {company.email} - - + + {formatPhoneNumber(company.phone)} - - + + {company.address.country} - - + + {company.address.state} - - - {company.address.city} - - - {company.address.postal_code} - - + + {company.language} - - + + {company.currency} - - + + {company.employee_count} - +