refactor: simplify naming after filter removal

This commit is contained in:
Rafael Taranto 2025-05-20 12:47:05 +01:00
parent 8e4bb9a3fb
commit 82132e8eb8
2 changed files with 6 additions and 7 deletions

View file

@ -86,13 +86,13 @@ const Customers = () => {
const handleCustomerClicked = customer => const handleCustomerClicked = customer =>
navigate(`/compliance/customer/${customer.id}`) navigate(`/compliance/customer/${customer.id}`)
const [filteredCustomers, setFilteredCustomers] = useState([]) const [customers, setCustomers] = useState([])
const [showCreationModal, setShowCreationModal] = useState(false) const [showCreationModal, setShowCreationModal] = useState(false)
const { data: customersResponse, loading: customerLoading } = useQuery( const { data: customersResponse, loading: customerLoading } = useQuery(
GET_CUSTOMERS, GET_CUSTOMERS,
{ {
onCompleted: data => setFilteredCustomers(R.path(['customers'])(data)), onCompleted: data => setCustomers(R.path(['customers'])(data)),
}, },
) )
@ -123,7 +123,7 @@ const Customers = () => {
const customersData = R.pipe( const customersData = R.pipe(
R.map(setAuthorizedStatus), R.map(setAuthorizedStatus),
R.sortWith([R.ascend(byAuthorized), R.descend(byLastActive)]), R.sortWith([R.ascend(byAuthorized), R.descend(byLastActive)]),
)(filteredCustomers ?? []) )(customers ?? [])
return ( return (
<> <>
@ -143,7 +143,7 @@ const Customers = () => {
/> />
<CustomersList <CustomersList
data={customersData} data={customersData}
locale={locale} country={locale?.country}
onClick={handleCustomerClicked} onClick={handleCustomerClicked}
loading={customerLoading} loading={customerLoading}
/> />

View file

@ -12,19 +12,18 @@ import {
import { getFormattedPhone, getName } from './helper' import { getFormattedPhone, getName } from './helper'
const CustomersList = ({ data, locale, onClick, loading }) => { const CustomersList = ({ data, country, onClick, loading }) => {
const columns = useMemo( const columns = useMemo(
() => [ () => [
{ {
accessorKey: 'id', accessorKey: 'id',
header: 'ID', header: 'ID',
size: 315, size: 315,
enableColumnFilter: true,
}, },
{ {
id: 'phone-email', id: 'phone-email',
accessorFn: it => accessorFn: it =>
`${getFormattedPhone(it.phone, locale.country) || ''} ${it.email || ''}`, `${getFormattedPhone(it.phone, country) || ''} ${it.email || ''}`,
size: 180, size: 180,
header: 'Phone/email', header: 'Phone/email',
}, },