mirror of
https://github.com/luxfi/explore.git
synced 2026-07-27 05:54:15 +00:00
- Rename all @blockscout/* npm packages to @luxfi/* aliases (150+ files) - Override blue accent colors to gray for monochrome theme - Fix dropdown/menu/popover fonts to use Geist Sans - Change Latest Blocks to horizontal scrolling layout - Show dashes instead of zeros for validator stats on error - Fix GHA deploy step to use correct deployment name
28 lines
794 B
TypeScript
28 lines
794 B
TypeScript
import type * as bens from '@luxfi/bens-types';
|
|
|
|
import getNextSortValueShared from 'ui/shared/sort/getNextSortValue';
|
|
|
|
export type SortField = 'timestamp';
|
|
export type Sort = `${ SortField }-asc` | `${ SortField }-desc` | 'default';
|
|
|
|
const SORT_SEQUENCE: Record<SortField, Array<Sort>> = {
|
|
timestamp: [ 'timestamp-desc', 'timestamp-asc', 'default' ],
|
|
};
|
|
|
|
export const getNextSortValue = (getNextSortValueShared<SortField, Sort>).bind(undefined, SORT_SEQUENCE);
|
|
|
|
export const sortFn = (sort: Sort | undefined) => (a: bens.DomainEvent, b: bens.DomainEvent) => {
|
|
switch (sort) {
|
|
case 'timestamp-asc': {
|
|
return b.timestamp.localeCompare(a.timestamp);
|
|
}
|
|
|
|
case 'timestamp-desc': {
|
|
return a.timestamp.localeCompare(b.timestamp);
|
|
}
|
|
|
|
default:
|
|
return 0;
|
|
}
|
|
};
|