Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
aatbip committed Feb 6, 2024
1 parent 7e1f923 commit 795574b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/app/manage/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ export default async function ManagePage({ searchParams }: { searchParams: { tok
const settings = await getSettings({ token, portalId }).then((s) => s.profileLinks);
const customFieldAccess = await getCustomFieldAccess({ token, portalId });
// static for now, will be dynamic later after some API decisions are made
// const clientId = 'a583a0d0-de70-4d14-8bb1-0aacf7424e2c';
// const companyId = '52eb75a9-2790-4e37-aa7a-c13f7bc3aa91';
const clientId = '2b37da9b-73b9-4c28-b7ac-144cf39cb13b';
const companyId = 'b5b3883c-f3e7-40e2-98e8-4f4b195ba98e';
const clientId = 'a583a0d0-de70-4d14-8bb1-0aacf7424e2c';
const companyId = '52eb75a9-2790-4e37-aa7a-c13f7bc3aa91';
// const clientId = '2b37da9b-73b9-4c28-b7ac-144cf39cb13b';
// const companyId = 'b5b3883c-f3e7-40e2-98e8-4f4b195ba98e';
const client = await getClient(clientId, token);

return (
Expand Down
26 changes: 19 additions & 7 deletions src/components/table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,27 @@ export const TableCore = () => {
return 0;
};

const comparatorTypeII = (valueA: any, valueB: any) => {
if (valueA.row[valueA.key].value < valueB.row[valueB.key].value) {
return -1;
}
if (valueA.row[valueA.key].value > valueB.row[valueB.key].value) {
return 1;
const comparatorTypeII = (valueA: any, valueB: any, nodeA: any, nodeB: any, isInverted: any) => {
const _valueA = valueA.row[valueA.key].value;
const _valueB = valueB.row[valueB.key].value;
if (_valueA === null && _valueB === null) {
return 0; // Both are considered equal
} else if (_valueA === null) {
return isInverted ? -1 : 1; // Null comes before a non-null string/number
} else if (_valueB === null) {
return isInverted ? 1 : -1; // Non-null string/number comes before null
}

return 0;
// Convert values to strings for consistent comparison
const stringA: any = String(_valueA);
const stringB: any = String(_valueB);

// Perform lexicographical comparison for strings, numeric comparison for numbers
if (!isNaN(stringA) && !isNaN(stringB)) {
return parseFloat(stringA) - parseFloat(stringB);
} else {
return stringA.localeCompare(stringB);
}
};

useEffect(() => {
Expand Down

0 comments on commit 795574b

Please sign in to comment.