eslint: apply fixes to code in project
This commit is contained in:
parent
63ac9958f1
commit
b0a3307700
@ -20,6 +20,7 @@ const UserText = styled.span`
|
||||
|
||||
const User = observer(() => {
|
||||
const { $user } = useStore();
|
||||
|
||||
return <UserText>{$user?.user?.displayName}</UserText>;
|
||||
});
|
||||
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
import { Box, Flex } from 'rebass/styled-components';
|
||||
|
||||
export { Box, Flex };
|
||||
|
||||
@ -5,8 +5,7 @@ import { ApolloClient, InMemoryCache } from '@apollo/client';
|
||||
/** @type {import('@apollo/client').ApolloClient<NormalizedCacheObject>} */
|
||||
let apolloClient;
|
||||
|
||||
const uri =
|
||||
typeof window === 'undefined'
|
||||
const uri = typeof window === 'undefined'
|
||||
? process.env.URL_CRM_GRAPHQL_DIRECT
|
||||
: process.env.NEXT_PUBLIC_URL_CRM_GRAPHQL_PROXY;
|
||||
|
||||
|
||||
@ -4,5 +4,6 @@ import initializeApollo from './client';
|
||||
|
||||
export function useApollo(initialState) {
|
||||
const client = useMemo(() => initializeApollo(initialState), [initialState]);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
@ -7,8 +7,7 @@ export default class MyDocument extends Document {
|
||||
const originalRenderPage = ctx.renderPage;
|
||||
|
||||
try {
|
||||
ctx.renderPage = () =>
|
||||
originalRenderPage({
|
||||
ctx.renderPage = () => originalRenderPage({
|
||||
enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />),
|
||||
});
|
||||
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import axios, { AxiosRequestConfig } from 'axios';
|
||||
import type { AxiosRequestConfig } from 'axios';
|
||||
import axios from 'axios';
|
||||
import type { User } from './types';
|
||||
|
||||
function love(user: User) {
|
||||
const superUsers: string[] = JSON.parse(process.env.USERS_SUPER || '');
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
if (superUsers?.includes(user.username)) user.displayName += '🧡';
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
@ -3,5 +3,6 @@ import { initializeStore, StoreContext } from '.';
|
||||
|
||||
export default function StoreProvider({ children, ...initialData }) {
|
||||
const store = initializeStore(initialData);
|
||||
|
||||
return <StoreContext.Provider value={store}>{children}</StoreContext.Provider>;
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import type { Elements } from 'Components/Calculation/config/map-values';
|
||||
import type { BaseOption } from 'Elements/types';
|
||||
import { mergeWith } from 'lodash';
|
||||
import { makeAutoObservable } from 'mobx';
|
||||
import RootStore from 'stores/root';
|
||||
import type RootStore from 'stores/root';
|
||||
import type { CalculationOptions, Filter, OptionsFilters } from './types';
|
||||
|
||||
const EXCLUDE_RESET_ELEMENTS: Elements[] = ['selectTechnicalCard', 'selectTownRegistration'];
|
||||
@ -43,6 +43,7 @@ export default class OptionsStore {
|
||||
/** **************** OPTIONS **************** */
|
||||
getOption(elementName: Elements) {
|
||||
const value = this.root.$calculation.$values.getValueByElement(elementName);
|
||||
|
||||
return this.options[elementName]?.find((x) => x.value === value);
|
||||
}
|
||||
|
||||
@ -57,6 +58,7 @@ export default class OptionsStore {
|
||||
if (!settings?.filtered) return options;
|
||||
|
||||
const filter = this.filters[elementName];
|
||||
|
||||
return filter ? options && filter(options) : options;
|
||||
}
|
||||
|
||||
@ -97,6 +99,7 @@ export default class OptionsStore {
|
||||
if (!filteredOptons?.length || !filteredOptons.some((x) => x.value === elementValue)) {
|
||||
this.root.$calculation.$values.clearValueOfElement(elementName);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import type { Elements } from 'Components/Calculation/config/map-values';
|
||||
import type { Status } from 'Elements/types';
|
||||
import { makeAutoObservable } from 'mobx';
|
||||
import RootStore from 'stores/root';
|
||||
import type RootStore from 'stores/root';
|
||||
import type { CalculationStatuses } from './types';
|
||||
|
||||
export default class StatusStore {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import type { Elements } from 'Components/Calculation/config/map-values';
|
||||
import { makeAutoObservable, observable } from 'mobx';
|
||||
import RootStore from 'stores/root';
|
||||
import type RootStore from 'stores/root';
|
||||
import type { Error, Messages } from './types';
|
||||
|
||||
export default class ValidationStore {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { makeAutoObservable } from 'mobx';
|
||||
import type { User } from 'services/user/types';
|
||||
import RootStore from './root';
|
||||
import type RootStore from './root';
|
||||
|
||||
export default class UserStore {
|
||||
root: RootStore;
|
||||
@ -18,8 +18,10 @@ export default class UserStore {
|
||||
getDomainName() {
|
||||
if (this.user) {
|
||||
const { username, domain } = this.user;
|
||||
|
||||
return `${domain}\\${username}`;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user