diff --git a/src/components/Dashboard/OperatorGrid/OperatorGrid.tsx b/src/components/Dashboard/OperatorGrid/OperatorGrid.tsx index 927b50e350..1d510ea6a7 100644 --- a/src/components/Dashboard/OperatorGrid/OperatorGrid.tsx +++ b/src/components/Dashboard/OperatorGrid/OperatorGrid.tsx @@ -21,6 +21,27 @@ const OperatorGrid: React.FC = ({ 0, ) + // pinned operators first, then staked operators, then the rest alphabetically + const handleSort = (a: ProcessedOperator, b: ProcessedOperator) => { + if (a.isPinned && !b.isPinned) { + return -1 + } + + if (!a.isPinned && b.isPinned) { + return 1 + } + + if (a.isStaked && !b.isStaked) { + return -1 + } + + if (!a.isStaked && b.isStaked) { + return 1 + } + + return a.name.localeCompare(b.name) + } + return (
@@ -74,9 +95,11 @@ const OperatorGrid: React.FC = ({ Add Operator ) : ( - data?.map((operator) => ( - - )) + data + ?.sort(handleSort) + .map((operator) => ( + + )) )}