diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..72e9aa4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +Dockerfile +.dockerignore +node_modules +npm-debug.log +README.md +.next +.git \ No newline at end of file diff --git a/.env b/.env index c9d9d97..c305002 100644 --- a/.env +++ b/.env @@ -1,6 +1,2 @@ ####### USERS ######## USERS_SUPER=["akalinina","vchikalkin"] - -####### URLS ######## -URL_GET_USER=http://auth_service/auth/user -NEXT_PUBLIC_URL_CRM_GRAPHQL_PROXY=/api/crmgraphql \ No newline at end of file diff --git a/.env.production b/.env.production deleted file mode 100644 index 28b3c72..0000000 --- a/.env.production +++ /dev/null @@ -1,8 +0,0 @@ -####### Colors ######## -NEXT_PUBLIC_COLOR_PRIMARY=#1C01A9 -NEXT_PUBLIC_COLOR_SECONDARY=#3A0185 -NEXT_PUBLIC_COLOR_TERTIARTY=#580161 - - -####### ICONS ######## -NEXT_PUBLIC_FAVICON=favicon.prod.ico \ No newline at end of file diff --git a/.env.production.dev b/.env.production.dev deleted file mode 100644 index 7bf7b0e..0000000 --- a/.env.production.dev +++ /dev/null @@ -1,4 +0,0 @@ -####### Colors ######## -NEXT_PUBLIC_COLOR_PRIMARY=#BF3676 -NEXT_PUBLIC_COLOR_SECONDARY=#FD4047 -NEXT_PUBLIC_COLOR_TERTIARTY=#FF9112 \ No newline at end of file diff --git a/Components/Calculation/config/elements-render/override.tsx b/Components/Calculation/config/elements-render/override.tsx index a8a7498..506120e 100644 --- a/Components/Calculation/config/elements-render/override.tsx +++ b/Components/Calculation/config/elements-render/override.tsx @@ -19,6 +19,7 @@ const defaultLinkProps: ComponentProps = { const overrideRender: Partial> = { selectLead: { render: () => { + const elementName = 'selectLead'; const title = titles.selectLead; const valueName = map.selectLead; const Component = components.selectLead; @@ -26,7 +27,7 @@ const overrideRender: Partial> = { const builder = builders.selectLead; const Element = builder(Component, { - elementName: 'selectLead', + elementName, valueName, }); @@ -36,9 +37,13 @@ const overrideRender: Partial> = { }); return ( - - } /> - + + } + /> + ); }, @@ -46,6 +51,7 @@ const overrideRender: Partial> = { selectOpportunity: { render: () => { + const elementName = 'selectOpportunity'; const title = titles.selectOpportunity; const valueName = map.selectOpportunity; const Component = components.selectOpportunity; @@ -53,7 +59,7 @@ const overrideRender: Partial> = { const builder = builders.selectOpportunity; const Element = builder(Component, { - elementName: 'selectOpportunity', + elementName, valueName, }); @@ -63,9 +69,13 @@ const overrideRender: Partial> = { }); return ( - - } /> - + + } + /> + ); }, @@ -73,6 +83,7 @@ const overrideRender: Partial> = { selectQuote: { render: () => { + const elementName = 'selectQuote'; const title = titles.selectQuote; const valueName = map.selectQuote; const Component = components.selectQuote; @@ -80,7 +91,7 @@ const overrideRender: Partial> = { const builder = builders.selectQuote; const Element = builder(Component, { - elementName: 'selectQuote', + elementName, valueName, }); @@ -90,9 +101,13 @@ const overrideRender: Partial> = { }); return ( - - } /> - + + } + /> + ); }, @@ -100,6 +115,7 @@ const overrideRender: Partial> = { tbxVehicleTaxInYear: { render: () => { + const elementName = 'tbxVehicleTaxInYear'; const title = titles.tbxVehicleTaxInYear; const valueName = map.tbxVehicleTaxInYear; const Component = components.tbxVehicleTaxInYear; @@ -107,15 +123,15 @@ const overrideRender: Partial> = { const builder = builders.tbxVehicleTaxInYear; const Element = builder(Component, { - elementName: 'tbxVehicleTaxInYear', + elementName, valueName, }); return ( - - + + ); @@ -124,6 +140,7 @@ const overrideRender: Partial> = { selectHighSeasonStart: { render: () => { + const elementName = 'selectHighSeasonStart'; const title = titles.selectHighSeasonStart; const valueName = map.selectHighSeasonStart; const Component = components.selectHighSeasonStart; @@ -131,15 +148,15 @@ const overrideRender: Partial> = { const builder = builders.selectHighSeasonStart; const Element = builder(Component, { - elementName: 'selectHighSeasonStart', + elementName, valueName, }); return ( - - + + ); diff --git a/Components/Calculation/config/elements-render/render.jsx b/Components/Calculation/config/elements-render/render.jsx index 40cc729..2fee6d3 100644 --- a/Components/Calculation/config/elements-render/render.jsx +++ b/Components/Calculation/config/elements-render/render.jsx @@ -21,8 +21,8 @@ const render = Object.keys(map).reduce((acc, elementName) => { acc[elementName] = { render: () => ( - - + + ), }; diff --git a/Components/Layout/Element.tsx b/Components/Layout/Element.tsx index b7c869d..0d7570a 100644 --- a/Components/Layout/Element.tsx +++ b/Components/Layout/Element.tsx @@ -3,7 +3,7 @@ import styled from 'styled-components'; import { Flex } from 'UIKit/grid'; import { min } from 'UIKit/mq'; -const ElementTitle = styled.h5` +const ElementTitle = styled.label` color: rgba(0, 0, 0, 0.75); font-weight: 600; font-size: 13px; @@ -18,10 +18,18 @@ const ElementTitle = styled.h5` } `; -export function Head({ title, addon }: { title: string; addon?: ReactNode }) { +export function Head({ + title, + addon, + htmlFor, +}: { + title: string; + addon?: ReactNode; + htmlFor: string; +}) { return ( - {title} + {title} {addon} ); diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8cdbd17 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,65 @@ +# Install dependencies only when needed +FROM node:16-alpine AS deps +# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. +RUN apk add --no-cache libc6-compat +WORKDIR /app +COPY package.json yarn.lock ./ +RUN yarn install --frozen-lockfile + +# If using npm with a `package-lock.json` comment out above and use below instead +# COPY package.json package-lock.json ./ +# RUN npm ci + +# Rebuild the source code only when needed +FROM node:16-alpine AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +ARG NEXT_PUBLIC_URL_CRM_GRAPHQL_PROXY +ARG NEXT_PUBLIC_COLOR_PRIMARY +ARG NEXT_PUBLIC_COLOR_SECONDARY +ARG NEXT_PUBLIC_COLOR_TERTIARTY +ARG NEXT_PUBLIC_FAVICON +ARG NEXT_TELEMETRY_DISABLED +ARG NEXT_PUBLIC_URL_CRM_GRAPHQL_DIRECT +ARG NEXT_PUBLIC_URL_GET_USER + +# Next.js collects completely anonymous telemetry data about general usage. +# Learn more here: https://nextjs.org/telemetry +# Uncomment the following line in case you want to disable telemetry during the build. +# ENV NEXT_TELEMETRY_DISABLED 1 + +RUN yarn build + +# If using npm comment out above and use below instead +# RUN npm run build + +# Production image, copy all the files and run next +FROM node:16-alpine AS runner +WORKDIR /app + +ENV NODE_ENV production +# Uncomment the following line in case you want to disable telemetry during runtime. +# ENV NEXT_TELEMETRY_DISABLED 1 + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +# You only need to copy next.config.js if you are NOT using the default configuration +COPY --from=builder /app/next.config.js ./ +COPY --from=builder /app/public ./public +COPY --from=builder /app/package.json ./package.json + +# Automatically leverage output traces to reduce image size +# https://nextjs.org/docs/advanced-features/output-file-tracing +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +USER nextjs + +EXPOSE 3000 + +ENV PORT 3000 + +CMD ["node", "server.js"] \ No newline at end of file diff --git a/apollo.config.js b/apollo.config.js index 282644d..2ca1c18 100644 --- a/apollo.config.js +++ b/apollo.config.js @@ -3,7 +3,7 @@ module.exports = { client: { service: { name: 'crmgraphql', - // url: process.env.URL_CRM_GRAPHQL_DIRECT, + // url: process.env.NEXT_PUBLIC_URL_CRM_GRAPHQL_DIRECT, localSchemaFile: './graphql/crm.schema.graphql', }, excludes: ['graphql/**/*'], diff --git a/apollo/client.js b/apollo/client.js index 54a08d8..1fb0e6d 100644 --- a/apollo/client.js +++ b/apollo/client.js @@ -7,7 +7,7 @@ let apolloClient; // prettier-ignore const uri = typeof window === 'undefined' - ? process.env.URL_CRM_GRAPHQL_DIRECT + ? process.env.NEXT_PUBLIC_URL_CRM_GRAPHQL_DIRECT : process.env.NEXT_PUBLIC_URL_CRM_GRAPHQL_PROXY; function createApolloClient() { diff --git a/mocks/handlers.js b/mocks/handlers.js index bcad7fd..ef92dff 100644 --- a/mocks/handlers.js +++ b/mocks/handlers.js @@ -20,7 +20,7 @@ const users = { }; export const handlers = [ - rest.get('http://auth_service/auth/user', (req, res, ctx) => { - return res(ctx.json(users.akalinina)); + rest.get('http://auth_service/user', (req, res, ctx) => { + return res(ctx.json(users.vchikalkin)); }), ]; diff --git a/next.config.js b/next.config.js index 27c538d..5e63f28 100644 --- a/next.config.js +++ b/next.config.js @@ -1,3 +1,4 @@ +/* eslint-disable operator-linebreak */ /* eslint-disable @typescript-eslint/no-var-requires */ const withPlugins = require('next-compose-plugins'); const withLess = require('next-with-less'); @@ -5,6 +6,7 @@ const withGraphQL = require('next-plugin-graphql'); /** @type {import('next').NextConfig} */ const nextConfig = { + output: 'standalone', swcMinify: true, reactStrictMode: true, eslint: { @@ -14,14 +16,6 @@ const nextConfig = { styledComponents: true, }, pageExtensions: ['tsx', 'jsx'], - async rewrites() { - return [ - { - source: process.env.NEXT_PUBLIC_URL_CRM_GRAPHQL_PROXY, - destination: process.env.URL_CRM_GRAPHQL_DIRECT, - }, - ]; - }, experimental: { modularizeImports: { 'lodash-es': { @@ -30,6 +24,16 @@ const nextConfig = { }, }, }, + rewrites: + process.env.NODE_ENV === 'development' && + async function rewrites() { + return [ + { + source: process.env.NEXT_PUBLIC_URL_CRM_GRAPHQL_PROXY, + destination: process.env.NEXT_PUBLIC_URL_CRM_GRAPHQL_DIRECT, + }, + ]; + }, }; const plugins = [ diff --git a/package.json b/package.json index 2bc3d26..3de2508 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "next-compose-plugins": "^2.2.1", "next-plugin-graphql": "^0.0.2", "next-with-less": "^2.0.5", + "normalize.css": "^8.0.1", "react": "^18.2.0", "react-dom": "^18.2.0", "rebass": "^4.0.7", diff --git a/pages/_app.tsx b/pages/_app.tsx index 12be3d2..3e36f52 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -6,10 +6,12 @@ import { useApollo } from 'apollo/hooks'; import Layout from 'Components/Layout'; import type { AppProps } from 'next/app'; import Head from 'next/head'; +import 'normalize.css'; import StoreProvider from 'stores/Provider'; import { ThemeProvider } from 'styled-components'; import { GlobalStyle } from 'UIKit/colors'; import theme from 'UIKit/theme'; +import '../styles/fonts.css'; import '../styles/globals.css'; import ruRU from 'antd/lib/locale/ru_RU'; diff --git a/pages/_document.jsx b/pages/_document.jsx index 32e99a5..ef528a8 100644 --- a/pages/_document.jsx +++ b/pages/_document.jsx @@ -7,6 +7,7 @@ export default class MyDocument extends Document { const originalRenderPage = ctx.renderPage; try { + // prettier-ignore ctx.renderPage = () => originalRenderPage({ enhanceApp: (App) => (props) => sheet.collectStyles(), }); @@ -32,27 +33,9 @@ export default class MyDocument extends Document { - - - - - - - - + diff --git a/pages/index.tsx b/pages/index.jsx similarity index 65% rename from pages/index.tsx rename to pages/index.jsx index 35de6bb..e289fad 100644 --- a/pages/index.tsx +++ b/pages/index.jsx @@ -3,16 +3,13 @@ import { useApolloClient } from '@apollo/client'; import initializeApollo from 'apollo/client'; import * as Calculation from 'Components/Calculation'; import Output from 'Components/Output'; -import defaultOptions from 'config/default-options'; -import * as InsuranceTableConfig from 'config/tables/insurance-table'; -import { merge } from 'lodash-es'; -import type { GetServerSideProps } from 'next'; import Head from 'next/head'; import * as agentsReactions from 'process/agents/reactions'; import * as calculateReactions from 'process/calculate/reactions'; -import { getCRMData } from 'process/init/get-data'; +import { getInsuranceData, getMainData, getOwnerData } from 'process/init/get-data'; import * as leadOpportunityReactions from 'process/lead-opportunity/reactions'; import paymentsReactions from 'process/payments/reactions'; +import { useEffect } from 'react'; import { fetchUser } from 'services/user'; import { useStore } from 'stores/hooks'; import styled from 'styled-components'; @@ -43,21 +40,29 @@ const Grid = styled(Box)` } `; +function injectReactions(store, apolloClient) { + leadOpportunityReactions.common(store, apolloClient); + leadOpportunityReactions.urls(store, apolloClient); + paymentsReactions(store, apolloClient); + calculateReactions.validation(store, apolloClient); + agentsReactions.common(store, apolloClient); +} + function Home() { const store = useStore(); const apolloClient = useApolloClient(); - /** - * add reactions to store - */ + useEffect(() => { + getMainData(apolloClient).then(({ options }) => { + store.$calculation.$options.setManyOptions(options); + }); - setTimeout(() => { - leadOpportunityReactions.common(store, apolloClient); - leadOpportunityReactions.urls(store, apolloClient); - paymentsReactions(store, apolloClient); - calculateReactions.validation(store, apolloClient); - agentsReactions.common(store, apolloClient); - }); + getInsuranceData(apolloClient).then(({ tables }) => { + store.$tables.insurance.setManyRowOptions(tables.insurance); + }); + + injectReactions(store, apolloClient); + }, []); return ( @@ -71,7 +76,7 @@ function Home() { ); } -export const getServerSideProps: GetServerSideProps = async ({ req }) => { +export const getServerSideProps = async ({ req }) => { const { cookie = '' } = req.headers; const user = await fetchUser({ @@ -81,18 +86,14 @@ export const getServerSideProps: GetServerSideProps = async ({ req }) => { }); const apolloClient = initializeApollo(); - const { options, tables } = await getCRMData(apolloClient, user); + + const { options: ownerOptions } = await getOwnerData(apolloClient, user); return { props: { user, calculation: { - options: merge(defaultOptions, options), - }, - tables: { - insurance: { - options: merge(InsuranceTableConfig.defaultOptions, tables.insurance), - }, + options: ownerOptions, }, initialApolloState: apolloClient.cache.extract(), diff --git a/process/init/get-data.ts b/process/init/get-data.ts index ad23c19..5154df7 100644 --- a/process/init/get-data.ts +++ b/process/init/get-data.ts @@ -5,7 +5,6 @@ import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { getDomainName } from 'services/user/tools'; import type { User } from 'services/user/types'; -import { normalizeOptions } from 'tools/entity'; import type { GetAddproductTypes } from './__generated__/GetAddproductTypes'; import type { GetInsuranceData } from './__generated__/GetInsuranceData'; import type { GetMainOptions } from './__generated__/GetMainOptions'; @@ -133,42 +132,28 @@ const QUERY_GET_INSURANCE_DATA = gql` } `; -export async function getCRMData(apolloClient: ApolloClient, user: User) { - const { - data: { selectLead, selectOpportunity }, - } = await apolloClient.query({ +export async function getOwnerData(apolloClient: ApolloClient, user: User) { + const { data: ownerData } = await apolloClient.query({ query: QUERY_GET_OWNER_DATA, variables: { domainname: getDomainName(user), }, }); + return { + options: ownerData, + }; +} + +export async function getMainData(apolloClient: ApolloClient) { // prettier-ignore - const { data: options } = await apolloClient.query({ + const { data: mainOptions } = await apolloClient.query({ query: QUERY_GET_MAIN_OPTIONS, variables: { currentDate: dayjs().utc().toISOString() } }); - const { - data: { kasko, osago, fingap }, - } = await apolloClient.query({ - query: QUERY_GET_INSURANCE_DATA, - }); - - const insuranceData = { - osago: { - insuranceCompany: normalizeOptions(osago), - }, - kasko: { - insuranceCompany: normalizeOptions(kasko), - }, - fingap: { - insuranceCompany: normalizeOptions(fingap), - }, - }; - const { data: subsidies } = await apolloClient.query({ query: QUERY_GET_SUBSIDIES, variables: { @@ -230,9 +215,7 @@ export async function getCRMData(apolloClient: ApolloClient, us return { options: { - selectLead, - selectOpportunity, - ...options, + ...mainOptions, selectSubsidy, selectImportProgram, selectRegionRegistration, @@ -244,8 +227,29 @@ export async function getCRMData(apolloClient: ApolloClient, us selectTracker, selectInsNSIB, }, + }; +} + +export async function getInsuranceData(apolloClient: ApolloClient) { + const { data: insuranceData } = await apolloClient.query({ + query: QUERY_GET_INSURANCE_DATA, + }); + + const insurance = { + osago: { + insuranceCompany: insuranceData.osago, + }, + kasko: { + insuranceCompany: insuranceData.kasko, + }, + fingap: { + insuranceCompany: insuranceData.fingap, + }, + }; + + return { tables: { - insurance: insuranceData, + insurance, }, }; } diff --git a/process/payments/reactions.ts b/process/payments/reactions.ts index 14ad190..2848c71 100644 --- a/process/payments/reactions.ts +++ b/process/payments/reactions.ts @@ -41,6 +41,9 @@ export default function paymentsReactions(store: RootStore, apolloClient: Apollo } else { removeError(); } + }, + { + fireImmediately: true, } ); } diff --git a/public/fonts/Montserrat/Montserrat-Black.ttf b/public/fonts/Montserrat/Montserrat-Black.ttf new file mode 100644 index 0000000..7bb6575 Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-Black.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-BlackItalic.ttf b/public/fonts/Montserrat/Montserrat-BlackItalic.ttf new file mode 100644 index 0000000..172e249 Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-BlackItalic.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-Bold.ttf b/public/fonts/Montserrat/Montserrat-Bold.ttf new file mode 100644 index 0000000..efddc83 Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-Bold.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-BoldItalic.ttf b/public/fonts/Montserrat/Montserrat-BoldItalic.ttf new file mode 100644 index 0000000..b7d8031 Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-BoldItalic.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-ExtraBold.ttf b/public/fonts/Montserrat/Montserrat-ExtraBold.ttf new file mode 100644 index 0000000..3059507 Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-ExtraBold.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-ExtraBoldItalic.ttf b/public/fonts/Montserrat/Montserrat-ExtraBoldItalic.ttf new file mode 100644 index 0000000..c21a396 Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-ExtraBoldItalic.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-ExtraLight.ttf b/public/fonts/Montserrat/Montserrat-ExtraLight.ttf new file mode 100644 index 0000000..f1b405e Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-ExtraLight.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-ExtraLightItalic.ttf b/public/fonts/Montserrat/Montserrat-ExtraLightItalic.ttf new file mode 100644 index 0000000..382293d Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-ExtraLightItalic.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-Italic.ttf b/public/fonts/Montserrat/Montserrat-Italic.ttf new file mode 100644 index 0000000..eee45ba Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-Italic.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-Light.ttf b/public/fonts/Montserrat/Montserrat-Light.ttf new file mode 100644 index 0000000..c5dfdb7 Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-Light.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-LightItalic.ttf b/public/fonts/Montserrat/Montserrat-LightItalic.ttf new file mode 100644 index 0000000..5bdce7f Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-LightItalic.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-Medium.ttf b/public/fonts/Montserrat/Montserrat-Medium.ttf new file mode 100644 index 0000000..dfc7e2f Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-Medium.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-MediumItalic.ttf b/public/fonts/Montserrat/Montserrat-MediumItalic.ttf new file mode 100644 index 0000000..ce56883 Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-MediumItalic.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-Regular.ttf b/public/fonts/Montserrat/Montserrat-Regular.ttf new file mode 100644 index 0000000..aa9033a Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-Regular.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-SemiBold.ttf b/public/fonts/Montserrat/Montserrat-SemiBold.ttf new file mode 100644 index 0000000..cbf44db Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-SemiBold.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-SemiBoldItalic.ttf b/public/fonts/Montserrat/Montserrat-SemiBoldItalic.ttf new file mode 100644 index 0000000..7f9153d Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-SemiBoldItalic.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-Thin.ttf b/public/fonts/Montserrat/Montserrat-Thin.ttf new file mode 100644 index 0000000..7c90a54 Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-Thin.ttf differ diff --git a/public/fonts/Montserrat/Montserrat-ThinItalic.ttf b/public/fonts/Montserrat/Montserrat-ThinItalic.ttf new file mode 100644 index 0000000..94bcf55 Binary files /dev/null and b/public/fonts/Montserrat/Montserrat-ThinItalic.ttf differ diff --git a/services/user/index.ts b/services/user/index.ts index 246850c..2ddecc9 100644 --- a/services/user/index.ts +++ b/services/user/index.ts @@ -6,7 +6,7 @@ import type { User } from './types'; export async function fetchUser(config: AxiosRequestConfig) { const user = await axios - .get(process.env.URL_GET_USER || '', config) + .get(process.env.NEXT_PUBLIC_URL_GET_USER || '', config) .then((res) => love(res.data)); return user; diff --git a/stores/calculation/options/index.ts b/stores/calculation/options/index.ts index ddc77d2..cfb4f26 100644 --- a/stores/calculation/options/index.ts +++ b/stores/calculation/options/index.ts @@ -3,6 +3,7 @@ import type { Elements, ElementsTypes } from 'Components/Calculation/config/map/values'; import defaultOptions from 'config/default-options'; import type { BaseOption } from 'Elements/types'; +import { merge } from 'lodash-es'; import { makeAutoObservable } from 'mobx'; import type RootStore from 'stores/root'; import type { CalculationOptions } from './types'; @@ -17,7 +18,7 @@ export default class OptionsStore { } hydrate = (initialOptions: CalculationOptions) => { - this.options = initialOptions; + this.options = merge(defaultOptions, initialOptions); }; getOptions(elementName: T) { diff --git a/stores/tables/insurance/index.ts b/stores/tables/insurance/index.ts index 9193823..9808fae 100644 --- a/stores/tables/insurance/index.ts +++ b/stores/tables/insurance/index.ts @@ -56,10 +56,14 @@ export default class InsuranceTable { return this.options[key]; } - setRowOptions = (key: Insurance.Keys, rowOptions: Partial) => { + setRowOptions = (key: Insurance.Keys, rowOptions: Insurance.RowOptions) => { mergeWith(this.options[key], rowOptions); }; + setManyRowOptions = (options: Partial>) => { + mergeWith(this.options, options); + }; + getRowStatuses(key: Insurance.Keys) { return this.statuses[key]; } diff --git a/styles/fonts.css b/styles/fonts.css new file mode 100644 index 0000000..f1381c7 --- /dev/null +++ b/styles/fonts.css @@ -0,0 +1,6 @@ +@font-face { + font-family: Montserrat; + src: url('../public/fonts/Montserrat/Montserrat-Medium.ttf'); + font-weight: 500; + font-style: normal; +} diff --git a/tsconfig.json b/tsconfig.json index 9b76141..25bdbb6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,5 +19,5 @@ }, "files": ["types/graphql.d.ts"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"], - "exclude": ["node_modules", "**/__generated__"] + "exclude": ["node_modules", "**/__generated__", "./types/graphql.ts"] } diff --git a/yarn.lock b/yarn.lock index 3fbd6d3..d1b7d13 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4380,6 +4380,11 @@ normalize-url@^6.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== +normalize.css@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/normalize.css/-/normalize.css-8.0.1.tgz#9b98a208738b9cc2634caacbc42d131c97487bf3" + integrity sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg== + npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea"