Skip to content

Commit

Permalink
sort members table by default
Browse files Browse the repository at this point in the history
  • Loading branch information
sinamics committed Apr 8, 2023
1 parent 26ad77c commit ae472ee
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/components/modules/networkMembersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,24 @@ export const NetworkMembersTable = ({ nwid }) => {
}

if (conStatus === 2) {
if (peers.version !== "-1.-1.-1") {
return (
<span
style={{ cursor: "pointer" }}
className="text-success"
title="Direct connection established"
>
DIRECT (v{peers?.version})
</span>
);
}
return (
<span
style={{ cursor: "pointer" }}
className="text-success"
title="Direct connection established"
>
DIRECT (v{peers?.version})
DIRECT
</span>
);
}
Expand Down Expand Up @@ -309,7 +320,15 @@ export const NetworkMembersTable = ({ nwid }) => {
const defaultColumn = {
Cell: EditableCell,
};

const sortees = React.useMemo(
() => [
{
id: "id",
desc: false,
},
],
[]
);
const data = useMemo(() => networkById.members, [networkById.members]);
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } =
useTable(
Expand All @@ -318,12 +337,7 @@ export const NetworkMembersTable = ({ nwid }) => {
data,
defaultColumn,
initialState: {
sortBy: [
{
id: "id",
desc: false,
},
],
sortBy: sortees,
},
},
useBlockLayout,
Expand Down

0 comments on commit ae472ee

Please sign in to comment.