Reorganize frontend and install Craco to alias modules (#190)
This commit is contained in:
@ -5,7 +5,7 @@ module.exports = {
|
|||||||
tsconfigRootDir: __dirname,
|
tsconfigRootDir: __dirname,
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
plugins: ['@typescript-eslint/eslint-plugin'],
|
plugins: ['@typescript-eslint/eslint-plugin', 'simple-import-sort'],
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:@typescript-eslint/recommended',
|
'plugin:@typescript-eslint/recommended',
|
||||||
'plugin:prettier/recommended',
|
'plugin:prettier/recommended',
|
||||||
@ -17,12 +17,33 @@ module.exports = {
|
|||||||
node: true,
|
node: true,
|
||||||
jest: true,
|
jest: true,
|
||||||
},
|
},
|
||||||
|
overrides: [
|
||||||
ignorePatterns: ['.eslintrc.js', 'codegen.js', '**/generated/*'],
|
{
|
||||||
|
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
|
||||||
|
rules: {
|
||||||
|
'simple-import-sort/imports': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
groups: [
|
||||||
|
['^react', '^@?\\w'],
|
||||||
|
['^(@|~)(/.*|$)'],
|
||||||
|
['^\\u0000'],
|
||||||
|
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
|
||||||
|
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
|
||||||
|
['^.+\\.?(css)$']
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
ignorePatterns: ['.eslintrc.js', 'codegen.js', '**/generated/*', '*.config.js'],
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/interface-name-prefix': 'off',
|
'@typescript-eslint/interface-name-prefix': 'off',
|
||||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'simple-import-sort/imports': 'error',
|
||||||
|
'simple-import-sort/exports': 'error'
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
webpackFinal: config => {
|
webpackFinal: config => {
|
||||||
config.module.rules.push({
|
config.module.rules.push({
|
||||||
@ -19,6 +21,11 @@ module.exports = {
|
|||||||
type: 'javascript/auto'
|
type: 'javascript/auto'
|
||||||
});
|
});
|
||||||
config.resolve.extensions.push('.mjs');
|
config.resolve.extensions.push('.mjs');
|
||||||
|
config.resolve.alias = {
|
||||||
|
...config.resolve.alias,
|
||||||
|
'~': path.resolve(__dirname, "../src"),
|
||||||
|
'@': path.resolve(__dirname, "../src/modules"),
|
||||||
|
};
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
||||||
20
front/craco.config.js
Normal file
20
front/craco.config.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
webpack: {
|
||||||
|
alias: {
|
||||||
|
'~': path.resolve(__dirname, 'src'),
|
||||||
|
'@': path.resolve(__dirname, 'src/modules'),
|
||||||
|
'@testing': path.resolve(__dirname, 'src/testing'),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
jest: {
|
||||||
|
configure: {
|
||||||
|
"moduleNameMapper": {
|
||||||
|
'~/(.+)': "<rootDir>/src/$1",
|
||||||
|
'@/(.+)': "<rootDir>/src/modules/$1",
|
||||||
|
'@testing/(.+)': "<rootDir>/src/testing/$1",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
5
front/jest.config.js
Normal file
5
front/jest.config.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const { createJestConfig } = require("@craco/craco");
|
||||||
|
const cracoConfig = require("./craco.config.js");
|
||||||
|
const jestConfig = createJestConfig(cracoConfig);
|
||||||
|
|
||||||
|
module.exports = jestConfig;
|
||||||
3478
front/package-lock.json
generated
3478
front/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -27,10 +27,9 @@
|
|||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "PORT=3001 react-scripts start",
|
"start": "PORT=3001 craco start",
|
||||||
"build": "react-scripts build",
|
"build": "craco build",
|
||||||
"test": "react-scripts test",
|
"test": "craco test",
|
||||||
"eject": "react-scripts eject",
|
|
||||||
"lint": "eslint src --max-warnings=0",
|
"lint": "eslint src --max-warnings=0",
|
||||||
"storybook": "storybook dev -p 6006 -s ../public",
|
"storybook": "storybook dev -p 6006 -s ../public",
|
||||||
"test-storybook": "test-storybook",
|
"test-storybook": "test-storybook",
|
||||||
@ -77,6 +76,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@craco/craco": "^7.1.0",
|
||||||
"@graphql-codegen/cli": "^3.3.1",
|
"@graphql-codegen/cli": "^3.3.1",
|
||||||
"@graphql-codegen/typescript": "^3.0.4",
|
"@graphql-codegen/typescript": "^3.0.4",
|
||||||
"@graphql-codegen/typescript-operations": "^3.0.4",
|
"@graphql-codegen/typescript-operations": "^3.0.4",
|
||||||
@ -114,6 +114,7 @@
|
|||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"eslint-plugin-promise": "^6.1.1",
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
"eslint-plugin-react": "^7.31.11",
|
"eslint-plugin-react": "^7.31.11",
|
||||||
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
||||||
"eslint-plugin-storybook": "^0.6.11",
|
"eslint-plugin-storybook": "^0.6.11",
|
||||||
"http-server": "^14.1.1",
|
"http-server": "^14.1.1",
|
||||||
"mock-apollo-client": "^1.2.1",
|
"mock-apollo-client": "^1.2.1",
|
||||||
@ -123,6 +124,7 @@
|
|||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"storybook": "^7.0.2",
|
"storybook": "^7.0.2",
|
||||||
|
"ts-jest": "^29.1.0",
|
||||||
"typescript": "^4.9.3",
|
"typescript": "^4.9.3",
|
||||||
"webpack": "^5.75.0"
|
"webpack": "^5.75.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,17 +1,18 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import People from './pages/people/People';
|
import { Navigate, Route, Routes } from 'react-router-dom';
|
||||||
import Companies from './pages/companies/Companies';
|
|
||||||
import AuthCallback from './pages/auth/Callback';
|
|
||||||
import Login from './pages/auth/Login';
|
|
||||||
import AppLayout from './layout/AppLayout';
|
|
||||||
import { Routes, Route, Navigate } from 'react-router-dom';
|
|
||||||
import RequireAuth from './components/auth/RequireAuth';
|
|
||||||
import Opportunities from './pages/opportunities/Opportunities';
|
|
||||||
import { User, mapToUser } from './interfaces/entities/user.interface';
|
|
||||||
import { useGetCurrentUserQuery } from './services/api/users';
|
|
||||||
import { getUserIdFromToken } from './services/auth/AuthService';
|
|
||||||
|
|
||||||
function App() {
|
import { RequireAuth } from './modules/auth/components/RequireAuth';
|
||||||
|
import { getUserIdFromToken } from './modules/auth/services/AuthService';
|
||||||
|
import { AppLayout } from './modules/ui/layout/AppLayout';
|
||||||
|
import { mapToUser, User } from './modules/users/interfaces/user.interface';
|
||||||
|
import { useGetCurrentUserQuery } from './modules/users/services';
|
||||||
|
import AuthCallback from './pages/auth/Callback';
|
||||||
|
import { Login } from './pages/auth/Login';
|
||||||
|
import { Companies } from './pages/companies/Companies';
|
||||||
|
import { Opportunities } from './pages/opportunities/Opportunities';
|
||||||
|
import { People } from './pages/people/People';
|
||||||
|
|
||||||
|
export function App() {
|
||||||
const [user, setUser] = useState<User | undefined>(undefined);
|
const [user, setUser] = useState<User | undefined>(undefined);
|
||||||
|
|
||||||
const userIdFromToken = getUserIdFromToken();
|
const userIdFromToken = getUserIdFromToken();
|
||||||
@ -68,5 +69,3 @@ function App() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App;
|
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
import type { Meta, StoryObj } from '@storybook/react';
|
|
||||||
import { RecoilRoot } from 'recoil';
|
|
||||||
import { ThemeProvider } from '@emotion/react';
|
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
import { ApolloProvider } from '@apollo/client';
|
import { ApolloProvider } from '@apollo/client';
|
||||||
|
import { ThemeProvider } from '@emotion/react';
|
||||||
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
|
import { RecoilRoot } from 'recoil';
|
||||||
|
|
||||||
import App from '../App';
|
import { lightTheme } from '@/ui/layout/styles/themes';
|
||||||
import { FullHeightStorybookLayout } from '../testing/FullHeightStorybookLayout';
|
import { App } from '~/App';
|
||||||
import { lightTheme } from '../layout/styles/themes';
|
import { FullHeightStorybookLayout } from '~/testing/FullHeightStorybookLayout';
|
||||||
import { mockedClient } from '../testing/mockedClient';
|
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||||
import { graphqlMocks } from '../testing/graphqlMocks';
|
import { mockedUserJWT } from '~/testing/mock-data/jwt';
|
||||||
import { mockedUserJWT } from '../testing/mock-data/jwt';
|
import { mockedClient } from '~/testing/mockedClient';
|
||||||
|
|
||||||
const meta: Meta<typeof App> = {
|
const meta: Meta<typeof App> = {
|
||||||
title: 'App/App',
|
title: 'App/App',
|
||||||
|
|||||||
@ -1,14 +1,15 @@
|
|||||||
import {
|
import {
|
||||||
ApolloClient,
|
ApolloClient,
|
||||||
InMemoryCache,
|
|
||||||
Observable,
|
|
||||||
createHttpLink,
|
createHttpLink,
|
||||||
from,
|
from,
|
||||||
|
InMemoryCache,
|
||||||
|
Observable,
|
||||||
} from '@apollo/client';
|
} from '@apollo/client';
|
||||||
import { setContext } from '@apollo/client/link/context';
|
import { setContext } from '@apollo/client/link/context';
|
||||||
import { RestLink } from 'apollo-link-rest';
|
|
||||||
import { onError } from '@apollo/client/link/error';
|
import { onError } from '@apollo/client/link/error';
|
||||||
import { refreshAccessToken } from './services/auth/AuthService';
|
import { RestLink } from 'apollo-link-rest';
|
||||||
|
|
||||||
|
import { refreshAccessToken } from './modules/auth/services/AuthService';
|
||||||
|
|
||||||
const apiLink = createHttpLink({
|
const apiLink = createHttpLink({
|
||||||
uri: `${process.env.REACT_APP_API_URL}`,
|
uri: `${process.env.REACT_APP_API_URL}`,
|
||||||
|
|||||||
@ -1,14 +1,17 @@
|
|||||||
import React, { StrictMode } from 'react';
|
import React, { StrictMode } from 'react';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
import './index.css';
|
|
||||||
import App from './App';
|
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
import { ApolloProvider } from '@apollo/client';
|
import { ApolloProvider } from '@apollo/client';
|
||||||
import '@emotion/react';
|
|
||||||
import { ThemeType } from './layout/styles/themes';
|
|
||||||
import { apiClient } from './apollo';
|
|
||||||
import { RecoilRoot } from 'recoil';
|
import { RecoilRoot } from 'recoil';
|
||||||
|
|
||||||
|
import '@emotion/react';
|
||||||
|
|
||||||
|
import { ThemeType } from './modules/ui/layout/styles/themes';
|
||||||
|
import { apiClient } from './apollo';
|
||||||
|
import { App } from './App';
|
||||||
|
|
||||||
|
import './index.css';
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(
|
const root = ReactDOM.createRoot(
|
||||||
document.getElementById('root') as HTMLElement,
|
document.getElementById('root') as HTMLElement,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,8 +1,13 @@
|
|||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { hasAccessToken } from '../../services/auth/AuthService';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
function RequireAuth({ children }: { children: JSX.Element }): JSX.Element {
|
import { hasAccessToken } from '../services/AuthService';
|
||||||
|
|
||||||
|
export function RequireAuth({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: JSX.Element;
|
||||||
|
}): JSX.Element {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -13,5 +18,3 @@ function RequireAuth({ children }: { children: JSX.Element }): JSX.Element {
|
|||||||
|
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default RequireAuth;
|
|
||||||
@ -1,9 +1,10 @@
|
|||||||
import { waitFor } from '@testing-library/react';
|
import { waitFor } from '@testing-library/react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
getUserIdFromToken,
|
||||||
hasAccessToken,
|
hasAccessToken,
|
||||||
hasRefreshToken,
|
hasRefreshToken,
|
||||||
refreshAccessToken,
|
refreshAccessToken,
|
||||||
getUserIdFromToken,
|
|
||||||
} from '../AuthService';
|
} from '../AuthService';
|
||||||
|
|
||||||
const mockFetch = async (
|
const mockFetch = async (
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { CommentChip, CommentChipProps } from './CommentChip';
|
import { CommentChip, CommentChipProps } from './CommentChip';
|
||||||
|
|
||||||
const StyledCellWrapper = styled.div`
|
const StyledCellWrapper = styled.div`
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { IconComment } from '../icons';
|
|
||||||
|
import { IconComment } from '@/ui/icons';
|
||||||
|
|
||||||
export type CommentChipProps = {
|
export type CommentChipProps = {
|
||||||
count: number;
|
count: number;
|
||||||
@ -1,10 +1,11 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { HiArrowSmRight } from 'react-icons/hi';
|
|
||||||
import TextareaAutosize from 'react-textarea-autosize';
|
|
||||||
import { IconButton } from '../buttons/IconButton';
|
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { HotkeysEvent } from 'react-hotkeys-hook/dist/types';
|
import { HotkeysEvent } from 'react-hotkeys-hook/dist/types';
|
||||||
|
import { HiArrowSmRight } from 'react-icons/hi';
|
||||||
|
import TextareaAutosize from 'react-textarea-autosize';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
import { IconButton } from '@/ui/components/buttons/IconButton';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
onSend?: (text: string) => void;
|
onSend?: (text: string) => void;
|
||||||
@ -1,9 +1,12 @@
|
|||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
import { RightDrawerBody } from '../../layout/right-drawer/RightDrawerBody';
|
|
||||||
import { RightDrawerPage } from '../../layout/right-drawer/RightDrawerPage';
|
import { RightDrawerBody } from '@/ui/layout/right-drawer/components/RightDrawerBody';
|
||||||
import { RightDrawerTopBar } from '../../layout/right-drawer/RightDrawerTopBar';
|
import { RightDrawerPage } from '@/ui/layout/right-drawer/components/RightDrawerPage';
|
||||||
|
import { RightDrawerTopBar } from '@/ui/layout/right-drawer/components/RightDrawerTopBar';
|
||||||
|
|
||||||
|
import { commentableEntityArrayState } from '../../states/commentableEntityArrayState';
|
||||||
|
|
||||||
import { CommentTextInput } from './CommentTextInput';
|
import { CommentTextInput } from './CommentTextInput';
|
||||||
import { commentableEntityArrayState } from '../../modules/comments/states/commentableEntityArrayState';
|
|
||||||
|
|
||||||
export function RightDrawerComments() {
|
export function RightDrawerComments() {
|
||||||
const [commentableEntityArray] = useRecoilState(commentableEntityArrayState);
|
const [commentableEntityArray] = useRecoilState(commentableEntityArrayState);
|
||||||
@ -1,8 +1,10 @@
|
|||||||
import type { Meta, StoryObj } from '@storybook/react';
|
|
||||||
import { getRenderWrapperForComponent } from '../../../testing/renderWrappers';
|
|
||||||
import { CellCommentChip } from '../CellCommentChip';
|
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { CellBaseContainer } from '../../editable-cell/CellBaseContainer';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
|
|
||||||
|
import { CellBaseContainer } from '@/ui/components/editable-cell/CellBaseContainer';
|
||||||
|
import { getRenderWrapperForComponent } from '~/testing/renderWrappers';
|
||||||
|
|
||||||
|
import { CellCommentChip } from '../CellCommentChip';
|
||||||
import { CommentChip } from '../CommentChip';
|
import { CommentChip } from '../CommentChip';
|
||||||
|
|
||||||
const meta: Meta<typeof CellCommentChip> = {
|
const meta: Meta<typeof CellCommentChip> = {
|
||||||
@ -1,7 +1,9 @@
|
|||||||
import type { Meta, StoryObj } from '@storybook/react';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
import { graphqlMocks } from '../../../testing/graphqlMocks';
|
|
||||||
|
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||||
|
import { getRenderWrapperForComponent } from '~/testing/renderWrappers';
|
||||||
|
|
||||||
import { CommentTextInput } from '../CommentTextInput';
|
import { CommentTextInput } from '../CommentTextInput';
|
||||||
import { getRenderWrapperForComponent } from '../../../testing/renderWrappers';
|
|
||||||
|
|
||||||
const meta: Meta<typeof CommentTextInput> = {
|
const meta: Meta<typeof CommentTextInput> = {
|
||||||
title: 'Components/CommentTextInput',
|
title: 'Components/CommentTextInput',
|
||||||
@ -1,7 +1,8 @@
|
|||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
import { useOpenRightDrawer } from '../../ui/layout/right-drawer/hooks/useOpenRightDrawer';
|
import { useOpenRightDrawer } from '../../ui/layout/right-drawer/hooks/useOpenRightDrawer';
|
||||||
import { CommentableEntity } from '../types/CommentableEntity';
|
|
||||||
import { commentableEntityArrayState } from '../states/commentableEntityArrayState';
|
import { commentableEntityArrayState } from '../states/commentableEntityArrayState';
|
||||||
|
import { CommentableEntity } from '../types/CommentableEntity';
|
||||||
|
|
||||||
export function useOpenCommentRightDrawer() {
|
export function useOpenCommentRightDrawer() {
|
||||||
const openRightDrawer = useOpenRightDrawer();
|
const openRightDrawer = useOpenRightDrawer();
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { atom } from 'recoil';
|
import { atom } from 'recoil';
|
||||||
|
|
||||||
import { CommentableEntity } from '../types/CommentableEntity';
|
import { CommentableEntity } from '../types/CommentableEntity';
|
||||||
|
|
||||||
export const commentableEntityArrayState = atom<CommentableEntity[]>({
|
export const commentableEntityArrayState = atom<CommentableEntity[]>({
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { CommentableType } from '../../../generated/graphql';
|
import { CommentableType } from '~/generated/graphql';
|
||||||
|
|
||||||
export type CommentableEntity = {
|
export type CommentableEntity = {
|
||||||
type: keyof typeof CommentableType;
|
type: keyof typeof CommentableType;
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { Company } from '../../interfaces/entities/company.interface';
|
import { useOpenCommentRightDrawer } from '@/comments/hooks/useOpenCommentRightDrawer';
|
||||||
import { useOpenCommentRightDrawer } from '../../modules/comments/hooks/useOpenCommentRightDrawer';
|
import EditableChip from '@/ui/components/editable-cell/EditableChip';
|
||||||
import { updateCompany } from '../../services/api/companies';
|
import { getLogoUrlFromDomainName } from '@/utils/utils';
|
||||||
import { getLogoUrlFromDomainName } from '../../services/utils';
|
|
||||||
import CompanyChip from '../chips/CompanyChip';
|
import { Company } from '../interfaces/company.interface';
|
||||||
import EditableChip from '../editable-cell/EditableChip';
|
import { updateCompany } from '../services';
|
||||||
|
|
||||||
|
import CompanyChip from './CompanyChip';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
company: Company;
|
company: Company;
|
||||||
@ -1,9 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
mapToGqlCompany,
|
|
||||||
mapToCompany,
|
|
||||||
Company,
|
Company,
|
||||||
GraphqlMutationCompany,
|
GraphqlMutationCompany,
|
||||||
GraphqlQueryCompany,
|
GraphqlQueryCompany,
|
||||||
|
mapToCompany,
|
||||||
|
mapToGqlCompany,
|
||||||
} from '../company.interface';
|
} from '../company.interface';
|
||||||
|
|
||||||
describe('Company mappers', () => {
|
describe('Company mappers', () => {
|
||||||
@ -1,6 +1,12 @@
|
|||||||
import { Pipe } from 'stream';
|
import {
|
||||||
import { GraphqlQueryUser, User, mapToUser } from './user.interface';
|
GraphqlQueryPipeline,
|
||||||
import { GraphqlQueryPipe } from './pipe.interface';
|
Pipeline,
|
||||||
|
} from '../../pipelines/interfaces/pipeline.interface';
|
||||||
|
import {
|
||||||
|
GraphqlQueryUser,
|
||||||
|
mapToUser,
|
||||||
|
User,
|
||||||
|
} from '../../users/interfaces/user.interface';
|
||||||
|
|
||||||
export type Company = {
|
export type Company = {
|
||||||
__typename: 'companies';
|
__typename: 'companies';
|
||||||
@ -12,7 +18,7 @@ export type Company = {
|
|||||||
|
|
||||||
createdAt?: Date;
|
createdAt?: Date;
|
||||||
|
|
||||||
pipes?: Pipe[];
|
pipes?: Pipeline[];
|
||||||
accountOwner?: User | null;
|
accountOwner?: User | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -26,7 +32,7 @@ export type GraphqlQueryCompany = {
|
|||||||
createdAt?: string;
|
createdAt?: string;
|
||||||
|
|
||||||
accountOwner?: GraphqlQueryUser | null;
|
accountOwner?: GraphqlQueryUser | null;
|
||||||
pipes?: GraphqlQueryPipe[] | null;
|
pipes?: GraphqlQueryPipeline[] | null;
|
||||||
__typename: string;
|
__typename: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import { reduceSortsToOrderBy } from '../../../../components/table/table-header/helpers';
|
import { reduceSortsToOrderBy } from '@/filters-and-sorts/helpers';
|
||||||
|
|
||||||
import { CompaniesSelectedSortType } from '../select';
|
import { CompaniesSelectedSortType } from '../select';
|
||||||
|
|
||||||
describe('reduceSortsToOrderBy', () => {
|
describe('reduceSortsToOrderBy', () => {
|
||||||
@ -1,11 +1,13 @@
|
|||||||
import { QueryResult, gql, useQuery } from '@apollo/client';
|
import { gql, QueryResult, useQuery } from '@apollo/client';
|
||||||
|
|
||||||
|
import { SelectedSortType } from '@/filters-and-sorts/interfaces/sorts/interface';
|
||||||
import {
|
import {
|
||||||
SortOrder as Order_By,
|
|
||||||
CompanyOrderByWithRelationInput as Companies_Order_By,
|
CompanyOrderByWithRelationInput as Companies_Order_By,
|
||||||
CompanyWhereInput as Companies_Bool_Exp,
|
CompanyWhereInput as Companies_Bool_Exp,
|
||||||
} from '../../../generated/graphql';
|
SortOrder as Order_By,
|
||||||
import { GraphqlQueryCompany } from '../../../interfaces/entities/company.interface';
|
} from '~/generated/graphql';
|
||||||
import { SelectedSortType } from '../../../interfaces/sorts/interface';
|
|
||||||
|
import { GraphqlQueryCompany } from '../interfaces/company.interface';
|
||||||
|
|
||||||
export type CompaniesSelectedSortType = SelectedSortType<Companies_Order_By>;
|
export type CompaniesSelectedSortType = SelectedSortType<Companies_Order_By>;
|
||||||
|
|
||||||
@ -1,9 +1,8 @@
|
|||||||
import { FetchResult, gql } from '@apollo/client';
|
import { FetchResult, gql } from '@apollo/client';
|
||||||
import {
|
|
||||||
Company,
|
import { apiClient } from '~/apollo';
|
||||||
mapToGqlCompany,
|
|
||||||
} from '../../../interfaces/entities/company.interface';
|
import { Company, mapToGqlCompany } from '../interfaces/company.interface';
|
||||||
import { apiClient } from '../../../apollo';
|
|
||||||
|
|
||||||
export const UPDATE_COMPANY = gql`
|
export const UPDATE_COMPANY = gql`
|
||||||
mutation UpdateCompany(
|
mutation UpdateCompany(
|
||||||
@ -1,11 +1,13 @@
|
|||||||
import { SortOrder as Order_By } from '../../../generated/graphql';
|
import { SortOrder as Order_By } from '~/generated/graphql';
|
||||||
import { BoolExpType } from '../../../interfaces/entities/generic.interface';
|
|
||||||
|
import { BoolExpType } from '../utils/interfaces/generic.interface';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
FilterableFieldsType,
|
FilterableFieldsType,
|
||||||
FilterWhereType,
|
FilterWhereType,
|
||||||
SelectedFilterType,
|
SelectedFilterType,
|
||||||
} from '../../../interfaces/filters/interface';
|
} from './interfaces/filters/interface';
|
||||||
import { SelectedSortType } from '../../../interfaces/sorts/interface';
|
import { SelectedSortType } from './interfaces/sorts/interface';
|
||||||
|
|
||||||
export const reduceFiltersToWhere = <
|
export const reduceFiltersToWhere = <
|
||||||
ValueType extends FilterableFieldsType,
|
ValueType extends FilterableFieldsType,
|
||||||
@ -1,10 +1,11 @@
|
|||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
import { SearchConfigType } from '../search/interface';
|
|
||||||
|
import { SearchConfigType } from '@/search/interfaces/interface';
|
||||||
import {
|
import {
|
||||||
AnyEntity,
|
AnyEntity,
|
||||||
BoolExpType,
|
BoolExpType,
|
||||||
UnknownType,
|
UnknownType,
|
||||||
} from '../entities/generic.interface';
|
} from '@/utils/interfaces/generic.interface';
|
||||||
|
|
||||||
export type FilterableFieldsType = AnyEntity;
|
export type FilterableFieldsType = AnyEntity;
|
||||||
export type FilterWhereRelationType = AnyEntity;
|
export type FilterWhereRelationType = AnyEntity;
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
import { SortOrder as Order_By } from '../../generated/graphql';
|
|
||||||
|
import { SortOrder as Order_By } from '~/generated/graphql';
|
||||||
|
|
||||||
export type SortType<OrderByTemplate> =
|
export type SortType<OrderByTemplate> =
|
||||||
| {
|
| {
|
||||||
@ -1,9 +1,11 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import PersonChip from '../chips/PersonChip';
|
|
||||||
import { EditableDoubleText } from '../editable-cell/EditableDoubleText';
|
|
||||||
import { CellCommentChip } from '../comments/CellCommentChip';
|
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
import { CellCommentChip } from '@/comments/components/comments/CellCommentChip';
|
||||||
|
import { EditableDoubleText } from '@/ui/components/editable-cell/EditableDoubleText';
|
||||||
|
|
||||||
|
import { PersonChip } from './PersonChip';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
firstname: string;
|
firstname: string;
|
||||||
lastname: string;
|
lastname: string;
|
||||||
@ -1,25 +1,26 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
|
import CompanyChip, {
|
||||||
|
CompanyChipPropsType,
|
||||||
|
} from '@/companies/components/CompanyChip';
|
||||||
|
import {
|
||||||
|
Company,
|
||||||
|
mapToCompany,
|
||||||
|
} from '@/companies/interfaces/company.interface';
|
||||||
|
import { SearchConfigType } from '@/search/interfaces/interface';
|
||||||
|
import { SEARCH_COMPANY_QUERY } from '@/search/services/search';
|
||||||
|
import { EditableRelation } from '@/ui/components/editable-cell/EditableRelation';
|
||||||
|
import { getLogoUrlFromDomainName } from '@/utils/utils';
|
||||||
import {
|
import {
|
||||||
QueryMode,
|
QueryMode,
|
||||||
useInsertCompanyMutation,
|
useInsertCompanyMutation,
|
||||||
useUpdatePeopleMutation,
|
useUpdatePeopleMutation,
|
||||||
} from '../../generated/graphql';
|
} from '~/generated/graphql';
|
||||||
import {
|
|
||||||
Person,
|
import { mapToGqlPerson, Person } from '../interfaces/person.interface';
|
||||||
mapToGqlPerson,
|
|
||||||
} from '../../interfaces/entities/person.interface';
|
|
||||||
|
|
||||||
import {
|
|
||||||
Company,
|
|
||||||
mapToCompany,
|
|
||||||
} from '../../interfaces/entities/company.interface';
|
|
||||||
import CompanyChip, { CompanyChipPropsType } from '../chips/CompanyChip';
|
|
||||||
import EditableRelation from '../editable-cell/EditableRelation';
|
|
||||||
import { SEARCH_COMPANY_QUERY } from '../../services/api/search/search';
|
|
||||||
import { SearchConfigType } from '../../interfaces/search/interface';
|
|
||||||
import { useState } from 'react';
|
|
||||||
import { PeopleCompanyCreateCell } from './PeopleCompanyCreateCell';
|
import { PeopleCompanyCreateCell } from './PeopleCompanyCreateCell';
|
||||||
import { v4 } from 'uuid';
|
|
||||||
import { getLogoUrlFromDomainName } from '../../services/utils';
|
|
||||||
|
|
||||||
export type OwnProps = {
|
export type OwnProps = {
|
||||||
people: Person;
|
people: Person;
|
||||||
@ -1,9 +1,10 @@
|
|||||||
import { useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
import { DoubleTextInput } from '../inputs/DoubleTextInput';
|
|
||||||
import { useListenClickOutsideArrayOfRef } from '../../modules/ui/common/hooks/useListenClickOutsideArrayOfRef';
|
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { CellBaseContainer } from '../editable-cell/CellBaseContainer';
|
|
||||||
import { CellEditModeContainer } from '../editable-cell/CellEditModeContainer';
|
import { CellBaseContainer } from '@/ui/components/editable-cell/CellBaseContainer';
|
||||||
|
import { CellEditModeContainer } from '@/ui/components/editable-cell/CellEditModeContainer';
|
||||||
|
import { DoubleTextInput } from '@/ui/components/inputs/DoubleTextInput';
|
||||||
|
import { useListenClickOutsideArrayOfRef } from '@/ui/hooks/useListenClickOutsideArrayOfRef';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
initialCompanyName: string;
|
initialCompanyName: string;
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import PersonPlaceholder from './person-placeholder.png';
|
import PersonPlaceholder from './person-placeholder.png';
|
||||||
|
|
||||||
export type PersonChipPropsType = {
|
export type PersonChipPropsType = {
|
||||||
@ -31,7 +32,7 @@ const StyledContainer = styled.span`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function PersonChip({ name, picture }: PersonChipPropsType) {
|
export function PersonChip({ name, picture }: PersonChipPropsType) {
|
||||||
return (
|
return (
|
||||||
<StyledContainer data-testid="person-chip">
|
<StyledContainer data-testid="person-chip">
|
||||||
<img
|
<img
|
||||||
@ -43,5 +44,3 @@ function PersonChip({ name, picture }: PersonChipPropsType) {
|
|||||||
</StyledContainer>
|
</StyledContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PersonChip;
|
|
||||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -1,9 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
|
GraphqlMutationPerson,
|
||||||
|
GraphqlQueryPerson,
|
||||||
mapToGqlPerson,
|
mapToGqlPerson,
|
||||||
mapToPerson,
|
mapToPerson,
|
||||||
Person,
|
Person,
|
||||||
GraphqlMutationPerson,
|
|
||||||
GraphqlQueryPerson,
|
|
||||||
} from '../person.interface';
|
} from '../person.interface';
|
||||||
|
|
||||||
describe('Person mappers', () => {
|
describe('Person mappers', () => {
|
||||||
@ -2,8 +2,8 @@ import {
|
|||||||
Company,
|
Company,
|
||||||
GraphqlQueryCompany,
|
GraphqlQueryCompany,
|
||||||
mapToCompany,
|
mapToCompany,
|
||||||
} from './company.interface';
|
} from '@/companies/interfaces/company.interface';
|
||||||
import { Pipe } from './pipe.interface';
|
import { Pipeline } from '@/pipelines/interfaces/pipeline.interface';
|
||||||
|
|
||||||
export type Person = {
|
export type Person = {
|
||||||
__typename: 'people';
|
__typename: 'people';
|
||||||
@ -18,7 +18,7 @@ export type Person = {
|
|||||||
createdAt?: Date;
|
createdAt?: Date;
|
||||||
|
|
||||||
company?: Company | null;
|
company?: Company | null;
|
||||||
pipes?: Pipe[] | null;
|
pipes?: Pipeline[] | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GraphqlQueryPerson = {
|
export type GraphqlQueryPerson = {
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import { reduceSortsToOrderBy } from '../../../../components/table/table-header/helpers';
|
import { reduceSortsToOrderBy } from '@/filters-and-sorts/helpers';
|
||||||
|
|
||||||
import { PeopleSelectedSortType } from '../select';
|
import { PeopleSelectedSortType } from '../select';
|
||||||
|
|
||||||
describe('reduceSortsToOrderBy', () => {
|
describe('reduceSortsToOrderBy', () => {
|
||||||
@ -1,12 +1,12 @@
|
|||||||
import {
|
import {
|
||||||
GraphqlMutationPerson,
|
GraphqlMutationPerson,
|
||||||
GraphqlQueryPerson,
|
GraphqlQueryPerson,
|
||||||
} from '../../../../interfaces/entities/person.interface';
|
} from '../../interfaces/person.interface';
|
||||||
import { updatePerson } from '../update';
|
import { updatePerson } from '../update';
|
||||||
|
|
||||||
jest.mock('../../../../apollo', () => {
|
jest.mock('~/apollo', () => {
|
||||||
const personInterface = jest.requireActual(
|
const personInterface = jest.requireActual(
|
||||||
'../../../../interfaces/entities/person.interface',
|
'@/people/interfaces/person.interface',
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
apiClient: {
|
apiClient: {
|
||||||
@ -1,11 +1,13 @@
|
|||||||
import { QueryResult, gql, useQuery } from '@apollo/client';
|
import { gql, QueryResult, useQuery } from '@apollo/client';
|
||||||
import { GraphqlQueryPerson } from '../../../interfaces/entities/person.interface';
|
|
||||||
|
import { SelectedSortType } from '@/filters-and-sorts/interfaces/sorts/interface';
|
||||||
import {
|
import {
|
||||||
PersonWhereInput as People_Bool_Exp,
|
|
||||||
PersonOrderByWithRelationInput as People_Order_By,
|
PersonOrderByWithRelationInput as People_Order_By,
|
||||||
|
PersonWhereInput as People_Bool_Exp,
|
||||||
SortOrder,
|
SortOrder,
|
||||||
} from '../../../generated/graphql';
|
} from '~/generated/graphql';
|
||||||
import { SelectedSortType } from '../../../interfaces/sorts/interface';
|
|
||||||
|
import { GraphqlQueryPerson } from '../interfaces/person.interface';
|
||||||
|
|
||||||
export type PeopleSelectedSortType = SelectedSortType<People_Order_By>;
|
export type PeopleSelectedSortType = SelectedSortType<People_Order_By>;
|
||||||
|
|
||||||
@ -1,9 +1,7 @@
|
|||||||
import { FetchResult, gql } from '@apollo/client';
|
import { FetchResult, gql } from '@apollo/client';
|
||||||
import {
|
|
||||||
Person,
|
|
||||||
mapToGqlPerson,
|
|
||||||
} from '../../../interfaces/entities/person.interface';
|
|
||||||
import { apiClient } from '../../../apollo';
|
import { apiClient } from '../../../apollo';
|
||||||
|
import { mapToGqlPerson, Person } from '../interfaces/person.interface';
|
||||||
|
|
||||||
export const UPDATE_PERSON = gql`
|
export const UPDATE_PERSON = gql`
|
||||||
mutation UpdatePeople(
|
mutation UpdatePeople(
|
||||||
@ -1,9 +1,10 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { Pipe } from '../../interfaces/entities/pipe.interface';
|
|
||||||
|
import { Pipeline } from '../interfaces/pipeline.interface';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
opportunity: Pipe;
|
opportunity: Pipeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
const StyledContainer = styled.span`
|
const StyledContainer = styled.span`
|
||||||
@ -20,7 +21,7 @@ const StyledContainer = styled.span`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function PipeChip({ opportunity }: OwnProps) {
|
function PipelineChip({ opportunity }: OwnProps) {
|
||||||
return (
|
return (
|
||||||
<StyledContainer data-testid="company-chip" key={opportunity.id}>
|
<StyledContainer data-testid="company-chip" key={opportunity.id}>
|
||||||
{opportunity.icon && <span>{opportunity.icon}</span>}
|
{opportunity.icon && <span>{opportunity.icon}</span>}
|
||||||
@ -29,4 +30,4 @@ function PipeChip({ opportunity }: OwnProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PipeChip;
|
export default PipelineChip;
|
||||||
@ -1,10 +1,10 @@
|
|||||||
export interface Pipe {
|
export interface Pipeline {
|
||||||
id: string;
|
id: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
icon?: string | null;
|
icon?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GraphqlQueryPipe {
|
export interface GraphqlQueryPipeline {
|
||||||
id: string;
|
id: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
icon?: string | null;
|
icon?: string | null;
|
||||||
@ -1,11 +1,12 @@
|
|||||||
import { DocumentNode } from 'graphql';
|
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
|
import { DocumentNode } from 'graphql';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AnyEntity,
|
AnyEntity,
|
||||||
BoolExpType,
|
BoolExpType,
|
||||||
GqlType,
|
GqlType,
|
||||||
UnknownType,
|
UnknownType,
|
||||||
} from '../entities/generic.interface';
|
} from '@/utils/interfaces/generic.interface';
|
||||||
|
|
||||||
export type SearchConfigType<
|
export type SearchConfigType<
|
||||||
SearchType extends AnyEntity | UnknownType = UnknownType,
|
SearchType extends AnyEntity | UnknownType = UnknownType,
|
||||||
@ -1,11 +1,10 @@
|
|||||||
import { gql, useQuery } from '@apollo/client';
|
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { SearchConfigType } from '../../../interfaces/search/interface';
|
import { gql, useQuery } from '@apollo/client';
|
||||||
import {
|
|
||||||
AnyEntity,
|
import { debounce } from '@/utils/debounce';
|
||||||
UnknownType,
|
import { AnyEntity, UnknownType } from '@/utils/interfaces/generic.interface';
|
||||||
} from '../../../interfaces/entities/generic.interface';
|
|
||||||
import { debounce } from '../../../modules/utils/debounce';
|
import { SearchConfigType } from '../interfaces/interface';
|
||||||
|
|
||||||
export const SEARCH_PEOPLE_QUERY = gql`
|
export const SEARCH_PEOPLE_QUERY = gql`
|
||||||
query SearchPeopleQuery($where: PersonWhereInput, $limit: Int) {
|
query SearchPeopleQuery($where: PersonWhereInput, $limit: Int) {
|
||||||
@ -1,8 +1,10 @@
|
|||||||
import { ReactElement } from 'react';
|
import { ReactElement } from 'react';
|
||||||
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { isSomeInputInEditModeState } from '../../tables/states/isSomeInputInEditModeState';
|
||||||
|
|
||||||
import { CellBaseContainer } from './CellBaseContainer';
|
import { CellBaseContainer } from './CellBaseContainer';
|
||||||
import { CellNormalModeContainer } from './CellNormalModeContainer';
|
import { CellNormalModeContainer } from './CellNormalModeContainer';
|
||||||
import { useRecoilState } from 'recoil';
|
|
||||||
import { isSomeInputInEditModeState } from '../../modules/ui/tables/states/isSomeInputInEditModeState';
|
|
||||||
import { EditableCellEditMode } from './EditableCellEditMode';
|
import { EditableCellEditMode } from './EditableCellEditMode';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
@ -1,10 +1,13 @@
|
|||||||
import { ReactElement, useMemo, useRef } from 'react';
|
import { ReactElement, useMemo, useRef } from 'react';
|
||||||
import { CellEditModeContainer } from './CellEditModeContainer';
|
|
||||||
import { useRecoilState } from 'recoil';
|
|
||||||
import { isSomeInputInEditModeState } from '../../modules/ui/tables/states/isSomeInputInEditModeState';
|
|
||||||
import { useListenClickOutsideArrayOfRef } from '../../modules/ui/common/hooks/useListenClickOutsideArrayOfRef';
|
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { debounce } from '../../modules/utils/debounce';
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { debounce } from '@/utils/debounce';
|
||||||
|
|
||||||
|
import { useListenClickOutsideArrayOfRef } from '../../hooks/useListenClickOutsideArrayOfRef';
|
||||||
|
import { isSomeInputInEditModeState } from '../../tables/states/isSomeInputInEditModeState';
|
||||||
|
|
||||||
|
import { CellEditModeContainer } from './CellEditModeContainer';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
editModeContent: ReactElement;
|
editModeContent: ReactElement;
|
||||||
@ -1,8 +1,10 @@
|
|||||||
import { ReactElement } from 'react';
|
import { ReactElement } from 'react';
|
||||||
import { CellBaseContainer } from './CellBaseContainer';
|
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
import { isSomeInputInEditModeState } from '../../modules/ui/tables/states/isSomeInputInEditModeState';
|
|
||||||
|
import { isSomeInputInEditModeState } from '../../tables/states/isSomeInputInEditModeState';
|
||||||
|
|
||||||
|
import { CellBaseContainer } from './CellBaseContainer';
|
||||||
import { EditableCellMenuEditMode } from './EditableCellMenuEditMode';
|
import { EditableCellMenuEditMode } from './EditableCellMenuEditMode';
|
||||||
|
|
||||||
const EditableCellMenuNormalModeContainer = styled.div`
|
const EditableCellMenuNormalModeContainer = styled.div`
|
||||||
@ -1,9 +1,12 @@
|
|||||||
import { ReactElement, useMemo, useRef } from 'react';
|
import { ReactElement, useMemo, useRef } from 'react';
|
||||||
import { useRecoilState } from 'recoil';
|
|
||||||
import { isSomeInputInEditModeState } from '../../modules/ui/tables/states/isSomeInputInEditModeState';
|
|
||||||
import { useListenClickOutsideArrayOfRef } from '../../modules/ui/common/hooks/useListenClickOutsideArrayOfRef';
|
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { debounce } from '../../modules/utils/debounce';
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { debounce } from '@/utils/debounce';
|
||||||
|
|
||||||
|
import { useListenClickOutsideArrayOfRef } from '../../hooks/useListenClickOutsideArrayOfRef';
|
||||||
|
import { isSomeInputInEditModeState } from '../../tables/states/isSomeInputInEditModeState';
|
||||||
|
|
||||||
import { EditableCellMenuEditModeContainer } from './EditableCellMenuEditModeContainer';
|
import { EditableCellMenuEditModeContainer } from './EditableCellMenuEditModeContainer';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { overlayBackground } from '../../layout/styles/themes';
|
import { overlayBackground } from '../../layout/styles/themes';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
@ -1,8 +1,11 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { ChangeEvent, ComponentType, useRef, useState } from 'react';
|
import { ChangeEvent, ComponentType, useRef, useState } from 'react';
|
||||||
import { EditableCell } from './EditableCell';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
import { CellCommentChip } from '@/comments/components/comments/CellCommentChip';
|
||||||
|
|
||||||
import { textInputStyle } from '../../layout/styles/themes';
|
import { textInputStyle } from '../../layout/styles/themes';
|
||||||
import { CellCommentChip } from '../comments/CellCommentChip';
|
|
||||||
|
import { EditableCell } from './EditableCell';
|
||||||
|
|
||||||
export type EditableChipProps = {
|
export type EditableChipProps = {
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
@ -1,8 +1,11 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { forwardRef, useState } from 'react';
|
import { forwardRef, useState } from 'react';
|
||||||
import { EditableCell } from './EditableCell';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
import { humanReadableDate } from '@/utils/utils';
|
||||||
|
|
||||||
import DatePicker from '../form/DatePicker';
|
import DatePicker from '../form/DatePicker';
|
||||||
import { humanReadableDate } from '../../services/utils';
|
|
||||||
|
import { EditableCell } from './EditableCell';
|
||||||
|
|
||||||
export type EditableDateProps = {
|
export type EditableDateProps = {
|
||||||
value: Date;
|
value: Date;
|
||||||
@ -29,7 +32,7 @@ const StyledCalendarContainer = styled.div<StyledCalendarContainerProps>`
|
|||||||
top: 10px;
|
top: 10px;
|
||||||
background: ${(props) => props.theme.secondaryBackground};
|
background: ${(props) => props.theme.secondaryBackground};
|
||||||
`;
|
`;
|
||||||
function EditableDate({
|
export function EditableDate({
|
||||||
value,
|
value,
|
||||||
changeHandler,
|
changeHandler,
|
||||||
editModeHorizontalAlign,
|
editModeHorizontalAlign,
|
||||||
@ -82,5 +85,3 @@ function EditableDate({
|
|||||||
></EditableCell>
|
></EditableCell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default EditableDate;
|
|
||||||
@ -1,8 +1,10 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { ChangeEvent, ReactElement, useRef, useState } from 'react';
|
import { ChangeEvent, ReactElement, useRef, useState } from 'react';
|
||||||
import { EditableCell } from './EditableCell';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { textInputStyle } from '../../layout/styles/themes';
|
import { textInputStyle } from '../../layout/styles/themes';
|
||||||
|
|
||||||
|
import { EditableCell } from './EditableCell';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
firstValue: string;
|
firstValue: string;
|
||||||
secondValue: string;
|
secondValue: string;
|
||||||
@ -1,9 +1,11 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { ChangeEvent, MouseEvent, useRef, useState } from 'react';
|
import { ChangeEvent, MouseEvent, useRef, useState } from 'react';
|
||||||
import { EditableCell } from './EditableCell';
|
import styled from '@emotion/styled';
|
||||||
import { isValidPhoneNumber, parsePhoneNumber } from 'libphonenumber-js';
|
import { isValidPhoneNumber, parsePhoneNumber } from 'libphonenumber-js';
|
||||||
|
|
||||||
import Link from '../link/Link';
|
import Link from '../link/Link';
|
||||||
|
|
||||||
|
import { EditableCell } from './EditableCell';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
value: string;
|
value: string;
|
||||||
@ -26,7 +28,7 @@ const StyledEditInplaceInput = styled.input<StyledEditModeProps>`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function EditablePhone({ value, placeholder, changeHandler }: OwnProps) {
|
export function EditablePhone({ value, placeholder, changeHandler }: OwnProps) {
|
||||||
const inputRef = useRef<HTMLInputElement>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
const [inputValue, setInputValue] = useState(value);
|
const [inputValue, setInputValue] = useState(value);
|
||||||
const [isEditMode, setIsEditMode] = useState(false);
|
const [isEditMode, setIsEditMode] = useState(false);
|
||||||
@ -69,5 +71,3 @@ function EditablePhone({ value, placeholder, changeHandler }: OwnProps) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default EditablePhone;
|
|
||||||
@ -1,18 +1,21 @@
|
|||||||
import { ChangeEvent, ComponentType, useEffect, useState } from 'react';
|
import { ChangeEvent, ComponentType, useEffect, useState } from 'react';
|
||||||
import styled from '@emotion/styled';
|
|
||||||
import { useSearch } from '../../services/api/search/search';
|
|
||||||
import { SearchConfigType } from '../../interfaces/search/interface';
|
|
||||||
import { AnyEntity } from '../../interfaces/entities/generic.interface';
|
|
||||||
import { EditableRelationCreateButton } from './EditableRelationCreateButton';
|
|
||||||
import { isNonEmptyString } from '../../modules/utils/type-guards/isNonEmptyString';
|
|
||||||
import { isDefined } from '../../modules/utils/type-guards/isDefined';
|
|
||||||
import { FaPlus } from 'react-icons/fa';
|
import { FaPlus } from 'react-icons/fa';
|
||||||
import { HoverableMenuItem } from './HoverableMenuItem';
|
import styled from '@emotion/styled';
|
||||||
import { EditableCellMenu } from './EditableCellMenu';
|
|
||||||
import { CellNormalModeContainer } from './CellNormalModeContainer';
|
|
||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
import { isSomeInputInEditModeState } from '../../modules/ui/tables/states/isSomeInputInEditModeState';
|
|
||||||
|
import { SearchConfigType } from '@/search/interfaces/interface';
|
||||||
|
import { useSearch } from '@/search/services/search';
|
||||||
|
import { AnyEntity } from '@/utils/interfaces/generic.interface';
|
||||||
|
import { isDefined } from '@/utils/type-guards/isDefined';
|
||||||
|
import { isNonEmptyString } from '@/utils/type-guards/isNonEmptyString';
|
||||||
|
|
||||||
import { textInputStyle } from '../../layout/styles/themes';
|
import { textInputStyle } from '../../layout/styles/themes';
|
||||||
|
import { isSomeInputInEditModeState } from '../../tables/states/isSomeInputInEditModeState';
|
||||||
|
|
||||||
|
import { CellNormalModeContainer } from './CellNormalModeContainer';
|
||||||
|
import { EditableCellMenu } from './EditableCellMenu';
|
||||||
|
import { EditableRelationCreateButton } from './EditableRelationCreateButton';
|
||||||
|
import { HoverableMenuItem } from './HoverableMenuItem';
|
||||||
|
|
||||||
const StyledEditModeContainer = styled.div`
|
const StyledEditModeContainer = styled.div`
|
||||||
width: 200px;
|
width: 200px;
|
||||||
@ -95,7 +98,7 @@ export type EditableRelationProps<
|
|||||||
};
|
};
|
||||||
|
|
||||||
// TODO: split this component
|
// TODO: split this component
|
||||||
function EditableRelation<
|
export function EditableRelation<
|
||||||
RelationType extends AnyEntity,
|
RelationType extends AnyEntity,
|
||||||
ChipComponentPropsType,
|
ChipComponentPropsType,
|
||||||
>({
|
>({
|
||||||
@ -216,5 +219,3 @@ function EditableRelation<
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default EditableRelation;
|
|
||||||
@ -1,8 +1,10 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { ChangeEvent, useRef, useState } from 'react';
|
import { ChangeEvent, useRef, useState } from 'react';
|
||||||
import { EditableCell } from './EditableCell';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { textInputStyle } from '../../layout/styles/themes';
|
import { textInputStyle } from '../../layout/styles/themes';
|
||||||
|
|
||||||
|
import { EditableCell } from './EditableCell';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
content: string;
|
content: string;
|
||||||
@ -24,7 +26,7 @@ const StyledNoEditText = styled.div`
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function EditableText({
|
export function EditableText({
|
||||||
content,
|
content,
|
||||||
placeholder,
|
placeholder,
|
||||||
changeHandler,
|
changeHandler,
|
||||||
@ -57,5 +59,3 @@ function EditableText({
|
|||||||
></EditableCell>
|
></EditableCell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default EditableText;
|
|
||||||
@ -1,9 +1,10 @@
|
|||||||
import styled from '@emotion/styled';
|
import React, { forwardRef, ReactElement, useState } from 'react';
|
||||||
import React, { ReactElement, forwardRef, useState } from 'react';
|
|
||||||
import ReactDatePicker, { CalendarContainerProps } from 'react-datepicker';
|
import ReactDatePicker, { CalendarContainerProps } from 'react-datepicker';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
import { overlayBackground } from '../../layout/styles/themes';
|
||||||
|
|
||||||
import 'react-datepicker/dist/react-datepicker.css';
|
import 'react-datepicker/dist/react-datepicker.css';
|
||||||
import { overlayBackground } from '../../layout/styles/themes';
|
|
||||||
|
|
||||||
export type DatePickerProps = {
|
export type DatePickerProps = {
|
||||||
isOpen?: boolean;
|
isOpen?: boolean;
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { ChangeEvent, useRef } from 'react';
|
import { ChangeEvent, useRef } from 'react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { textInputStyle } from '../../layout/styles/themes';
|
import { textInputStyle } from '../../layout/styles/themes';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Link as ReactLink } from 'react-router-dom';
|
import { Link as ReactLink } from 'react-router-dom';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
href: string;
|
href: string;
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { Checkbox } from '../form/Checkbox';
|
import { Checkbox } from '../form/Checkbox';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
viewName: string;
|
viewName: string;
|
||||||
@ -20,7 +20,7 @@ const StyledIcon = styled.div`
|
|||||||
margin-right: ${(props) => props.theme.spacing(1)};
|
margin-right: ${(props) => props.theme.spacing(1)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function TableHeader({ viewName, viewIcon }: OwnProps) {
|
export function ColumnHead({ viewName, viewIcon }: OwnProps) {
|
||||||
return (
|
return (
|
||||||
<StyledTitle>
|
<StyledTitle>
|
||||||
<StyledIcon>{viewIcon}</StyledIcon>
|
<StyledIcon>{viewIcon}</StyledIcon>
|
||||||
@ -28,5 +28,3 @@ function TableHeader({ viewName, viewIcon }: OwnProps) {
|
|||||||
</StyledTitle>
|
</StyledTitle>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default TableHeader;
|
|
||||||
@ -1,21 +1,26 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ColumnDef,
|
ColumnDef,
|
||||||
flexRender,
|
flexRender,
|
||||||
getCoreRowModel,
|
getCoreRowModel,
|
||||||
useReactTable,
|
useReactTable,
|
||||||
} from '@tanstack/react-table';
|
} from '@tanstack/react-table';
|
||||||
import TableHeader from './table-header/TableHeader';
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
FilterConfigType,
|
FilterConfigType,
|
||||||
SelectedFilterType,
|
SelectedFilterType,
|
||||||
} from '../../interfaces/filters/interface';
|
} from '@/filters-and-sorts/interfaces/filters/interface';
|
||||||
import { SortType, SelectedSortType } from '../../interfaces/sorts/interface';
|
import {
|
||||||
import { useRecoilState } from 'recoil';
|
SelectedSortType,
|
||||||
import { currentRowSelectionState } from '../../modules/ui/tables/states/rowSelectionState';
|
SortType,
|
||||||
import { useResetTableRowSelection } from '../../modules/ui/tables/hooks/useResetTableRowSelection';
|
} from '@/filters-and-sorts/interfaces/sorts/interface';
|
||||||
|
|
||||||
|
import { useResetTableRowSelection } from '../../tables/hooks/useResetTableRowSelection';
|
||||||
|
import { currentRowSelectionState } from '../../tables/states/rowSelectionState';
|
||||||
|
|
||||||
|
import { TableHeader } from './table-header/TableHeader';
|
||||||
|
|
||||||
type OwnProps<
|
type OwnProps<
|
||||||
TData extends { id: string; __typename: 'companies' | 'people' },
|
TData extends { id: string; __typename: 'companies' | 'people' },
|
||||||
@ -1,7 +1,8 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { selectedRowIdsState } from '../../../modules/ui/tables/states/selectedRowIdsState';
|
|
||||||
|
import { selectedRowIdsState } from '@/ui/tables/states/selectedRowIdsState';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
children: React.ReactNode | React.ReactNode[];
|
children: React.ReactNode | React.ReactNode[];
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
icon: ReactNode;
|
icon: ReactNode;
|
||||||
@ -1,6 +1,8 @@
|
|||||||
import { FaRegComment } from 'react-icons/fa';
|
import { FaRegComment } from 'react-icons/fa';
|
||||||
|
|
||||||
|
import { useOpenRightDrawer } from '@/ui/layout/right-drawer/hooks/useOpenRightDrawer';
|
||||||
|
|
||||||
import { EntityTableActionBarButton } from './EntityTableActionBarButton';
|
import { EntityTableActionBarButton } from './EntityTableActionBarButton';
|
||||||
import { useOpenRightDrawer } from '../../../modules/ui/layout/right-drawer/hooks/useOpenRightDrawer';
|
|
||||||
|
|
||||||
export function TableActionBarButtonToggleComments() {
|
export function TableActionBarButtonToggleComments() {
|
||||||
// TODO: here it would be nice to access the table context
|
// TODO: here it would be nice to access the table context
|
||||||
@ -1,11 +1,12 @@
|
|||||||
|
import { ReactNode, useRef } from 'react';
|
||||||
|
import { FaAngleDown } from 'react-icons/fa';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useRef, ReactNode } from 'react';
|
|
||||||
import { useOutsideAlerter } from '../../../hooks/useOutsideAlerter';
|
import { useOutsideAlerter } from '../../../hooks/useOutsideAlerter';
|
||||||
import {
|
import {
|
||||||
overlayBackground,
|
overlayBackground,
|
||||||
textInputStyle,
|
textInputStyle,
|
||||||
} from '../../../layout/styles/themes';
|
} from '../../../layout/styles/themes';
|
||||||
import { FaAngleDown } from 'react-icons/fa';
|
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
label: string;
|
label: string;
|
||||||
@ -1,18 +1,18 @@
|
|||||||
import { ChangeEvent, useCallback, useState } from 'react';
|
import { ChangeEvent, useCallback, useState } from 'react';
|
||||||
import DropdownButton from './DropdownButton';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
FilterableFieldsType,
|
||||||
FilterConfigType,
|
FilterConfigType,
|
||||||
FilterOperandType,
|
FilterOperandType,
|
||||||
FilterableFieldsType,
|
|
||||||
SelectedFilterType,
|
SelectedFilterType,
|
||||||
} from '../../../interfaces/filters/interface';
|
} from '@/filters-and-sorts/interfaces/filters/interface';
|
||||||
import {
|
import { SearchResultsType, useSearch } from '@/search/services/search';
|
||||||
SearchResultsType,
|
import { humanReadableDate } from '@/utils/utils';
|
||||||
useSearch,
|
|
||||||
} from '../../../services/api/search/search';
|
|
||||||
import DatePicker from '../../form/DatePicker';
|
import DatePicker from '../../form/DatePicker';
|
||||||
import styled from '@emotion/styled';
|
|
||||||
import { humanReadableDate } from '../../../services/utils';
|
import DropdownButton from './DropdownButton';
|
||||||
|
|
||||||
type OwnProps<TData extends FilterableFieldsType> = {
|
type OwnProps<TData extends FilterableFieldsType> = {
|
||||||
isFilterSelected: boolean;
|
isFilterSelected: boolean;
|
||||||
@ -1,11 +1,13 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import SortOrFilterChip from './SortOrFilterChip';
|
|
||||||
import { FaArrowDown, FaArrowUp } from 'react-icons/fa';
|
import { FaArrowDown, FaArrowUp } from 'react-icons/fa';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
FilterableFieldsType,
|
FilterableFieldsType,
|
||||||
SelectedFilterType,
|
SelectedFilterType,
|
||||||
} from '../../../interfaces/filters/interface';
|
} from '@/filters-and-sorts/interfaces/filters/interface';
|
||||||
import { SelectedSortType } from '../../../interfaces/sorts/interface';
|
import { SelectedSortType } from '@/filters-and-sorts/interfaces/sorts/interface';
|
||||||
|
|
||||||
|
import SortOrFilterChip from './SortOrFilterChip';
|
||||||
|
|
||||||
type OwnProps<SortField, TData extends FilterableFieldsType> = {
|
type OwnProps<SortField, TData extends FilterableFieldsType> = {
|
||||||
sorts: Array<SelectedSortType<SortField>>;
|
sorts: Array<SelectedSortType<SortField>>;
|
||||||
@ -1,9 +1,11 @@
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import DropdownButton from './DropdownButton';
|
|
||||||
import {
|
import {
|
||||||
SelectedSortType,
|
SelectedSortType,
|
||||||
SortType,
|
SortType,
|
||||||
} from '../../../interfaces/sorts/interface';
|
} from '@/filters-and-sorts/interfaces/sorts/interface';
|
||||||
|
|
||||||
|
import DropdownButton from './DropdownButton';
|
||||||
|
|
||||||
type OwnProps<SortField> = {
|
type OwnProps<SortField> = {
|
||||||
isSortSelected: boolean;
|
isSortSelected: boolean;
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { TbX } from 'react-icons/tb';
|
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
|
import { TbX } from 'react-icons/tb';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
id: string;
|
id: string;
|
||||||
@ -1,18 +1,19 @@
|
|||||||
|
import { ReactNode, useCallback, useState } from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { ReactNode, useCallback, useState } from 'react';
|
|
||||||
import { SortDropdownButton } from './SortDropdownButton';
|
|
||||||
import { FilterDropdownButton } from './FilterDropdownButton';
|
|
||||||
import SortAndFilterBar from './SortAndFilterBar';
|
|
||||||
import {
|
import {
|
||||||
FilterableFieldsType,
|
FilterableFieldsType,
|
||||||
FilterConfigType,
|
FilterConfigType,
|
||||||
SelectedFilterType,
|
SelectedFilterType,
|
||||||
} from '../../../interfaces/filters/interface';
|
} from '@/filters-and-sorts/interfaces/filters/interface';
|
||||||
import {
|
import {
|
||||||
SortType,
|
|
||||||
SelectedSortType,
|
SelectedSortType,
|
||||||
} from '../../../interfaces/sorts/interface';
|
SortType,
|
||||||
|
} from '@/filters-and-sorts/interfaces/sorts/interface';
|
||||||
|
|
||||||
|
import { FilterDropdownButton } from './FilterDropdownButton';
|
||||||
|
import SortAndFilterBar from './SortAndFilterBar';
|
||||||
|
import { SortDropdownButton } from './SortDropdownButton';
|
||||||
|
|
||||||
type OwnProps<SortField, TData extends FilterableFieldsType> = {
|
type OwnProps<SortField, TData extends FilterableFieldsType> = {
|
||||||
viewName: string;
|
viewName: string;
|
||||||
@ -59,7 +60,7 @@ const StyledFilters = styled.div`
|
|||||||
margin-right: ${(props) => props.theme.spacing(2)};
|
margin-right: ${(props) => props.theme.spacing(2)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function TableHeader<SortField, TData extends FilterableFieldsType>({
|
export function TableHeader<SortField, TData extends FilterableFieldsType>({
|
||||||
viewName,
|
viewName,
|
||||||
viewIcon,
|
viewIcon,
|
||||||
availableSorts,
|
availableSorts,
|
||||||
@ -150,8 +151,6 @@ function TableHeader<SortField, TData extends FilterableFieldsType>({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default TableHeader;
|
|
||||||
|
|
||||||
function updateSortOrFilterByKey<SortOrFilter extends { key: string }>(
|
function updateSortOrFilterByKey<SortOrFilter extends { key: string }>(
|
||||||
sorts: Readonly<SortOrFilter[]>,
|
sorts: Readonly<SortOrFilter[]>,
|
||||||
newSort: SortOrFilter,
|
newSort: SortOrFilter,
|
||||||
@ -1,7 +1,8 @@
|
|||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import { render, fireEvent } from '@testing-library/react';
|
|
||||||
import { useOutsideAlerter } from '../useOutsideAlerter';
|
|
||||||
import { act } from 'react-dom/test-utils';
|
import { act } from 'react-dom/test-utils';
|
||||||
|
import { fireEvent, render } from '@testing-library/react';
|
||||||
|
|
||||||
|
import { useOutsideAlerter } from '../useOutsideAlerter';
|
||||||
const onOutsideClick = jest.fn();
|
const onOutsideClick = jest.fn();
|
||||||
|
|
||||||
function TestComponent() {
|
function TestComponent() {
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { isDefined } from '../../../utils/type-guards/isDefined';
|
|
||||||
|
import { isDefined } from '@/utils/type-guards/isDefined';
|
||||||
|
|
||||||
export function useListenClickOutsideArrayOfRef<T extends HTMLElement>(
|
export function useListenClickOutsideArrayOfRef<T extends HTMLElement>(
|
||||||
arrayOfRef: Array<React.RefObject<T>>,
|
arrayOfRef: Array<React.RefObject<T>>,
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { ReactComponent as IconAddressBookRaw } from '../svgs/address-book.svg';
|
|
||||||
|
|
||||||
import { TablerIconsProps } from '@tabler/icons-react';
|
import { TablerIconsProps } from '@tabler/icons-react';
|
||||||
|
|
||||||
|
import { ReactComponent as IconAddressBookRaw } from '../svgs/address-book.svg';
|
||||||
|
|
||||||
export function IconAddressBook(props: TablerIconsProps): JSX.Element {
|
export function IconAddressBook(props: TablerIconsProps): JSX.Element {
|
||||||
const size = props.size ?? 24;
|
const size = props.size ?? 24;
|
||||||
const stroke = props.stroke ?? 2;
|
const stroke = props.stroke ?? 2;
|
||||||
@ -1,3 +1,3 @@
|
|||||||
export { IconAward } from '@tabler/icons-react';
|
|
||||||
export { IconAddressBook } from './components/IconAddressBook';
|
export { IconAddressBook } from './components/IconAddressBook';
|
||||||
export { IconComment } from './components/IconComment';
|
export { IconComment } from './components/IconComment';
|
||||||
|
export { IconAward } from '@tabler/icons-react';
|
||||||
|
Before Width: | Height: | Size: 539 B After Width: | Height: | Size: 539 B |
@ -1,7 +1,9 @@
|
|||||||
import { Navbar } from './navbar/Navbar';
|
|
||||||
import styled from '@emotion/styled';
|
|
||||||
import { ThemeProvider } from '@emotion/react';
|
import { ThemeProvider } from '@emotion/react';
|
||||||
import { User } from '../interfaces/entities/user.interface';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
import { User } from '@/users/interfaces/user.interface';
|
||||||
|
|
||||||
|
import { Navbar } from './navbar/Navbar';
|
||||||
import { lightTheme } from './styles/themes';
|
import { lightTheme } from './styles/themes';
|
||||||
|
|
||||||
const StyledLayout = styled.div`
|
const StyledLayout = styled.div`
|
||||||
@ -26,7 +28,7 @@ type OwnProps = {
|
|||||||
user?: User;
|
user?: User;
|
||||||
};
|
};
|
||||||
|
|
||||||
function AppLayout({ children, user }: OwnProps) {
|
export function AppLayout({ children, user }: OwnProps) {
|
||||||
return (
|
return (
|
||||||
<ThemeProvider theme={lightTheme}>
|
<ThemeProvider theme={lightTheme}>
|
||||||
<StyledLayout>
|
<StyledLayout>
|
||||||
@ -36,5 +38,3 @@ function AppLayout({ children, user }: OwnProps) {
|
|||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AppLayout;
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
const StyledPanel = styled.div`
|
const StyledPanel = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -1,11 +1,12 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import TopBar from '../top-bar/TopBar';
|
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
import { RightDrawer } from '../right-drawer/RightDrawer';
|
import styled from '@emotion/styled';
|
||||||
import { Panel } from '../Panel';
|
|
||||||
import { isRightDrawerOpenState } from '../../modules/ui/layout/right-drawer/states/isRightDrawerOpenState';
|
|
||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { Panel } from '../Panel';
|
||||||
|
import { RightDrawer } from '../right-drawer/components/RightDrawer';
|
||||||
|
import { isRightDrawerOpenState } from '../right-drawer/states/isRightDrawerOpenState';
|
||||||
|
import { TopBar } from '../top-bar/TopBar';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
children: JSX.Element;
|
children: JSX.Element;
|
||||||
title: string;
|
title: string;
|
||||||
@ -45,7 +46,7 @@ const LeftContainer = styled.div<LeftContainerProps>`
|
|||||||
position: relative;
|
position: relative;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function FullWidthContainer({
|
export function WithTopBarContainer({
|
||||||
children,
|
children,
|
||||||
title,
|
title,
|
||||||
icon,
|
icon,
|
||||||
@ -65,5 +66,3 @@ function FullWidthContainer({
|
|||||||
</StyledContainer>
|
</StyledContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default FullWidthContainer;
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
|
||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
label: string;
|
label: string;
|
||||||
@ -1,11 +1,13 @@
|
|||||||
import styled from '@emotion/styled';
|
import { TbBuilding, TbUser } from 'react-icons/tb';
|
||||||
import { useMatch, useResolvedPath } from 'react-router-dom';
|
import { useMatch, useResolvedPath } from 'react-router-dom';
|
||||||
import { User } from '../../interfaces/entities/user.interface';
|
import styled from '@emotion/styled';
|
||||||
import { Workspace } from '../../interfaces/entities/workspace.interface';
|
|
||||||
|
import { User } from '@/users/interfaces/user.interface';
|
||||||
|
import { Workspace } from '@/workspaces/interfaces/workspace.interface';
|
||||||
|
|
||||||
import NavItem from './NavItem';
|
import NavItem from './NavItem';
|
||||||
import NavTitle from './NavTitle';
|
import NavTitle from './NavTitle';
|
||||||
import WorkspaceContainer from './WorkspaceContainer';
|
import WorkspaceContainer from './WorkspaceContainer';
|
||||||
import { TbBuilding, TbUser } from 'react-icons/tb';
|
|
||||||
|
|
||||||
const NavbarContainer = styled.div`
|
const NavbarContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { Workspace } from '../../interfaces/entities/workspace.interface';
|
|
||||||
|
import { Workspace } from '@/workspaces/interfaces/workspace.interface';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
workspace: Workspace;
|
workspace: Workspace;
|
||||||
@ -1,10 +1,13 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
import { isRightDrawerOpenState } from '../../modules/ui/layout/right-drawer/states/isRightDrawerOpenState';
|
|
||||||
|
import { isDefined } from '@/utils/type-guards/isDefined';
|
||||||
|
|
||||||
|
import { Panel } from '../../Panel';
|
||||||
|
import { isRightDrawerOpenState } from '../states/isRightDrawerOpenState';
|
||||||
|
import { rightDrawerPageState } from '../states/rightDrawerPageState';
|
||||||
|
|
||||||
import { RightDrawerRouter } from './RightDrawerRouter';
|
import { RightDrawerRouter } from './RightDrawerRouter';
|
||||||
import { rightDrawerPageState } from '../../modules/ui/layout/right-drawer/states/rightDrawerPageState';
|
|
||||||
import { isDefined } from '../../modules/utils/type-guards/isDefined';
|
|
||||||
import { Panel } from '../Panel';
|
|
||||||
|
|
||||||
const StyledRightDrawer = styled.div`
|
const StyledRightDrawer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user