-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
431b612
commit b1fddd0
Showing
92 changed files
with
6,945 additions
and
225 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import { TableTemplates } from '../../components/molecules/table/templates'; | ||
import { SORT_BY, TableConfig } from '../types'; | ||
|
||
export const ScoringConfig: TableConfig[] = [ | ||
{ | ||
colName: 'validator', | ||
headerText: 'Validator', | ||
columnTemplate: TableTemplates.ACCOUNT_TEMPLATE, | ||
fields: { | ||
name: 'valName', | ||
img: 'valImg', | ||
pk: 'pk', | ||
noRedirect: true, | ||
}, | ||
view: { | ||
sm: 8, | ||
md: 14, | ||
lg: 14, | ||
}, | ||
}, | ||
{ | ||
colName: 'stake', | ||
columnTemplate: TableTemplates.AMOUNT, | ||
headerText: 'Stake', | ||
fields: { | ||
value: 'stake', | ||
additionValue: 'protocol', | ||
}, | ||
sortBy: SORT_BY.STAKE, | ||
}, | ||
{ | ||
colName: 'score', | ||
columnTemplate: TableTemplates.STRING, | ||
headerText: 'Score', | ||
fields: { | ||
value: 'score', | ||
postfix: '%', | ||
}, | ||
sortBy: SORT_BY.SCORE, | ||
}, | ||
{ | ||
colName: 'uptimeBySnark', | ||
columnTemplate: TableTemplates.STRING, | ||
fields: { | ||
value: 'uptimePercent', | ||
postfix: '%', | ||
}, | ||
headerText: 'Uptime by Snark', | ||
}, | ||
{ | ||
colName: 'votedMIPs', | ||
columnTemplate: TableTemplates.STRING, | ||
fields: { | ||
value: 'votedMIPs', | ||
}, | ||
headerText: '% Voted MIPs', | ||
}, | ||
{ | ||
colName: 'win_Rate', | ||
columnTemplate: TableTemplates.STRING, | ||
fields: { | ||
value: 'winRateAvg', | ||
postfix: '%', | ||
}, | ||
headerText: 'Win Rate', | ||
}, | ||
]; | ||
|
||
export const testWorldConfig: TableConfig[] = [ | ||
{ | ||
colName: 'stake', | ||
headerText: 'Validator', | ||
columnTemplate: TableTemplates.ACCOUNT_TEMPLATE, | ||
fields: { | ||
name: 'name', | ||
img: 'img', | ||
pk: 'pk', | ||
noRedirect: true, | ||
}, | ||
view: { | ||
sm: 4, | ||
md: 8, | ||
lg: 12, | ||
}, | ||
}, | ||
{ | ||
colName: 'stake', | ||
columnTemplate: TableTemplates.AMOUNT, | ||
headerText: 'Stake', | ||
fields: { | ||
value: 'amountStaked', | ||
additionValue: 'protocol', | ||
}, | ||
sortBy: SORT_BY.STAKE, | ||
}, | ||
{ | ||
colName: 'score', | ||
columnTemplate: TableTemplates.STRING, | ||
headerText: 'Score', | ||
fields: { | ||
value: 'emptyValue', | ||
}, | ||
sortBy: SORT_BY.SCORE, | ||
}, | ||
{ | ||
colName: 'uptimeBySnark', | ||
columnTemplate: TableTemplates.STRING, | ||
fields: { | ||
value: 'emptyValue', | ||
}, | ||
headerText: 'Uptime by Snark', | ||
}, | ||
{ | ||
colName: 'votedMIPs', | ||
columnTemplate: TableTemplates.STRING, | ||
fields: { | ||
value: 'emptyValue', | ||
}, | ||
headerText: '% Voted MIPs', | ||
}, | ||
{ | ||
colName: 'win_Rate', | ||
columnTemplate: TableTemplates.STRING, | ||
fields: { | ||
value: 'emptyValue', | ||
}, | ||
headerText: 'Win Rate', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const NETWORK = 'testworld'; | ||
export const defaultWallet = 'B62qoTtn6hP2R1x5d4UQoJos9vjoNGxLhaQn5cSKneu25Q3wpmtPirT'; | ||
export const PUBLIC_APP_BASE_URL = 'https://minascan.io/'; | ||
export const POLLING_INTERVAL = 3000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
export const formatNum = ( | ||
num: number | string, | ||
fixed?: number, | ||
fixedLessOne?: boolean, | ||
isNotFixed?: boolean | ||
): string => { | ||
if (num === null || num === undefined || (!Number(num) && Number(num) !== 0)) return '-'; | ||
const newNumber: number = Number(num); | ||
if (newNumber === 0) return '0'; | ||
if (newNumber < 1 && newNumber > -1 && fixedLessOne) { | ||
const arrPrecisionNumber: string[] = newNumber.toString().split('e'); | ||
if (arrPrecisionNumber.length > 1) { | ||
const numberOfZero = arrPrecisionNumber[1]; | ||
const integerNumber = Number(Math.abs(Number(arrPrecisionNumber[0]))); | ||
const arrOfZero = new Array(Math.abs(Number(numberOfZero) || 0))?.fill(0); | ||
arrOfZero[arrOfZero?.length - 1] = integerNumber.toFixed(); | ||
const firstNum = newNumber > 0 ? '0.' : '-0.'; | ||
arrOfZero.unshift(firstNum); | ||
return arrOfZero.join(''); | ||
} | ||
const arrNumbers = num.toString().split('.')?.[1]?.split('') || []; | ||
const indexNumber = arrNumbers.findIndex((item) => Number(item) > 0); | ||
|
||
const result = newNumber.toFixed(indexNumber + (fixed || 0)); | ||
if (result[result.length - 1] === '0') { | ||
return result.slice(0, -1); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
const number = isNotFixed ? newNumber.toString() : newNumber.toFixed(fixed); | ||
const arr = number.split('.'); | ||
const int = arr[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); | ||
if (arr[1] !== undefined) { | ||
arr[1] = arr[1].replace(/0*$/, ''); | ||
} | ||
if (arr[1] !== undefined && arr[1].trim() !== '') { | ||
return int + '.' + arr[1]; | ||
} | ||
return int; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { formatNum } from './formatNum'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { TableTemplates } from '../components/molecules/table/templates'; | ||
|
||
export type View = { | ||
sm: number; | ||
md: number; | ||
lg: number; | ||
}; | ||
|
||
export type TableConfig = { | ||
colName: string; | ||
columnTemplate: TableTemplates; | ||
fields?: { | ||
value?: string; | ||
additionValue?: string; | ||
postfix?: string; | ||
name?: string; | ||
img?: string; | ||
pk?: string; | ||
getRedirectLink?: (value: string) => string; | ||
noRedirectFromData?: string; | ||
noHash?: boolean; | ||
isCoinTable?: boolean; | ||
noRedirect?: boolean; | ||
}; | ||
sortBy?: SORT_BY; | ||
headerText?: string; | ||
view?: View; | ||
style?: { | ||
noGrow?: boolean; | ||
width?: string; | ||
justifyContent?: string; | ||
maxWidth?: string; | ||
minWidth?: string; | ||
}; | ||
}; | ||
|
||
export type LimitOptions = { text: string; value: number }[]; | ||
export type TabSwitcherOptions = string[]; | ||
|
||
export type DataTable = { | ||
data?: any[]; | ||
content?: any[]; | ||
size: number; | ||
totalPages: number; | ||
pageable: { | ||
sort: { | ||
sorted: boolean; | ||
unsorted: boolean; | ||
empty: boolean; | ||
}; | ||
offset: number; | ||
pageNumber: number; | ||
pageSize: number; | ||
unpaged: boolean; | ||
paged: boolean; | ||
}; | ||
last: boolean; | ||
totalElements: number; | ||
number: number; | ||
sort: { | ||
sorted: boolean; | ||
unsorted: boolean; | ||
empty: boolean; | ||
}; | ||
first: boolean; | ||
numberOfElements: number; | ||
empty: boolean; | ||
}; | ||
|
||
export enum SORT_BY { | ||
SCORE = 'score', | ||
STAKE = 'stake', | ||
} | ||
|
||
export enum ORDER_BY { | ||
DESC = 'DESC', | ||
ASC = 'ASC', | ||
} | ||
|
||
export enum DATA_STATUS { | ||
INITIAL = 'initial', | ||
LOADING = 'loading', | ||
SUCCESS = 'success', | ||
ERROR = 'error', | ||
} |
Oops, something went wrong.