Compare commits

...

10 Commits

Author SHA1 Message Date
vchikalkin
455e9269cb apps, packages: sync packages versions 2024-02-28 16:31:07 +03:00
vchikalkin
b74f919939 apps/web: fix antd breaks webkit-scroll style override 2024-02-28 15:08:39 +03:00
vchikalkin
450ed01d00 apps/web: fix out payments table scroll 2024-02-27 22:55:42 +03:00
vchikalkin
0d043717a6 packages/tools: fix 'cannot find name window' error 2024-02-27 19:57:50 +03:00
vchikalkin
199a622c46 project: sync packages typescript version 2024-02-27 19:55:41 +03:00
vchikalkin
974dfb57a8 [2] fix graphql:codegen 2024-02-27 16:24:33 +03:00
vchikalkin
c2d9093efe fix graphql:codegen 2024-02-27 14:29:40 +03:00
vchikalkin
6007f3d98d project: fix build 2024-02-27 13:41:02 +03:00
vchikalkin
351f3ebfdf project: fix eslint 2024-02-26 21:10:52 +03:00
vchikalkin
4c59fd8dc1 apps/web: upgrade @vchikalkin/eslint-config-awesome 2024-02-26 15:55:46 +03:00
23 changed files with 205 additions and 800 deletions

View File

@ -40,8 +40,8 @@
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
"@types/supertest": "^6.0.0",
"@vchikalkin/eslint-config-awesome": "^1.1.5",
"eslint": "^8.51.0",
"@vchikalkin/eslint-config-awesome": "^1.1.6",
"eslint": "^8.52.0",
"fastify": "^4.26.1",
"jest": "^29.5.0",
"prettier": "^3.0.0",
@ -51,7 +51,7 @@
"ts-loader": "^9.4.3",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3"
"typescript": "^5.3.3"
},
"jest": {
"moduleFileExtensions": [

View File

@ -1,11 +1,14 @@
module.exports = {
extends: [
'@vchikalkin/eslint-config-awesome/next-typescript/config',
'@vchikalkin/eslint-config-awesome/next-typescript/rules',
],
const { createConfig } = require('@vchikalkin/eslint-config-awesome');
module.exports = createConfig('next-typescript', {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
root: true,
};
rules: {
'import/no-duplicates': 'off',
'react/forbid-component-props': 'off',
'import/consistent-type-specifier-style': 'off',
},
ignorePatterns: ['*.config.js', '.eslintrc.js'],
});

View File

@ -1,6 +1,6 @@
overwrite: true
schema: './graphql/crm.schema.graphql'
documents: ['./**/!(*.{d,types}).{ts,tsx}', './**/.{js,jsx}', ./**/!(*.schema).graphql]
documents: [./**/!(*.schema).graphql]
generates:
./graphql/crm.types.ts:
plugins:

View File

@ -7,7 +7,7 @@ import { observer } from 'mobx-react-lite';
import { Table } from 'ui/elements';
const PaymentsTable = observer(() => {
const { $results, $process } = useStore();
const { $process, $results } = useStore();
const unlimited = $process.has('Unlimited');
const dataSource = toJS($results.payments);
@ -27,8 +27,8 @@ const PaymentsTable = observer(() => {
showSizeChanger: false,
}}
scroll={{
x: dataColumns.length > 4 && 1000,
y: 630,
x: dataColumns.length > 5 ? 1000 : undefined,
y: dataSource.length > 16 ? 630 : undefined,
}}
/>
);

View File

@ -48,6 +48,7 @@ query GetLead($leadid: Uuid!) {
}
evo_okved
}
link
}
}
@ -61,6 +62,7 @@ query GetOpportunity($opportunityid: Uuid!) {
}
evo_okved
}
link
}
}
@ -107,6 +109,7 @@ query GetQuote($quoteId: Uuid!) {
evo_kasko_payer
evo_promotion
evo_sale_without_nds
link
}
}

File diff suppressed because one or more lines are too long

View File

@ -43,6 +43,7 @@
"@graphql-codegen/typed-document-node": "^5.0.1",
"@graphql-codegen/typescript": "^4.0.1",
"@graphql-codegen/typescript-operations": "^4.0.1",
"@graphql-typed-document-node/core": "^3.2.0",
"@graphql-typed-document-node/patch-cli": "^3.0.9",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
@ -50,15 +51,15 @@
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@types/styled-components": "^5.1.26",
"@vchikalkin/eslint-config-awesome": "^1.1.1",
"eslint": "^8.46.0",
"@vchikalkin/eslint-config-awesome": "^1.1.6",
"antd": "^5.14.2",
"eslint": "^8.52.0",
"gql-sdl": "^1.0.0",
"jest": "^29.4.3",
"jest-environment-jsdom": "^29.3.1",
"msw": "^1.1.0",
"ts-jest": "^29.0.5",
"tsconfig": "workspace:*",
"typescript": "^4.9.5"
"typescript": "^5.3.3"
},
"msw": {
"workerDirectory": "public"

View File

@ -1,6 +1,7 @@
import 'normalize.css';
import '../styles/fonts.css';
import '../styles/globals.css';
import '../styles/antd-fix.css';
import initializeQueryClient from '@/api/client';
import initializeApollo from '@/apollo/client';
import { Notification } from '@/Components/Common/Notification';

View File

@ -1,17 +1,31 @@
/* eslint-disable no-negated-condition */
import type { Elements } from '@/Components/Calculation/config/map/values';
import * as CRMTypes from '@/graphql/crm.types';
import type { ProcessContext } from '@/process/types';
import type { DocumentNode } from '@apollo/client';
import { gql } from '@apollo/client';
import { reaction } from 'mobx';
type LinkReactionParams = {
elementName: Elements;
entityName: string;
linkElementName: Elements;
query: DocumentNode;
variableName: string;
};
export default function reactions({ store, apolloClient }: ProcessContext) {
const { $calculation } = store;
/**
* При выборе Интереса, ЛС и Предложения скачиваем ссылку CRM
*/
function makeLinkReaction(elementName: Elements, linkElementName: Elements, query: DocumentNode) {
function makeLinkReaction({
elementName,
linkElementName,
query,
variableName,
entityName,
}: LinkReactionParams) {
reaction(
() => $calculation.element(elementName).getValue(),
(id) => {
@ -29,13 +43,13 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
.query({
query,
variables: {
id,
[variableName]: id,
},
})
.then(({ data }) => {
clearTimeout(timeoutId);
if (data.entity?.link) {
$calculation.element(linkElementName).setValue(data.entity?.link);
if (data[entityName]?.link) {
$calculation.element(linkElementName).setValue(data[entityName]?.link);
}
})
.catch(() => {
@ -56,30 +70,27 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
);
}
const QUERY_GET_LEAD_URL = gql`
query GetLeadUrl($id: Uuid!) {
entity: lead(leadid: $id) {
link
}
}
`;
makeLinkReaction('selectLead', 'linkLeadUrl', QUERY_GET_LEAD_URL);
makeLinkReaction({
elementName: 'selectLead',
entityName: 'lead',
linkElementName: 'linkLeadUrl',
query: CRMTypes.GetLeadDocument,
variableName: 'leadid',
});
const QUERY_GET_OPPORTUNITY_URL = gql`
query GetOpportunityUrl($id: Uuid!) {
entity: opportunity(opportunityid: $id) {
link
}
}
`;
makeLinkReaction('selectOpportunity', 'linkOpportunityUrl', QUERY_GET_OPPORTUNITY_URL);
makeLinkReaction({
elementName: 'selectOpportunity',
entityName: 'opportunity',
linkElementName: 'linkOpportunityUrl',
query: CRMTypes.GetOpportunityDocument,
variableName: 'opportunityid',
});
const QUERY_GET_QUOTE_URL = gql`
query GetQuoteUrl($id: Uuid!) {
entity: quote(quoteId: $id) {
link
}
}
`;
makeLinkReaction('selectQuote', 'linkQuoteUrl', QUERY_GET_QUOTE_URL);
makeLinkReaction({
elementName: 'selectQuote',
entityName: 'quote',
linkElementName: 'linkQuoteUrl',
query: CRMTypes.GetQuoteDocument,
variableName: 'quoteId',
});
}

View File

@ -1,4 +1,3 @@
const { downloadSchema, generateTypescript } = require('./lib/graphql');
const { downloadSchema } = require('./lib/graphql');
downloadSchema();
generateTypescript();

View File

@ -0,0 +1,4 @@
/* fix antd tables override scroll style */
.ant-table {
scrollbar-color: unset !important;
}

View File

@ -1,9 +1,23 @@
{
"extends": "tsconfig/nextjs.json",
"$schema": "https://json.schemastore.org/tsconfig",
"files": ["@types/graphql.d.ts"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
"exclude": ["node_modules"],
"compilerOptions": {
"target": "ES2020",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"downlevelIteration": true,
"baseUrl": ".",
"paths": {
"@/*": ["*"]

View File

@ -12,16 +12,14 @@
"test": "dotenv -e .env.local turbo run test",
"prepare": "husky install",
"precommit": "pnpm format && pnpm lint:fix && pnpm test",
"graphql:update": "dotenv -e .env.local node ./scripts/graphql-update.js",
"graphql:codegen": "dotenv -e .env.local node ./scripts/graphql-codegen.js"
"graphql:update": "dotenv -e .env.local turbo run graphql:update",
"graphql:codegen": "dotenv -e .env.local turbo run graphql:codegen"
},
"dependencies": {},
"devDependencies": {
"dotenv-cli": "^7.0.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"prettier": "^2.8.4",
"tools": "workspace:*",
"turbo": "^1.12.4"
},
"engines": {

View File

@ -1,11 +1,10 @@
module.exports = {
root: true,
extends: [
'@vchikalkin/eslint-config-awesome/typescript/config',
'@vchikalkin/eslint-config-awesome/typescript/rules',
],
const { createConfig } = require('@vchikalkin/eslint-config-awesome');
module.exports = createConfig('typescript', {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
};
ignorePatterns: ['*.config.js', '.eslintrc.js'],
root: true,
});

View File

@ -8,8 +8,8 @@
"lint": "TIMING=1 eslint \"**/*.ts*\""
},
"devDependencies": {
"@vchikalkin/eslint-config-awesome": "^1.1.1",
"eslint": "^8.46.0"
},
"dependencies": {}
"@vchikalkin/eslint-config-awesome": "^1.1.6",
"eslint": "^8.52.0",
"tsconfig": "workspace:*"
}
}

View File

@ -2,5 +2,5 @@
"extends": "tsconfig/common.json",
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
"exclude": ["dist", "build", "node_modules"],
"compilerOptions": { "outDir": "./build" }
"compilerOptions": { "outDir": "./build", "lib": ["DOM", "ES2020"] }
}

View File

@ -1,22 +0,0 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"extends": "./base.json",
"compilerOptions": {
"target": "ES6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["src", "next-env.d.ts"],
"exclude": ["node_modules"]
}

View File

@ -1,15 +1,17 @@
module.exports = {
root: true,
extends: [
'@vchikalkin/eslint-config-awesome/react-typescript/config',
'@vchikalkin/eslint-config-awesome/react-typescript/rules',
],
const { createConfig } = require('@vchikalkin/eslint-config-awesome');
module.exports = createConfig('react-typescript', {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
rules: {
'import/no-duplicates': 'off',
'react/forbid-component-props': 'off',
'import/consistent-type-specifier-style': 'off',
'unicorn/filename-case': 'off',
'react/jsx-no-bind': 'off',
},
};
ignorePatterns: ['*.config.js', '.eslintrc.js'],
root: true,
});

View File

@ -12,18 +12,18 @@
"@types/react-dom": "^18.2.6",
"@types/rebass": "^4.0.10",
"@types/styled-components": "^5.1.26",
"@vchikalkin/eslint-config-awesome": "^1.1.1",
"eslint": "^8.46.0",
"@vchikalkin/eslint-config-awesome": "^1.1.6",
"eslint": "^8.52.0",
"react": "^18.2.0",
"tsconfig": "workspace:*",
"typescript": "^4.9.5"
"typescript": "^5.3.3"
},
"dependencies": {
"@ant-design/cssinjs": "^1.10.1",
"@ant-design/icons": "^5.1.4",
"antd": "^5.6.3",
"@ant-design/cssinjs": "^1.18.4",
"@ant-design/icons": "^5.3.0",
"antd": "^5.14.2",
"rebass": "^4.0.7",
"styled-components": "^5.3.6",
"styled-components": "^5.3.11",
"use-debounce": "^9.0.3"
}
}

734
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
const run = require('tools/scripts');
const command = ['yarn', 'workspace', 'web', 'graphql:codegen'].join(' ');
run(command, '*** Update GraphQL files ***');

View File

@ -1,5 +0,0 @@
const run = require('tools/scripts');
const command = ['yarn', 'workspace', 'web', 'graphql:update'].join(' ');
run(command, '*** Update GraphQL files ***');

View File

@ -24,6 +24,12 @@
},
"clean": {
"cache": false
},
"graphql:codegen": {
"cache": false
},
"graphql:update": {
"cache": false
}
}
}