Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
967c73296c |
@@ -95,6 +95,12 @@
|
||||
"files": ["*.js", "*.jsx"],
|
||||
"extends": ["plugin:@nx/javascript"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.json"],
|
||||
"rules": {
|
||||
"@nx/dependency-checks": "error"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ export const EpochTotalRewards = ({ currentEpoch }: EpochTotalRewardsProps) => {
|
||||
const { param: marketCreationQuantumMultiple } = useNetworkParam(
|
||||
'rewards_marketCreationQuantumMultiple'
|
||||
);
|
||||
console.log(marketCreationQuantumMultiple);
|
||||
const [page, setPage] = useState(1);
|
||||
const { data, loading, error, refetch } = useEpochAssetsRewardsQuery({
|
||||
notifyOnNetworkStatusChange: true,
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
|
||||
"ignorePatterns": ["!**/*"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# aaa
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test aaa` to execute the unit tests via [Jest](https://jestjs.io).
|
||||
@@ -0,0 +1,18 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'aaa',
|
||||
preset: '../../jest.preset.js',
|
||||
transform: {
|
||||
'^.+\\.[tj]sx?$': [
|
||||
'@swc/jest',
|
||||
{
|
||||
jsc: {
|
||||
parser: { syntax: 'typescript', tsx: true },
|
||||
transform: { react: { runtime: 'automatic' } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
||||
coverageDirectory: '../../coverage/libs/aaa',
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "@vegaprotocol/aaa",
|
||||
"version": "0.0.1",
|
||||
"peerDependencies": {
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "aaa",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/aaa/src",
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
"options": {
|
||||
"lintFilePatterns": ["libs/aaa/**/*.{ts,tsx,js,jsx}"]
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/aaa",
|
||||
"tsConfig": "libs/aaa/tsconfig.lib.json",
|
||||
"project": "libs/aaa/package.json",
|
||||
"entryFile": "libs/aaa/src/index.ts",
|
||||
"external": ["react", "react-dom", "react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "swc",
|
||||
"format": ["esm", "cjs"],
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/aaa/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/aaa/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
},
|
||||
"configurations": {
|
||||
"ci": {
|
||||
"ci": true,
|
||||
"codeCoverage": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './lib/aaa';
|
||||
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
@@ -0,0 +1,10 @@
|
||||
import { render } from '@testing-library/react';
|
||||
|
||||
import Aaa from './aaa';
|
||||
|
||||
describe('Aaa', () => {
|
||||
it('should render successfully', () => {
|
||||
const { baseElement } = render(<Aaa />);
|
||||
expect(baseElement).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
import { useState } from 'react';
|
||||
import styles from './aaa.module.css';
|
||||
|
||||
/* eslint-disable-next-line */
|
||||
export interface AaaProps {}
|
||||
|
||||
export function Aaa(props: AaaProps) {
|
||||
const [count, setCount] = useState(0);
|
||||
return (
|
||||
<div className={styles['container']}>
|
||||
<h1>Welcome to Aaa!</h1>
|
||||
<button onClick={() => setCount((x) => x + 1)}>{count}</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Aaa;
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"allowJs": false,
|
||||
"esModuleInterop": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"declaration": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
],
|
||||
"extends": "../../tsconfig.base.json"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"types": ["node"],
|
||||
"module": "esnext",
|
||||
"target": "es2017",
|
||||
"declaration": true
|
||||
},
|
||||
"files": [
|
||||
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
||||
"../../node_modules/@nx/react/typings/image.d.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"jest.config.ts",
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.test.ts",
|
||||
"src/**/*.spec.tsx",
|
||||
"src/**/*.test.tsx",
|
||||
"src/**/*.spec.js",
|
||||
"src/**/*.test.js",
|
||||
"src/**/*.spec.jsx",
|
||||
"src/**/*.test.jsx"
|
||||
],
|
||||
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"module": "commonjs",
|
||||
"types": ["jest", "node"]
|
||||
},
|
||||
"include": [
|
||||
"jest.config.ts",
|
||||
"src/**/*.test.ts",
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.test.tsx",
|
||||
"src/**/*.spec.tsx",
|
||||
"src/**/*.test.js",
|
||||
"src/**/*.spec.js",
|
||||
"src/**/*.test.jsx",
|
||||
"src/**/*.spec.jsx",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/accounts",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/accounts",
|
||||
"tsConfig": "libs/accounts/tsconfig.lib.json",
|
||||
"project": "libs/accounts/package.json",
|
||||
"entryFile": "libs/accounts/src/index.ts",
|
||||
"external": ["react", "react-dom", "react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/accounts/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{
|
||||
"name": "@vegaprotocol/announcements",
|
||||
"version": "0.0.3"
|
||||
"version": "0.0.2",
|
||||
"peerDependencies": {
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,15 +13,9 @@
|
||||
"tsConfig": "libs/announcements/tsconfig.lib.json",
|
||||
"project": "libs/announcements/package.json",
|
||||
"entryFile": "libs/announcements/src/index.ts",
|
||||
"external": [
|
||||
"react",
|
||||
"react-dom",
|
||||
"react/jsx-runtime",
|
||||
"@vegaprotocol/react-helpers",
|
||||
"@vegaprotocol/ui-toolkit"
|
||||
],
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "swc",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/announcements/README.md",
|
||||
|
||||
@@ -2,7 +2,6 @@ import { useCallback, useEffect, useState } from 'react';
|
||||
import type { AppNameType, Announcement } from '../schema';
|
||||
import { AnnouncementsSchema } from '../schema';
|
||||
import { sha256 } from 'ethers/lib/utils';
|
||||
import { useLocalStorageSnapshot } from '@vegaprotocol/react-helpers';
|
||||
|
||||
const getData = async (name: AppNameType, url: string) => {
|
||||
const now = new Date();
|
||||
@@ -39,14 +38,8 @@ export const useDismissedAnnouncement = (): [
|
||||
string | null | undefined,
|
||||
(data: object) => void
|
||||
] => {
|
||||
const [dismissed, setDismissedInStorage] = useLocalStorageSnapshot(
|
||||
'dismissed-announcement'
|
||||
);
|
||||
const setDismissed = useCallback(
|
||||
(data: object) => setDismissedInStorage(checksum(data)),
|
||||
[setDismissedInStorage]
|
||||
);
|
||||
return [dismissed, setDismissed];
|
||||
const setDismissed = useCallback((data: object) => console.log('foo'), []);
|
||||
return ['yes', setDismissed];
|
||||
};
|
||||
|
||||
export const useAnnouncement = (name: AppNameType, url: string) => {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/apollo-client",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -4,6 +4,16 @@
|
||||
"sourceRoot": "libs/apollo-client/src",
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/apollo-client",
|
||||
"main": "libs/apollo-client/src/index.ts",
|
||||
"tsConfig": "libs/apollo-client/tsconfig.lib.json",
|
||||
"assets": ["libs/apollo-client/*.md"]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/assets",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/assets",
|
||||
"tsConfig": "libs/assets/tsconfig.lib.json",
|
||||
"project": "libs/assets/package.json",
|
||||
"entryFile": "libs/assets/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/assets/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/candles-chart",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/candles-chart",
|
||||
"tsConfig": "libs/candles-chart/tsconfig.lib.json",
|
||||
"project": "libs/candles-chart/package.json",
|
||||
"entryFile": "libs/candles-chart/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/candles-chart/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/data-provider",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/data-provider",
|
||||
"tsConfig": "libs/data-provider/tsconfig.lib.json",
|
||||
"project": "libs/data-provider/package.json",
|
||||
"entryFile": "libs/data-provider/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/data-provider/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/datagrid",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/datagrid",
|
||||
"tsConfig": "libs/datagrid/tsconfig.lib.json",
|
||||
"project": "libs/datagrid/package.json",
|
||||
"entryFile": "libs/datagrid/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/datagrid/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/deal-ticket",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/deal-ticket",
|
||||
"tsConfig": "libs/deal-ticket/tsconfig.lib.json",
|
||||
"project": "libs/deal-ticket/package.json",
|
||||
"entryFile": "libs/deal-ticket/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/deal-ticket/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/deposits",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/deposits",
|
||||
"tsConfig": "libs/deposits/tsconfig.lib.json",
|
||||
"project": "libs/deposits/package.json",
|
||||
"entryFile": "libs/deposits/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/deposits/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/environment",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/environment",
|
||||
"tsConfig": "libs/environment/tsconfig.lib.json",
|
||||
"project": "libs/environment/package.json",
|
||||
"entryFile": "libs/environment/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/environment/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/fills",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/fills",
|
||||
"tsConfig": "libs/fills/tsconfig.lib.json",
|
||||
"project": "libs/fills/package.json",
|
||||
"entryFile": "libs/fills/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/fills/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
|
||||
"ignorePatterns": ["!**/*"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# foo
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test foo` to execute the unit tests via [Jest](https://jestjs.io).
|
||||
@@ -0,0 +1,18 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'foo',
|
||||
preset: '../../jest.preset.js',
|
||||
transform: {
|
||||
'^.+\\.[tj]sx?$': [
|
||||
'@swc/jest',
|
||||
{
|
||||
jsc: {
|
||||
parser: { syntax: 'typescript', tsx: true },
|
||||
transform: { react: { runtime: 'automatic' } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
||||
coverageDirectory: '../../coverage/libs/foo',
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "@vegaprotocol/foo",
|
||||
"version": "0.0.1",
|
||||
"peerDependencies": {
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "foo",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/foo/src",
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
"options": {
|
||||
"lintFilePatterns": ["libs/foo/**/*.{ts,tsx,js,jsx}"]
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/foo",
|
||||
"tsConfig": "libs/foo/tsconfig.lib.json",
|
||||
"project": "libs/foo/package.json",
|
||||
"entryFile": "libs/foo/src/index.ts",
|
||||
"external": ["react", "react-dom", "react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "swc",
|
||||
"format": ["esm", "cjs"],
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/foo/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/foo/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
},
|
||||
"configurations": {
|
||||
"ci": {
|
||||
"ci": true,
|
||||
"codeCoverage": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './lib/foo';
|
||||
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
@@ -0,0 +1,10 @@
|
||||
import { render } from '@testing-library/react';
|
||||
|
||||
import Foo from './foo';
|
||||
|
||||
describe('Foo', () => {
|
||||
it('should render successfully', () => {
|
||||
const { baseElement } = render(<Foo />);
|
||||
expect(baseElement).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { useState } from 'react';
|
||||
import styles from './foo.module.css';
|
||||
|
||||
/* eslint-disable-next-line */
|
||||
export interface FooProps {}
|
||||
|
||||
export function Foo(props: FooProps) {
|
||||
console.log('FOO 1');
|
||||
const [count, setCount] = useState(0);
|
||||
return (
|
||||
<div className={styles['container']}>
|
||||
<h1>Welcome to Foo!</h1>
|
||||
<button onClick={() => setCount((x) => x + 1)}>{count}</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Foo;
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"allowJs": false,
|
||||
"declaration": true,
|
||||
"esModuleInterop": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
],
|
||||
"extends": "../../tsconfig.base.json"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"types": ["node"],
|
||||
"module": "esnext",
|
||||
"target": "es2017"
|
||||
},
|
||||
"files": [
|
||||
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
||||
"../../node_modules/@nx/react/typings/image.d.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"jest.config.ts",
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.test.ts",
|
||||
"src/**/*.spec.tsx",
|
||||
"src/**/*.test.tsx",
|
||||
"src/**/*.spec.js",
|
||||
"src/**/*.test.js",
|
||||
"src/**/*.spec.jsx",
|
||||
"src/**/*.test.jsx"
|
||||
],
|
||||
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"module": "commonjs",
|
||||
"types": ["jest", "node"]
|
||||
},
|
||||
"include": [
|
||||
"jest.config.ts",
|
||||
"src/**/*.test.ts",
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.test.tsx",
|
||||
"src/**/*.spec.tsx",
|
||||
"src/**/*.test.js",
|
||||
"src/**/*.spec.js",
|
||||
"src/**/*.test.jsx",
|
||||
"src/**/*.spec.jsx",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"name": "@vegaprotocol/i18n",
|
||||
"version": "0.0.5",
|
||||
"type": "commonjs"
|
||||
"version": "0.0.4",
|
||||
"peerDependencies": {
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
+26
-4
@@ -5,16 +5,38 @@
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"format": ["esm", "cjs"],
|
||||
"options": {
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies",
|
||||
"outputPath": "dist/libs/i18n",
|
||||
"main": "libs/i18n/src/index.ts",
|
||||
"tsConfig": "libs/i18n/tsconfig.lib.json",
|
||||
"assets": ["libs/i18n/*.md"]
|
||||
"project": "libs/i18n/package.json",
|
||||
"entryFile": "libs/i18n/src/index.ts",
|
||||
"external": ["react", "react-dom", "react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"format": ["esm", "cjs"],
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/i18n/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"publish": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"command": "node tools/scripts/publish.mjs i18n {args.ver} {args.tag}"
|
||||
},
|
||||
"dependsOn": [
|
||||
{
|
||||
"target": "build"
|
||||
}
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/ledger",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -4,6 +4,26 @@
|
||||
"sourceRoot": "libs/ledger/src",
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/ledger",
|
||||
"tsConfig": "libs/ledger/tsconfig.lib.json",
|
||||
"project": "libs/ledger/package.json",
|
||||
"entryFile": "libs/ledger/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/ledger/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/liquidity",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/liquidity",
|
||||
"tsConfig": "libs/liquidity/tsconfig.lib.json",
|
||||
"project": "libs/liquidity/package.json",
|
||||
"entryFile": "libs/liquidity/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/liquidity/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "@vegaprotocol/logger",
|
||||
"version": "0.0.1",
|
||||
"type": "commonjs"
|
||||
}
|
||||
@@ -5,6 +5,17 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"format": ["esm", "cjs"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/logger",
|
||||
"main": "libs/logger/src/index.ts",
|
||||
"tsConfig": "libs/logger/tsconfig.lib.json",
|
||||
"assets": ["libs/logger/*.md"]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/market-depth",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/market-depth",
|
||||
"tsConfig": "libs/market-depth/tsconfig.lib.json",
|
||||
"project": "libs/market-depth/package.json",
|
||||
"entryFile": "libs/market-depth/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/market-depth/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/markets",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/markets",
|
||||
"tsConfig": "libs/markets/tsconfig.lib.json",
|
||||
"project": "libs/markets/package.json",
|
||||
"entryFile": "libs/markets/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/markets/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/network-info",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/network-info",
|
||||
"tsConfig": "libs/network-info/tsconfig.lib.json",
|
||||
"project": "libs/network-info/package.json",
|
||||
"entryFile": "libs/network-info/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/network-info/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/network-parameters",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/network-parameters",
|
||||
"tsConfig": "libs/network-parameters/tsconfig.lib.json",
|
||||
"project": "libs/network-parameters/package.json",
|
||||
"entryFile": "libs/network-parameters/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/network-parameters/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/network-stats",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/network-stats",
|
||||
"tsConfig": "libs/network-stats/tsconfig.lib.json",
|
||||
"project": "libs/network-stats/package.json",
|
||||
"entryFile": "libs/network-stats/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/network-stats/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/orders",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/orders",
|
||||
"tsConfig": "libs/orders/tsconfig.lib.json",
|
||||
"project": "libs/orders/package.json",
|
||||
"entryFile": "libs/orders/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/orders/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/positions",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/positions",
|
||||
"tsConfig": "libs/positions/tsconfig.lib.json",
|
||||
"project": "libs/positions/package.json",
|
||||
"entryFile": "libs/positions/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/positions/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/proposals",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/proposals",
|
||||
"tsConfig": "libs/proposals/tsconfig.lib.json",
|
||||
"project": "libs/proposals/package.json",
|
||||
"entryFile": "libs/proposals/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/proposals/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{
|
||||
"name": "@vegaprotocol/react-helpers",
|
||||
"version": "0.2.6"
|
||||
"version": "0.2.5",
|
||||
"peerDependencies": {
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,15 +13,9 @@
|
||||
"tsConfig": "libs/react-helpers/tsconfig.lib.json",
|
||||
"project": "libs/react-helpers/package.json",
|
||||
"entryFile": "libs/react-helpers/src/index.ts",
|
||||
"external": [
|
||||
"react",
|
||||
"react-dom",
|
||||
"react/jsx-runtime",
|
||||
"@vegaprotocol/tailwindcss-config",
|
||||
"@vegaprotocol/utils"
|
||||
],
|
||||
"external": ["react", "react-dom", "react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "swc",
|
||||
"compiler": "babel",
|
||||
"format": ["esm", "cjs"],
|
||||
"assets": [
|
||||
{
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
useSyncExternalStore,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { LocalStorage } from '@vegaprotocol/utils';
|
||||
|
||||
type LocalStorageCallback = (key: string) => void;
|
||||
const LOCAL_STORAGE_CALLBACKS = new Set<LocalStorageCallback>();
|
||||
@@ -34,18 +33,18 @@ export const useLocalStorage = (key: string) => {
|
||||
[key]
|
||||
);
|
||||
const getSnapshot = () => {
|
||||
const item = LocalStorage.getItem(key);
|
||||
const item = localStorage.getItem(key);
|
||||
return item;
|
||||
};
|
||||
const setValue = useCallback(
|
||||
(value: string) => {
|
||||
LocalStorage.setItem(key, value);
|
||||
localStorage.setItem(key, value);
|
||||
triggerCallbacks(key);
|
||||
},
|
||||
[key]
|
||||
);
|
||||
const removeValue = useCallback(() => {
|
||||
LocalStorage.removeItem(key);
|
||||
localStorage.removeItem(key);
|
||||
triggerCallbacks(key);
|
||||
}, [key]);
|
||||
const value = useSyncExternalStore(subscribe, getSnapshot, () => null);
|
||||
@@ -71,16 +70,16 @@ export const useLocalStorage = (key: string) => {
|
||||
};
|
||||
|
||||
export const useLocalStorageSnapshot = (key: string) => {
|
||||
const [value, setStoredValue] = useState(LocalStorage.getItem(key));
|
||||
const [value, setStoredValue] = useState(localStorage.getItem(key));
|
||||
const setValue = useCallback(
|
||||
(value: string) => {
|
||||
LocalStorage.setItem(key, value);
|
||||
localStorage.setItem(key, value);
|
||||
setStoredValue(value);
|
||||
},
|
||||
[key]
|
||||
);
|
||||
const removeValue = useCallback(() => {
|
||||
LocalStorage.removeItem(key);
|
||||
localStorage.removeItem(key);
|
||||
setStoredValue(null);
|
||||
}, [key]);
|
||||
return useMemo<UseLocalStorageHook>(
|
||||
|
||||
@@ -1,31 +1,27 @@
|
||||
import { useMemo } from 'react';
|
||||
import { theme } from '@vegaprotocol/tailwindcss-config';
|
||||
import { useResize } from './use-resize';
|
||||
// import { theme } from '@vegaprotocol/tailwindcss-config';
|
||||
// import { useResize } from './use-resize';
|
||||
|
||||
export type Screen = keyof typeof theme.screens;
|
||||
// export type Screen = keyof typeof theme.screens;
|
||||
|
||||
interface Props {
|
||||
isMobile: boolean;
|
||||
screenSize: Screen;
|
||||
}
|
||||
|
||||
export const useScreenDimensions = (): Props => {
|
||||
const { width } = useResize();
|
||||
const isMobile = width < parseInt(theme.screens.md);
|
||||
const screenSize = Object.entries(theme.screens).reduce(
|
||||
(agg: Screen, entry) => {
|
||||
if (width > parseInt(entry[1])) {
|
||||
agg = entry[0] as Screen;
|
||||
}
|
||||
return agg;
|
||||
},
|
||||
'xs'
|
||||
);
|
||||
export const useScreenDimensions = () => {
|
||||
console.log('useScreenDimensions');
|
||||
// const { width } = useResize();
|
||||
// const isMobile = width < parseInt(theme.screens.md);
|
||||
// const screenSize = Object.entries(theme.screens).reduce(
|
||||
// (agg: Screen, entry) => {
|
||||
// if (width > parseInt(entry[1])) {
|
||||
// agg = entry[0] as Screen;
|
||||
// }
|
||||
// return agg;
|
||||
// },
|
||||
// 'xs'
|
||||
// );
|
||||
return useMemo(
|
||||
() => ({
|
||||
isMobile,
|
||||
screenSize,
|
||||
isMobile: true,
|
||||
screenSize: 'lg',
|
||||
}),
|
||||
[isMobile, screenSize]
|
||||
[]
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { create } from 'zustand';
|
||||
import { LocalStorage } from '@vegaprotocol/utils';
|
||||
|
||||
const THEME_STORAGE_KEY = 'theme';
|
||||
const Themes = {
|
||||
@@ -13,7 +12,7 @@ const isBrowser = typeof window !== 'undefined';
|
||||
|
||||
const validateTheme = (theme: string): theme is Theme => {
|
||||
if (Object.values(Themes).includes(theme as Theme)) return true;
|
||||
LocalStorage.removeItem(THEME_STORAGE_KEY);
|
||||
localStorage.removeItem(THEME_STORAGE_KEY);
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -35,7 +34,7 @@ const getCurrentTheme = () => {
|
||||
return Themes.DARK;
|
||||
}
|
||||
|
||||
const storedTheme = LocalStorage.getItem(THEME_STORAGE_KEY);
|
||||
const storedTheme = localStorage.getItem(THEME_STORAGE_KEY);
|
||||
|
||||
if (storedTheme && validateTheme(storedTheme)) {
|
||||
setThemeClassName(storedTheme);
|
||||
@@ -69,7 +68,7 @@ const useThemeStore = create<ThemeStore>((set) => ({
|
||||
theme = newTheme;
|
||||
}
|
||||
|
||||
LocalStorage.setItem(THEME_STORAGE_KEY, theme);
|
||||
localStorage.setItem(THEME_STORAGE_KEY, theme);
|
||||
|
||||
setThemeClassName(theme);
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export * from './number';
|
||||
@@ -1,64 +0,0 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import { CompactNumber } from './number';
|
||||
|
||||
describe('CompactNumber', () => {
|
||||
const short: [BigNumber, string, number | 'infer'][] = [
|
||||
[new BigNumber(Infinity), '∞', 'infer'],
|
||||
[new BigNumber(-Infinity), '-∞', 'infer'],
|
||||
[new BigNumber(0), '0', 'infer'],
|
||||
[new BigNumber(1), '1', 'infer'],
|
||||
[new BigNumber(100), '100', 'infer'],
|
||||
[new BigNumber(100.456601), '100.456601', 'infer'],
|
||||
[new BigNumber(1_000), '1,000', 'infer'],
|
||||
[new BigNumber(999_999), '999,999', 'infer'],
|
||||
[new BigNumber(1_000_000), '1M', 'infer'],
|
||||
[new BigNumber(100_000_000), '100M', 'infer'],
|
||||
[new BigNumber(1_000_000_000), '1B', 'infer'],
|
||||
[new BigNumber(1_000_000_000_000), '1T', 'infer'],
|
||||
[new BigNumber(3.23e12), '3.23T', 2],
|
||||
[new BigNumber(3.23e12), '3.23000T', 5],
|
||||
[new BigNumber(3.23e24), '3.23000 \u00d7 1024', 5], // \u00d7 is times 'x'
|
||||
[new BigNumber(1.579208923731619e59), '1.57921 \u00d7 1059', 5],
|
||||
];
|
||||
it.each(short)(
|
||||
'compacts %d to %p (decimal places: %p)',
|
||||
(input, output, decimals) => {
|
||||
render(<CompactNumber number={input} decimals={decimals} />);
|
||||
expect(screen.getByTestId('compact-number')).toHaveTextContent(output);
|
||||
}
|
||||
);
|
||||
|
||||
const long: [BigNumber, string, number | 'infer'][] = [
|
||||
[new BigNumber(Infinity), '∞', 'infer'],
|
||||
[new BigNumber(-Infinity), '-∞', 'infer'],
|
||||
[new BigNumber(0), '0', 'infer'],
|
||||
[new BigNumber(1), '1', 'infer'],
|
||||
[new BigNumber(100), '100', 'infer'],
|
||||
[new BigNumber(100.456601), '100.456601', 'infer'],
|
||||
[new BigNumber(1_000), '1,000', 'infer'],
|
||||
[new BigNumber(999_999), '999,999', 'infer'],
|
||||
[new BigNumber(1_000_000), '1 million', 'infer'],
|
||||
[new BigNumber(100_000_000), '100 million', 'infer'],
|
||||
[new BigNumber(1_000_000_000), '1 billion', 'infer'],
|
||||
[new BigNumber(1_000_000_000_000), '1 trillion', 'infer'],
|
||||
[new BigNumber(3.23e12), '3.23 trillion', 2],
|
||||
[new BigNumber(3.23e12), '3.23000 trillion', 5],
|
||||
[new BigNumber(3.23e24), '3.23000 \u00d7 1024', 5], // \u00d7 is times 'x'
|
||||
[new BigNumber(1.579208923731619e59), '1.57921 \u00d7 1059', 5], // \u00d7 is times 'x'
|
||||
];
|
||||
it.each(long)(
|
||||
'compacts %d to %p (decimal places: %p)',
|
||||
(input, output, decimals) => {
|
||||
render(
|
||||
<CompactNumber
|
||||
number={input}
|
||||
decimals={decimals}
|
||||
compactDisplay="long"
|
||||
/>
|
||||
);
|
||||
expect(screen.getByTestId('compact-number')).toHaveTextContent(output);
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -1,90 +0,0 @@
|
||||
import { BigNumber } from 'bignumber.js';
|
||||
import {
|
||||
getUserLocale,
|
||||
formatNumber,
|
||||
getUnlimitedThreshold,
|
||||
} from '@vegaprotocol/utils';
|
||||
|
||||
const INFINITY = '∞';
|
||||
const DEFAULT_COMPACT_ABOVE = 1_000_000;
|
||||
const DEFAULT_COMPACT_CAP = new BigNumber(1e24);
|
||||
|
||||
/**
|
||||
* Compacts given number to human readable format.
|
||||
* @param number
|
||||
* @param decimals Number of decimal places
|
||||
* @param compactDisplay Display mode; short -> 1e6 == 1M; ling -> 1e6 1 million
|
||||
* @param compactAbove Compact number above threshold
|
||||
* @param cap Use scientific notation above threshold
|
||||
*/
|
||||
export const CompactNumber = ({
|
||||
number,
|
||||
decimals = 'infer',
|
||||
compactDisplay = 'short',
|
||||
testId = 'compact-number',
|
||||
}: {
|
||||
number: BigNumber;
|
||||
decimals?: number | 'infer';
|
||||
compactDisplay?: 'short' | 'long';
|
||||
testId?: string;
|
||||
}) => {
|
||||
if (!number.isFinite()) {
|
||||
return (
|
||||
<span data-testid={testId}>
|
||||
{number.isNegative() ? '-' : ''}
|
||||
{INFINITY}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
const decimalPlaces =
|
||||
(decimals === 'infer' ? number.decimalPlaces() : decimals) || 0;
|
||||
|
||||
if (number.isGreaterThan(getUnlimitedThreshold(decimalPlaces))) {
|
||||
return <span data-testid={testId}>{INFINITY}</span>;
|
||||
}
|
||||
|
||||
if (number.isLessThan(DEFAULT_COMPACT_ABOVE)) {
|
||||
return (
|
||||
<span data-testid={testId}>{formatNumber(number, decimalPlaces)}</span>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: it compacts number up to 1_000_000_000_000 (1e12) -> 1T, all above is formatted as iteration of T.
|
||||
* Example: 1.579208923731619e59 -> 157,920,892,373,161,900,000,000,000,000,000,000,000,000,000,000T
|
||||
*/
|
||||
const compactNumFormat = new Intl.NumberFormat(getUserLocale(), {
|
||||
minimumFractionDigits: Math.max(0, decimalPlaces),
|
||||
maximumFractionDigits: Math.max(0, decimalPlaces),
|
||||
notation: 'compact',
|
||||
compactDisplay,
|
||||
});
|
||||
const scientificNumFormat = new Intl.NumberFormat(getUserLocale(), {
|
||||
minimumFractionDigits: Math.max(0, decimalPlaces),
|
||||
maximumFractionDigits: Math.max(0, decimalPlaces),
|
||||
notation: 'scientific',
|
||||
});
|
||||
|
||||
if (number.isGreaterThan(DEFAULT_COMPACT_CAP)) {
|
||||
const r = /E(\d+)$/i;
|
||||
const formatted = scientificNumFormat.format(Number(number));
|
||||
const eNotation = formatted.match(r);
|
||||
if (eNotation && eNotation.length > 1) {
|
||||
const power = eNotation[1];
|
||||
return (
|
||||
<span data-testid={testId}>
|
||||
{formatted.replace(r, '')}{' '}
|
||||
<span>
|
||||
× 10
|
||||
<sup>{power}</sup>
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<span data-testid={testId}>{compactNumFormat.format(Number(number))}</span>
|
||||
);
|
||||
};
|
||||
@@ -1,2 +1 @@
|
||||
export * from './format';
|
||||
export * from './validation';
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/smart-contracts",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -3,6 +3,16 @@
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/smart-contracts/src",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/smart-contracts",
|
||||
"main": "libs/smart-contracts/src/index.ts",
|
||||
"tsConfig": "libs/smart-contracts/tsconfig.lib.json",
|
||||
"assets": ["libs/smart-contracts/*.md"]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/tailwindcss-config",
|
||||
"version": "0.0.5"
|
||||
"version": "0.0.4"
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
"outputPath": "dist/libs/tailwindcss-config",
|
||||
"main": "libs/tailwindcss-config/src/index.js",
|
||||
"tsConfig": "libs/tailwindcss-config/tsconfig.lib.json",
|
||||
"assets": ["libs/tailwindcss-config/*.md"]
|
||||
"assets": ["libs/tailwindcss-config/*.md"],
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/tendermint",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -12,6 +12,26 @@
|
||||
"lintFilePatterns": ["libs/tendermint/**/*.{ts,tsx,js,jsx}"]
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/tendermint",
|
||||
"tsConfig": "libs/tendermint/tsconfig.lib.json",
|
||||
"project": "libs/tendermint/package.json",
|
||||
"entryFile": "libs/tendermint/src/index.ts",
|
||||
"external": ["react", "react-dom", "react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/tendermint/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@vegaprotocol/trades",
|
||||
"version": "0.0.1"
|
||||
}
|
||||
@@ -5,6 +5,26 @@
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/trades",
|
||||
"tsConfig": "libs/trades/tsconfig.lib.json",
|
||||
"project": "libs/trades/package.json",
|
||||
"entryFile": "libs/trades/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/trades/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{
|
||||
"name": "@vegaprotocol/types",
|
||||
"version": "0.0.6"
|
||||
"version": "0.0.5",
|
||||
"peerDependencies": {
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"tsConfig": "libs/types/tsconfig.lib.json",
|
||||
"project": "libs/types/package.json",
|
||||
"entryFile": "libs/types/src/index.ts",
|
||||
"external": ["react", "react-dom", "react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"format": ["esm", "cjs"],
|
||||
@@ -22,7 +23,8 @@
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
],
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{
|
||||
"name": "@vegaprotocol/ui-toolkit",
|
||||
"version": "0.12.9"
|
||||
"version": "0.12.8",
|
||||
"peerDependencies": {
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,21 +9,14 @@
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies",
|
||||
"outputPath": "dist/libs/ui-toolkit",
|
||||
"tsConfig": "libs/ui-toolkit/tsconfig.lib.json",
|
||||
"project": "libs/ui-toolkit/package.json",
|
||||
"entryFile": "libs/ui-toolkit/src/index.ts",
|
||||
"external": [
|
||||
"react",
|
||||
"react-dom",
|
||||
"react/jsx-runtime",
|
||||
"@vegaprotocol/i18n",
|
||||
"@vegaprotocol/react-helpers",
|
||||
"@vegaprotocol/tailwindcss-config",
|
||||
"@vegaprotocol/utils"
|
||||
],
|
||||
"external": ["react", "react-dom", "react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "swc",
|
||||
"compiler": "babel",
|
||||
"format": ["esm", "cjs"],
|
||||
"assets": [
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Ref, SelectHTMLAttributes } from 'react';
|
||||
import { useRef } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { Icon } from '../icon';
|
||||
import { Icon } from '..';
|
||||
import { defaultSelectElement } from '../../utils/shared';
|
||||
import * as SelectPrimitive from '@radix-ui/react-select';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Ref, SelectHTMLAttributes } from 'react';
|
||||
import { useRef } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { VegaIcon, VegaIconNames } from '../icon';
|
||||
import { VegaIcon, VegaIconNames } from '..';
|
||||
import { defaultSelectElement } from '../../utils/shared';
|
||||
import * as SelectPrimitive from '@radix-ui/react-select';
|
||||
|
||||
@@ -107,7 +107,7 @@ export const TradingOption = forwardRef<
|
||||
className={classNames(
|
||||
'relative',
|
||||
'text-black dark:text-white',
|
||||
'cursor-pointer outline-none ',
|
||||
'cursor-pointer outline-none',
|
||||
'hover:bg-neutral-100 dark:hover:bg-neutral-800',
|
||||
'focus:bg-neutral-100 dark:focus:bg-neutral-800',
|
||||
'pl-2 py-2',
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"jsc": {
|
||||
"target": "es2017",
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"decorators": true,
|
||||
"dynamicImport": true
|
||||
},
|
||||
"transform": {
|
||||
"decoratorMetadata": true,
|
||||
"legacyDecorator": true
|
||||
},
|
||||
"keepClassNames": true,
|
||||
"externalHelpers": true,
|
||||
"loose": true
|
||||
},
|
||||
"module": {
|
||||
"type": "commonjs",
|
||||
"strict": true,
|
||||
"noInterop": true
|
||||
},
|
||||
"sourceMaps": true,
|
||||
"exclude": [
|
||||
"jest.config.ts",
|
||||
".*\\.spec.tsx?$",
|
||||
".*\\.test.tsx?$",
|
||||
"./src/jest-setup.ts$",
|
||||
"./**/jest-setup.ts$",
|
||||
".*.js$"
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"name": "@vegaprotocol/utils",
|
||||
"version": "0.0.10",
|
||||
"type": "commonjs"
|
||||
"version": "0.0.8",
|
||||
"peerDependencies": {
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
+15
-4
@@ -5,16 +5,27 @@
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:swc",
|
||||
"executor": "@nx/rollup:rollup",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"format": ["esm", "cjs"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/utils",
|
||||
"main": "libs/utils/src/index.ts",
|
||||
"tsConfig": "libs/utils/tsconfig.lib.json",
|
||||
"assets": ["libs/utils/*.md"]
|
||||
"project": "libs/utils/package.json",
|
||||
"entryFile": "libs/utils/src/index.ts",
|
||||
"external": ["react", "react-dom", "react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"format": ["esm", "cjs"],
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/utils/README.md",
|
||||
"input": ".",
|
||||
"output": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
"publish": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user